X-Git-Url: http://git.onelab.eu/?p=util-vserver-pl.git;a=blobdiff_plain;f=scripts%2Fvuseradd;h=f64d62da30e06fc24ed797934decb8b32bd73c80;hp=9ace75c385546747d80f1102e662eb631e69e3bc;hb=HEAD;hpb=289a5b5d7a75dcef7f4cc6ef1ee258e3938311ea diff --git a/scripts/vuseradd b/scripts/vuseradd index 9ace75c..f64d62d 100755 --- a/scripts/vuseradd +++ b/scripts/vuseradd @@ -39,11 +39,15 @@ usage() } # Get options -while getopts "t:" opt ; do +ISOLATE=false +while getopts "it:" opt ; do case $opt in t) TYPE="$OPTARG" ;; + i) + ISOLATE=true + ;; *) usage ;; @@ -77,10 +81,17 @@ if [ ! -d $__CONFDIR/$NAME ] ; then HAS_VSERVERDIR=0 fi - $_VSERVER $NAME build -m skeleton --context $USERID \ + if [ "$ISOLATE" = "true" ] ; then + $_VSERVER $NAME build -m skeleton --context $USERID \ + --interface nodev:`hostname -i` \ + --flags persistent,~info_init + else + $_VSERVER $NAME build -m skeleton --context $USERID \ --interface nodev:`hostname -i` \ - --interface nodev:127.0.0.1 \ + --interface nodev:127.0.0.1 \ --flags persistent,~info_init + fi + RETVAL=$? DIR=$__CONFDIR/$NAME if [ $RETVAL -ne 0 ] ; then @@ -89,14 +100,17 @@ if [ ! -d $__CONFDIR/$NAME ] ; then fi mkdir -p $DIR/apps/init $DIR/rlimits $DIR/sched $DIR/cgroup $DIR/dlimits/0 $DIR/sysctl/0 echo default > $DIR/apps/init/mark - echo 1000 > $DIR/rlimits/nproc.hard # Set persistent for the network context - echo persistent,lback_allow > $DIR/nflags + if [ "$ISOLATE" = "true" ]; then + echo persistent,lback_allow,hide_lback,lback_remap > $DIR/nflags + else + echo persistent,lback_allow > $DIR/nflags + fi # Set default capabilities echo "CAP_NET_RAW" > $DIR/bcapabilities - echo "" > $DIR/ccapabilities + touch $DIR/ccapabilities # Set up the scheduler echo 100 > $DIR/sched/interval