local file=
for file in "$i"/*; do
- test -e "$file" || continue
- case "$file" in
- (*/CVS) test ! -d "$file" || continue;;
- (*.rpmsave|*.rpmnew|*.rpmorig)
- continue;;
- esac
+ isRegularFile "$file" || continue
cp -a "$file" "$dst/"
done
{
test -z "$ROOTDIR" || return 0
- for item in "\"$CONFDIR/.defaults/vdirbase\" 1" "$DEFAULT_VSERVERDIR"; do
+ for item in "\"$__CONFDIR/.defaults/vdirbase\" 1" "$__DEFAULT_VSERVERDIR"; do
eval set -- "$item"
ROOTDIR=$1
ROOTDIR_REL=$2
done
test -d "$ROOTDIR" || {
- echo "Root-directory '$ROOTDIR' does not exist or is invalid"
+ echo "Root-directory '$ROOTDIR' does not exist or is invalid" >&2
exit 1
}
}
done
}
+
+## Usage: getDistribution [<default>]
function getDistribution
{
test -z "$DISTRIBUTION" || return 0
elif test -e /etc/debian_version; then
set -- $(cat /etc/debian_version)
DISTRIBUTION=deb$1
+ elif test -e /etc/SuSE-release; then
+ set -- $(cat /etc/SuSE-release)
+ DISTRIBUTION=suse$3
+ elif test -e /etc/gentoo-release; then
+ set -- $(cat /etc/gentoo-release)
+ DISTRIBUTION=gentoo$5
+ elif test -e /etc/slackware-release; then
+ set -- $(cat /etc/slackware-release)
+ DISTRIBUTION=slackware$2
+ elif test -n "$1"; then
+ DISTRIBUTION=$1
else
- echo "Can not determine distribution; please specify it manually"
- echo "with the '-d' option"
+ echo \
+"Can not determine distribution; please specify it manually
+with the '-d' option" >&2
exit 1
fi >&2
}
{
test -z "$1" || _renameVserverCfg
test ! -d "$VDIR" -a ! -d "$SETUP_CONFDIR" || {
- echo "vserver-topdirectory and/or configuration exist already; "
- echo "please try to use '--force', or remove them manually"
+ echo \
+"vserver-topdirectory '$VDIR' and/or configuration at '$SETUP_CONFDIR'
+exist already; please try to use '--force', or remove them manually"
+>&2
exit 1
} >&2
mkdir -p -m755 "$VDIR"
chattr -t "$VDIR"
- mkdir -p -m755 "$SETUP_CONFDIR"/apps "$VDIR"/{dev/pts,etc} "$SETUP_LOCKREVDIR"
+ mkdir -p -m755 "$SETUP_CONFDIR"/apps "$VDIR"/{dev/pts,etc}
ln -s "$VDIR" "$SETUP_CONFDIR/vdir"
makeDevEntry "$VDIR"/dev $spec
done <$_DEV_FILE
- findAndCopy "$VDIR"/etc/hosts "$CONFDIR"/.defaults/files/hosts "$CONFDIR/.distributions/$DISTRIBUTION"/files/hosts \
- "$DISTRIBDIR/$DISTRIBUTION"/files/hosts "$DISTRIBDIR"/defaults/files/hosts ""
+ mkdir -p "$VDIR"/proc
+ findAndCopy "$VDIR"/etc/hosts "$__CONFDIR"/.defaults/files/hosts "$__CONFDIR/.distributions/$DISTRIBUTION"/files/hosts \
+ "$__DISTRIBDIR/$DISTRIBUTION"/files/hosts "$__DISTRIBDIR"/defaults/files/hosts ""
for i in nsswitch.conf krb5.conf krb.conf krb.realms ldap.conf localtime resolv.conf; do
- findAndCopy "$VDIR"/etc/$i "$CONFDIR/.defaults/files/$i" "$CONFDIR/.distributions/$DISTRIBUTION/files/$i" ""
+ findAndCopy "$VDIR"/etc/$i "$__CONFDIR/.defaults/files/$i" "$__CONFDIR/.distributions/$DISTRIBUTION/files/$i" ""
done
}
_setVserverDir
_setVdir
- findFile _DEV_FILE "$CONFDIR/.distributions/$DISTRIBUTION/devs" "$DISTRIBDIR/$DISTRIBUTION/devs" "$DISTRIBDIR/defaults/devs"
- findDir _EXECDIR "$CONFDIR/.distributions/$DISTRIBUTION/execdir" "$DISTRIBDIR/$DISTRIBUTION/execdir" /
- findFile BUILD_INITPRE "$CONFDIR/.distributions/$DISTRIBUTION/initpre" "$DISTRIBDIR/$DISTRIBUTION/initpre" ""
- findFile BUILD_INITPOST "$CONFDIR/.distributions/$DISTRIBUTION/initpost" "$DISTRIBDIR/$DISTRIBUTION/initpost" ""
+ findFile _DEV_FILE "$__CONFDIR/.distributions/$DISTRIBUTION/devs" "$__DISTRIBDIR/$DISTRIBUTION/devs" "$__DISTRIBDIR/defaults/devs"
+ findDir _EXECDIR "$__CONFDIR/.distributions/$DISTRIBUTION/execdir" "$__DISTRIBDIR/$DISTRIBUTION/execdir" /
+ findFile BUILD_INITPRE "$__CONFDIR/.distributions/$DISTRIBUTION/initpre" "$__DISTRIBDIR/$DISTRIBUTION/initpre" ""
+ findFile BUILD_INITPOST "$__CONFDIR/.distributions/$DISTRIBUTION/initpost" "$__DISTRIBDIR/$DISTRIBUTION/initpost" ""
}