X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=distrib%2Fgentoo%2Finitpre;h=4a66bf541de574d67a7d604888f8c3d690d64fd9;hb=95e2774070e989fe9cf9f48dae5fa054e55e2a3e;hp=24ffd80d4fee38dd1f63e7d64acb0f5e6388cc72;hpb=3b34449070c0846fdc49436d1edd5916512f1644;p=util-vserver.git diff --git a/distrib/gentoo/initpre b/distrib/gentoo/initpre index 24ffd80..4a66bf5 100755 --- a/distrib/gentoo/initpre +++ b/distrib/gentoo/initpre @@ -21,20 +21,35 @@ vdir="$1"/vdir . "$2" # portage stuff - echo ">>> Adding shared /usr/portage to fstab ... " -if test -d /usr/portage; then +hash portageq &>/dev/null + +if test $? -eq 0; then + _PORTDIR=$(portageq portdir) + _DISTDIR=$(portageq distdir) +else + _PORTDIR=/usr/portage + _DISTDIR=/usr/portage/distfiles +fi + +if test -d $_PORTDIR; then ( echo echo "# shared portage tree" - echo "/usr/portage /usr/portage none bind,ro 0 0" - echo "/usr/portage/distfiles /usr/portage/distfiles none bind,rw 0 0" + echo "${_PORTDIR} /usr/portage none bind,ro 0 0" ) >> "$1"/fstab else - echo "!!! Cannot find /usr/portage! You should definitely use a" + echo "!!! Cannot find a portage tree! You should definitely use a" echo "!!! shared portage tree if you have multiple Gentoo guests!" fi +if test -d $_DISTDIR; then + echo "${_DISTDIR} /usr/portage/distfiles none bind,rw 0 0" >> "$1"/fstab +else + echo "!!! Cannot find distfiles directory! You should definitely use a" + echo "!!! shared distfiles directory if you have multiple Gentoo guests!" +fi + # initstyle sanity initstyle=sysv @@ -46,3 +61,5 @@ if test "$initstyle" != "gentoo" -a "$initstyle" != "plain"; then echo "!!! The init-style you specified is not supported for Gentoo" echo "!!! Please use one of: plain, gentoo" fi + +echo -n ">>> Unpacking template ... "