New ebuilds

git-svn-id: svn+ssh://svnintern.kmrc.de/projects/gentoo/iwm-overlay@8414 cbe59ace-07ea-0310-918e-868702b5370d
This commit is contained in:
2009-02-02 17:06:12 +00:00
parent 02dbca1f23
commit 4b2835d3c7
24 changed files with 2188 additions and 13 deletions
@@ -0,0 +1,300 @@
# Completion for the vserver command. Source this file (or on some systems
# add it to ~/.bash_completion and start a new shell) and bash's completion
# mechanism will know all about vserver's options!
#
# Copyright (C) Thomas Champagne <lafeuil@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# The latest version of this software can be obtained here:
#
# http://linux-vserver.org/Vserver+Completion
#
# version 0.4.0
have vserver-info && {
: ${UTIL_VSERVER_VARS:=$(vserver-info - SYSINFO |grep prefix: | awk '{ print $2}')/lib/util-vserver/util-vserver-vars}
test -e "$UTIL_VSERVER_VARS" && {
. "$UTIL_VSERVER_VARS"
. "$_LIB_FUNCTIONS"
_vserver() {
local cur cmds cmdOpts cmdMethodOpts helpCmds names names_pipe func i j method
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
# find available vServers:
# call function getAllVservers in vserver library
getAllVservers names
names_pipe=`echo ${names[@]} | sed 's/ /|/g'`
# available commands
cmds='start stop restart condrestart suexec exec enter chkconfig \
running status unify pkg apt-get apt-config apt-cache \
rpm pkgmgmt delete'
# options (long and short name)
cmdOpts='--help --version --debug --defaulttty -s --sync -v \
--verbose --silent --'
cmdMethodOpts='-m -n --context --confdir --lockfile \
--hostname --netdev --netbcast --netmask \
--netprefix --interface --cpuset \
--cpusetcpus --cpusetmems --cpusetvirt \
--initstyle --flags --help --'
# if the previous option is a single option
helpCmds='--help|--version'
if [[ ${COMP_WORDS[1]} == @($helpCmds) ]] ; then
return 0
fi
# lookup the vServer name
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @($names_pipe) ]] ; then
# found it!
break
fi
done
#a vserver has been found
if (( $i < ${#COMP_WORDS[@]}-1 )) ; then
# Show the vserver command without build
case "${COMP_WORDS[i+1]}" in
start)
COMPREPLY=( $( compgen -W "--rescue --rescue-cmd" -- $cur ) )
;;
# No completion for apt-config
stop|restart|condrestart|enter|running|status|apt-config|delete)
;;
suexec)
# I don't know how to do
COMPREPLY=( $( compgen -W -- $cur ) )
;;
exec)
#I don't know how to do
COMPREPLY=( $( compgen -W "" -- $cur ) )
;;
unify)
COMPREPLY=( $( compgen -W "-R" -- $cur ) )
;;
apt-get|apt-cache)
func=${COMP_WORDS[i+1]}
COMP_WORDS=( ${COMP_WORDS[@]:$((i+1))} )
COMP_CWORD=$((COMP_CWORD-i-1))
declare -f _${func//-/_} > /dev/null && _${func//-/_}
;;
*)
COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
;;
esac
return 0
else
#no vserver name found
prev=${COMP_WORDS[COMP_CWORD-1]}
#search the new name of vserver
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
if [[ ${COMP_WORDS[i]} == !(vserver|-*) ]] ; then
# found it!
break
fi
done
if (( $i < ${#COMP_WORDS[@]}-1 )) ; then
j=$i
i=${#COMP_WORDS[@]}
for (( ; j < ${#COMP_WORDS[@]}-1; j++ )) ; do
if [[ ${COMP_WORDS[j]} == "--" ]]; then
# method's parameter
case "$method" in
legacy|copy)
;;
apt-rpm)
COMPREPLY=( $( compgen -W "-d" -- $cur ) )
;;
yum)
COMPREPLY=( $( compgen -W "-d" -- $cur ) )
;;
rpm)
COMPREPLY=( $( compgen -W "-d --empty --force --nodeps" -- $cur ) )
;;
skeleton)
;;
debootstrap)
COMPREPLY=( $( compgen -W "-d -m -s --" -- $cur ) )
;;
*)
;;
esac
return 0
break
fi
if [[ ${COMP_WORDS[j]} == @(build|-m) ]]; then
i=$j
if (( $j+1 < ${#COMP_WORDS[@]}-1 )) ; then
method=${COMP_WORDS[j+1]}
fi
fi
done
if (( $i < ${#COMP_WORDS[@]}-1 )) ; then
case $prev in
--help)
;;
-n|--context|--confdir|--lockfile|--hostname|--netdev|--netbcast|--netmask|--netprefix|--interface|--cpuset|--cpusetcpus|--cpusetmems|--cpusetvirt|--initstyle|--flags)
COMPREPLY=( $( compgen -W "" -- $cur ) )
;;
-m)
COMPREPLY=( $( compgen -W "legacy copy apt-rpm yum rpm skeleton debootstrap" -- $cur ) )
;;
*)
COMPREPLY=( $( compgen -W "$cmdMethodOpts" -- $cur ) )
;;
esac
else
COMPREPLY=( $( compgen -W "build" -- $cur ) )
fi
else
COMPREPLY=( $( compgen -W "${names[@]} $cmdOpts" -- $cur ) )
fi
return 0
fi
return 0
}
complete -F _vserver vserver
_vapt_rpm_yum()
{
local cur cmds cmdOpts helpCmds names func i
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
# options (long and short name)
cmdOpts='--help --version --quiet -q --all'
# if the previous option is a single option
helpCmds='--help|--version'
if [[ "${COMP_WORDS[1]}" == "@($helpCmds)" ]] ; then
return 0
fi
# search --
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
if [[ ${COMP_WORDS[i]} = "--" ]] ; then
# found it!
break
fi
done
# find available vServers
# call function getAllVservers in vserver library
getAllVservers names
names_pipe=`echo ${names[@]}" --all" | sed 's/ /|/g'`
if (( $i < ${#COMP_WORDS[@]}-1 )) && (( $i < $COMP_CWORD )) ; then
func=${COMP_WORDS[0]:1}
COMP_WORDS=( $func ${COMP_WORDS[@]:$((i+1))} )
COMP_CWORD=$((COMP_CWORD-i))
declare -f _${func//-/_} > /dev/null && _${func//-/_}
else
# search vServer name
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
if [[ ${COMP_WORDS[i]} == @($names_pipe) ]] ; then
# found it!
break
fi
done
if (( $i < ${#COMP_WORDS[@]}-1 )) ; then
if [[ "${COMP_WORDS[i]}" = "--all" ]] ; then
cmdOpts='--'
COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
else
cmdOpts='--'
COMPREPLY=( $( compgen -W "${names[@]} $cmdOpts" -- $cur ) )
fi
else
COMPREPLY=( $( compgen -W "${names[@]} $cmdOpts" -- $cur ) )
fi
fi
return 0
}
_vserver_copy()
{
local cur prev cmdOpts helpCmds confCmds names names_pipe i
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
# find available vServers
# call function getAllVservers in vserver library
getAllVservers names
names_pipe=`echo ${names[@]} | sed 's/ /|/g'`
# options (long and short name)
cmdOpts='--help -h --version -V --verbose -v --quiet -q \
--vsroot -r --rsh -R --stopstart -s \
--domain -d --ip -i'
# if the previous option is a single option
helpCmds='--help|-h|--version|-V'
if [[ ${COMP_WORDS[1]} == @($helpCmds) ]] ; then
return 0
fi
confCmds='--ip|-i|--domain|-d'
prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ $prev == @($confCmds) ]] ; then
return 0
fi
# search a vServer name
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
if [[ ${COMP_WORDS[i]} == @($names_pipe) ]] ; then
# found it!
break
fi
done
if (( $i < ${#COMP_WORDS[@]}-1 )) ; then
return 0
else
COMPREPLY=( $( compgen -W "${names[@]} $cmdOpts" -- $cur ) )
fi
return 0
}
complete -F _vapt_rpm_yum vapt-get
complete -F _vapt_rpm_yum vrpm
complete -F _vapt_rpm_yum vyum
complete -F _vserver_copy vserver-copy
}
}
@@ -0,0 +1,16 @@
Index: scripts/vserver.functions
===================================================================
--- scripts/vserver.functions (revision 2626)
+++ scripts/vserver.functions (revision 2634)
@@ -315,9 +315,10 @@
(xgentoo)
test -n "$RUNLEVEL_START" || RUNLEVEL_START="default"
+ RC_PATH=/usr/sbin:/usr/bin:/sbin:/bin
INITCMD_START=( env TERM=$TERM /lib/rcscripts/sh/init-vserver.sh "$RUNLEVEL_START" )
- INITCMD_STOP=( env -i TERM=$TERM RUNLEVEL=0 /sbin/rc shutdown )
+ INITCMD_STOP=( env -i PATH=$RC_PATH TERM=$TERM RUNLEVEL=0 /sbin/rc shutdown )
INITCMD_PREPARE=( $_FAKE_RUNLEVEL 3 /var/run/utmp )
;;
@@ -0,0 +1,126 @@
diff -NurpP util-vserver-0.30.214.orig/distrib/gentoo/initpost util-vserver-0.30.214/distrib/gentoo/initpost
--- util-vserver-0.30.214.orig/distrib/gentoo/initpost 2007-09-02 22:06:42.000000000 +0200
+++ util-vserver-0.30.214/distrib/gentoo/initpost 2008-03-11 10:39:53.955478789 +0100
@@ -51,6 +51,11 @@ $_CHROOT_SH mkdir /usr/portage 2>/dev/nu
$_CHROOT_SH mkdir /usr/portage/distfiles 2>/dev/null || :
+# check if we have openrc
+have_openrc=0
+$_CHROOT_SH testfile /lib/rc/bin/is_older_than && have_openrc=1
+
+
# gentoo initstyle magic
initstyle=sysv
test -e "$cfgdir"/apps/init/style && initstyle=$(<"$cfgdir"/apps/init/style)
@@ -59,8 +64,8 @@ if test "$initstyle" == "gentoo"; then
echo ">>> Installing special init-style magic ... "
$_CAT "$__DISTRIBDIR"/gentoo/init-vserver.sh | \
- $_CHROOT_SH truncate /lib/rcscripts/sh/init-vserver.sh
- $_CHROOT_SH chmod 0755 /lib/rcscripts/sh/init-vserver.sh
+ $_CHROOT_SH truncate /lib/rc/sh/init-vserver.sh
+ $_CHROOT_SH chmod 0755 /lib/rc/sh/init-vserver.sh
$_CAT "$__DISTRIBDIR"/gentoo/reboot.sh | \
$_CHROOT_SH truncate /etc/init.d/reboot.sh
@@ -78,23 +83,29 @@ if test "$initstyle" == "gentoo"; then
echo "!!! Consult the Gentoo Handbook on how to chroot and install"
echo "!!! packages into the guest environment."
echo "!!!"
+else
+ # fix gettys in inittab
+ if $_CHROOT_SH testfile /etc/inittab; then
+ echo ">>> Fixing inittab ... "
+ chrootsed /etc/inittab \
+ -e 's/\(^[^#].*getty.*$\)/#\1/'
+ fi
fi
-
# unneeded runlevel scripts
-echo ">>> Fixing default runlevel scripts ... "
-$_CHROOT_SH rm /etc/runlevels/boot/{clock,consolefont,keymaps,modules,net.lo} 2>/dev/null || :
-$_CHROOT_SH rm /etc/runlevels/default/{hdparm,netmount} 2>/dev/null || :
-
+if test $have_openrc -ne 1; then
+ echo ">>> Fixing default runlevel scripts ... "
+ $_CHROOT_SH rm /etc/runlevels/boot/{clock,consolefont,keymaps,modules,net.lo} 2>/dev/null || :
+ $_CHROOT_SH rm /etc/runlevels/default/{hdparm,netmount} 2>/dev/null || :
+fi
# setting hostname
if test -r "$cfgdir"/uts/nodename && $_CHROOT_SH testfile /etc/conf.d/hostname; then
echo ">>> Setting hostname ... "
chrootsed /etc/conf.d/hostname \
- -e "s:HOSTNAME=\"\(.*\)\":HOSTNAME=\"$(< "$cfgdir"/uts/nodename)\":"
+ -e "s:\(HOSTNAME\)=\"\(.*\)\":\1=\"$(< "$cfgdir"/uts/nodename)\":i"
fi
-
# fix syslog-ng.conf
if $_CHROOT_SH testfile /etc/syslog-ng/syslog-ng.conf; then
echo ">>> Fixing syslog-ng.conf ... "
@@ -103,27 +114,21 @@ if $_CHROOT_SH testfile /etc/syslog-ng/s
-e 's:\(.*console_all.*\):#\1:g'
fi
-
-# fix gettys in inittab
-if $_CHROOT_SH testfile /etc/inittab; then
- echo ">>> Fixing inittab ... "
- chrootsed /etc/inittab \
- -e 's/\(^[^#].*getty.*$\)/#\1/'
-fi
-
-
# fix fstab for checkfs/localmount in baselayout-2
# (does not affect any previous versions)
-echo ">>> Fixing fstab ... "
-echo "/dev/hdv1 / ufs defaults 0 0" | $_CHROOT_SH truncate /etc/fstab
-
+if test $have_openrc -ne 1; then
+ echo ">>> Fixing fstab ... "
+ echo "/dev/hdv1 / ufs defaults 0 0" | $_CHROOT_SH truncate /etc/fstab
+fi
# always satisfy net dependency in baselayout-2
# (does not affect any previous versions)
-echo ">>> Providing dummy net dependency ... "
-$_CAT "$__DISTRIBDIR"/gentoo/net.vserver | \
-$_CHROOT_SH truncate /etc/init.d/net.vserver
-$_CHROOT_SH chmod 0755 /etc/init.d/net.vserver
-$_CHROOT_SH link /etc/init.d/net.vserver /etc/runlevels/boot/net.vserver
+if test $have_openrc -ne 1; then
+ echo ">>> Providing dummy net dependency ... "
+ $_CAT "$__DISTRIBDIR"/gentoo/net.vserver | \
+ $_CHROOT_SH truncate /etc/init.d/net.vserver
+ $_CHROOT_SH chmod 0755 /etc/init.d/net.vserver
+ $_CHROOT_SH link /etc/init.d/net.vserver /etc/runlevels/boot/net.vserver
+fi
popd &>/dev/null
diff -NurpP util-vserver-0.30.214.orig/scripts/vserver.functions util-vserver-0.30.214/scripts/vserver.functions
--- util-vserver-0.30.214.orig/scripts/vserver.functions 2007-09-02 22:06:41.000000000 +0200
+++ util-vserver-0.30.214/scripts/vserver.functions 2008-03-11 10:31:41.758515991 +0100
@@ -314,9 +314,18 @@ function _generateInitOptions
(xgentoo)
test -n "$RUNLEVEL_START" || RUNLEVEL_START="default"
+ RC_PATH=/usr/sbin:/usr/bin:/sbin:/bin
- INITCMD_START=( env TERM=$TERM /lib/rcscripts/sh/init-vserver.sh "$RUNLEVEL_START" )
- INITCMD_STOP=( env -i TERM=$TERM RUNLEVEL=0 /sbin/rc shutdown )
+ if test -x "$vdir/vdir/lib/rcscripts/sh/init-vserver.sh"; then
+ RC_WRAP=/lib/rcscripts/sh/init-vserver.sh
+ elif test -x "$vdir/vdir/lib/rc/sh/init-vserver.sh"; then
+ RC_WRAP=/lib/rc/sh/init-vserver.sh
+ else
+ panic "init-vserver.sh not found; aborting"
+ fi
+
+ INITCMD_START=( env TERM=$TERM $RC_WRAP "$RUNLEVEL_START" )
+ INITCMD_STOP=( env -i PATH=$RC_PATH TERM=$TERM RUNLEVEL=0 /sbin/rc shutdown )
INITCMD_PREPARE=( $_FAKE_RUNLEVEL 3 /var/run/utmp )
;;