ns-tools

Namespace utilities to reuse Open Source packaging efforts.
git clone git://r-36.net/ns-tools
Log | Files | Refs | README | LICENSE

ns-root (435B)


      1 #!/bin/sh
      2 
      3 if [ "$#" -lt 1 ];
      4 then
      5 	printf "usage: %s nsroot\n" "$(basename "$0")" >&2
      6 	exit 1
      7 fi
      8 nsroot="$1"
      9 
     10 if [ -z "$(printf "%s\n" "$nsroot" | grep "/")" ];
     11 then
     12 	if [ -e "/ns/$nsroot" ];
     13 	then
     14 		printf "/ns/%s\n" "$nsroot"
     15 		exit 0
     16 	fi
     17 	printf "Could not find nsroot '%s'.\n" "$nsroot" >&2
     18 	exit 1
     19 fi
     20 
     21 if [ ! -e "$nsroot" ];
     22 then
     23 	printf "Could not find nsroot '%s'.\n" "$nsroot" >&2
     24 	exit 1
     25 fi
     26 
     27 printf "%s\n" "$nsroot"
     28 exit 0
     29 
     30