hlfw.ca

registry

ref: 66203a502d9d10b9f83e5728be0d2ef97df027fb
dir: /services/

View raw version
#!/bin/rc

$argv0 = $0

fn usage {
    echo 'Usage:' $argv0 '[-o] [-f servicesdb] [-s svcfs]' >[1=2]
    exits 'usage'
}

dbfile=()
svcfs=()
order=1
while(~ $1 -*){
	switch($1){
	case -o; order=2
	case *
		~ $#* 1 && usage
		switch($1){
		case -f; dbfile=$2
		case -s; svcfs=$2
		case *; usage
		}
		shift
	}
	shift
}

! ~ $#* 0 && usage

if(~ $svcfs "")
	svcfs=`{ndb/ipquery sys $sysname registry | sed 's/registry=//'}
if(~ $svcfs ""){
	echo 'Unable to find Registry'
	exits 'registry'
}
# Ours, we check later for the one associated with svcfs
# With -s, parse the addr ipnet if exists and use that instead
ipnet=`{ndb/ipquery sys $sysname ipnet | sed 's/ipnet=//'}

fn mount {
	# Mount up svcfs in our namespace
	srv -c -m $svcfs^'!16675' services /mnt/services

}

fn publish {
	# Try /cfg/sysname/services if not set
	# Initial read + post everything
	#  - if we posted the service, service.local
}

fn serve {

}

# Walk the dir, parse addr file + build /srv/service.sysname.ipnet
# With -o, /srv/ipnet.sysname.service