X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=vbuild-init-vserver.sh;h=213efc59ea4690693bba7f3d7a0d8647568baef6;hb=495e884c5bc9b727a83c375c7e7841724707a9c9;hp=22a71dff99b1715c83b2b85a95bf8e30effe619b;hpb=70206fb506c1ad08bf2071c4ccd3ac1f50852ce8;p=build.git diff --git a/vbuild-init-vserver.sh b/vbuild-init-vserver.sh index 22a71dff..213efc59 100755 --- a/vbuild-init-vserver.sh +++ b/vbuild-init-vserver.sh @@ -33,6 +33,7 @@ function configure_yum_in_vserver () { vserver=$1; shift fcdistro=$1; shift + pldistro=$1; shift templates=/etc/vservers/.distributions/${fcdistro} if [ -f ${templates}/yum/yum.conf ] ; then @@ -63,8 +64,9 @@ function configure_yum_in_vserver () { echo "WARNING : cannot create myplc repo" else # exclude kernel from fedora repos + yumexclude=$(pl_plcyumexclude $fcdistro $pldistro $DIRNAME) for repo in /vservers/$vserver/etc/yum.repos.d/* ; do - [ -f $repo ] && yumconf_exclude $repo "exclude=$pl_KEXCLUDES" + [ -f $repo ] && yumconf_exclude $repo "exclude=$yumexclude" done # the build repo is not signed at this stage cat > /vservers/$vserver/etc/yum.repos.d/myplc.repo <> $BCAPFILE grep -q ^CAP_MKNOD $BCAPFILE || echo CAP_MKNOD >> $BCAPFILE grep -q ^CAP_IPC_LOCK $BCAPFILE || echo CAP_IPC_LOCK >> $BCAPFILE - # useful for f15 guests that use set_cap_file + # useful for f16 guests that use set_cap_file grep -q ^CAP_SETFCAP $BCAPFILE || echo CAP_SETFCAP >> $BCAPFILE else ### capabilities required for a myplc vserver # for /etc/plc.d/gpg - need to init /dev/random grep -q ^CAP_MKNOD $BCAPFILE || echo CAP_MKNOD >> $BCAPFILE grep -q ^CAP_NET_BIND_SERVICE $BCAPFILE || echo CAP_NET_BIND_SERVICE >> $BCAPFILE - # useful for f15 guests that use set_cap_file + # useful for f16 guests that use set_cap_file grep -q ^CAP_SETFCAP $BCAPFILE || echo CAP_SETFCAP >> $BCAPFILE fi @@ -192,11 +195,8 @@ function setup_vserver () { # Enable cgroup mkdir /etc/vservers/$vserver/cgroup - # Start Vserver automatically on boot - echo "default" > /etc/vservers/$vserver/apps/init/mark - - # Set the init style of your vserver to plain for f15 and higher - # not working with f15 anyways, systemd requires 2.6.36 to work + # Set the init style of your vserver to plain for f16 and higher + # not working with f16 anyways, systemd requires 2.6.36 to work case $fcdistro in f1[5-9]) echo plain > /etc/vservers/$vserver/apps/init/style ;; esac @@ -254,7 +254,7 @@ function setup_vserver () { fi # minimal config in the vserver for yum to work - [ "$pkg_method" = "yum" ] && configure_yum_in_vserver $vserver $fcdistro + [ "$pkg_method" = "yum" ] && configure_yum_in_vserver $vserver $fcdistro $pldistro # set up resolv.conf cp /etc/resolv.conf /vservers/$vserver/etc/resolv.conf @@ -461,6 +461,7 @@ function usage () { echo " -d pldistro - defaults to $DEFAULT_PLDISTRO" echo " -p personality - defaults to $DEFAULT_PERSONALITY" echo " -i ifname: determines ip and netmask attached to ifname, and passes it to the vserver" + echo " -r : set apps/init/mark to default so the vserver restart upon reboot" echo " -v : verbose - passes -v to calls to vserver" echo "vserver-options" echo " all args after the optional -- are passed to vserver build " @@ -486,14 +487,16 @@ function main () { esac VERBOSE= + RESISTANT="" IFNAME="" VSERVER_OPTIONS="" - while getopts "f:d:p:i:v" opt ; do + while getopts "f:d:p:i:rv" opt ; do case $opt in f) fcdistro=$OPTARG;; d) pldistro=$OPTARG;; p) personality=$OPTARG;; i) IFNAME=$OPTARG;; + r) RESISTANT="true";; v) VERBOSE="-v" ;; *) usage ;; esac @@ -532,10 +535,14 @@ function main () { [ -z "$pldistro" ] && pldistro=$DEFAULT_PLDISTRO [ -z "$personality" ] && personality=$DEFAULT_PERSONALITY - setup_vserver $vserver $fcdistro $personality + setup_vserver $vserver $fcdistro $pldistro $personality devel_or_vtest_tools $vserver $fcdistro $pldistro $personality post_install $vserver $personality + # Start Vserver automatically on boot + [ -n "$RESISTANt" ] && echo "default" > /etc/vservers/$vserver/apps/init/mark + + echo $COMMAND Done } main "$@"