mirror of
https://codeberg.org/scip/jaildk.git
synced 2025-12-16 20:21:05 +01:00
implement #20: added -s parameter to base command to instal scripts
This commit is contained in:
@@ -143,7 +143,7 @@ For an overview of the provided commands, here's the usage screen:
|
|||||||
Usage: ./jaildk <command> <command-args>
|
Usage: ./jaildk <command> <command-args>
|
||||||
|
|
||||||
Building Jails:
|
Building Jails:
|
||||||
base -b <name> [-w] - build a new base
|
base -b <name> [-w] [-s <script>] - build a new base
|
||||||
build <jail> -m <mode> [-b <base>] [-v <version>] - install a build chroot of a jail
|
build <jail> -m <mode> [-b <base>] [-v <version>] - install a build chroot of a jail
|
||||||
create - create a new jail from a template
|
create - create a new jail from a template
|
||||||
clone -s <src> -d <dst> [-o <v>] [-n <v>] - clone an existing jail or jail version
|
clone -s <src> -d <dst> [-o <v>] [-n <v>] - clone an existing jail or jail version
|
||||||
|
|||||||
107
src/jaildk.sh
107
src/jaildk.sh
@@ -831,6 +831,8 @@ Build a base directory from bsd install media. Options:
|
|||||||
build stuff. Use this if you want to use the ports
|
build stuff. Use this if you want to use the ports
|
||||||
collection.
|
collection.
|
||||||
-f force mode, remove any old dist files.
|
-f force mode, remove any old dist files.
|
||||||
|
-s <script> install additional scripts to /usr/bin, separate multiple
|
||||||
|
scripts with whitespace.
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -840,11 +842,13 @@ jaildk_base() {
|
|||||||
base=""
|
base=""
|
||||||
force=""
|
force=""
|
||||||
rw=""
|
rw=""
|
||||||
|
scripts=""
|
||||||
|
|
||||||
OPTIND=1; while getopts "b:wf" arg; do
|
OPTIND=1; while getopts "b:wfs:" arg; do
|
||||||
case $arg in
|
case $arg in
|
||||||
w) rw=1;;
|
w) rw=1;;
|
||||||
b) base=${OPTARG};;
|
b) base=${OPTARG};;
|
||||||
|
s) scripts="${OPTARG}";;
|
||||||
f) force=1;;
|
f) force=1;;
|
||||||
*) usage_base;;
|
*) usage_base;;
|
||||||
esac
|
esac
|
||||||
@@ -927,61 +931,66 @@ var/tmp"
|
|||||||
if test -d "$basedir"; then
|
if test -d "$basedir"; then
|
||||||
echo "base $basedir already exist!"
|
echo "base $basedir already exist!"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
fi
|
||||||
ex mkdir -p $basedir
|
|
||||||
|
|
||||||
if test -e /usr/freebsd-dist/MANIFEST; then
|
ex mkdir -p $basedir
|
||||||
clean=''
|
|
||||||
if test -n "$force"; then
|
|
||||||
clean=1
|
|
||||||
else
|
|
||||||
echo "Found old dist files:"
|
|
||||||
ls -l /usr/freebsd-dist
|
|
||||||
echo -n "Want to remove them [nY]? "
|
|
||||||
read yesno
|
|
||||||
case $yesno in
|
|
||||||
y|Y) clean=1;;
|
|
||||||
*) clean='';;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$clean"; then
|
if test -e /usr/freebsd-dist/MANIFEST; then
|
||||||
ex rm -f /usr/freebsd-dist/*
|
clean=''
|
||||||
fi
|
if test -n "$force"; then
|
||||||
fi
|
clean=1
|
||||||
|
|
||||||
bsdinstall jail $basedir || exit 1
|
|
||||||
|
|
||||||
if test -z "$rw"; then
|
|
||||||
# run base
|
|
||||||
for file in $removelist; do
|
|
||||||
ex rm -rf $basedir/$file
|
|
||||||
done
|
|
||||||
else
|
else
|
||||||
# build base with ports support
|
echo "Found old dist files:"
|
||||||
ex mkdir -p $basedir/usr/ports
|
ls -l /usr/freebsd-dist
|
||||||
fi
|
echo -n "Want to remove them [nY]? "
|
||||||
|
|
||||||
ex mkdir $basedir/home
|
|
||||||
ex rm -rf $basedir/var/db
|
|
||||||
ex ln -s /usr/local/db $basedir/var/db
|
|
||||||
|
|
||||||
# add some symlinks from /var to /tmp to make pkg work properly
|
|
||||||
ex rm -rf $basedir/var/tmp $basedir/var/cache $basedir/var/run
|
|
||||||
ex ln -s /tmp $basedir/var/tmp
|
|
||||||
ex ln -s /tmp $basedir/var/cache
|
|
||||||
ex ln -s /tmp $basedir/var/run
|
|
||||||
|
|
||||||
if test -n "$rw"; then
|
|
||||||
echo "You have choosen to create a build base with ports support"
|
|
||||||
echo -n "Want to fetch the ports collection now [Yn]? "
|
|
||||||
read yesno
|
read yesno
|
||||||
case $yesno in
|
case $yesno in
|
||||||
y|Y|yes|YES)
|
y|Y) clean=1;;
|
||||||
jaildk_fetchports
|
*) clean='';;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -n "$clean"; then
|
||||||
|
ex rm -f /usr/freebsd-dist/*
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
bsdinstall jail $basedir || exit 1
|
||||||
|
|
||||||
|
if test -z "$rw"; then
|
||||||
|
# run base
|
||||||
|
for file in $removelist; do
|
||||||
|
ex rm -rf $basedir/$file
|
||||||
|
done
|
||||||
|
else
|
||||||
|
# build base with ports support
|
||||||
|
ex mkdir -p $basedir/usr/ports
|
||||||
|
fi
|
||||||
|
|
||||||
|
ex mkdir $basedir/home
|
||||||
|
ex rm -rf $basedir/var/db
|
||||||
|
ex ln -s /usr/local/db $basedir/var/db
|
||||||
|
|
||||||
|
# add some symlinks from /var to /tmp to make pkg work properly
|
||||||
|
ex rm -rf $basedir/var/tmp $basedir/var/cache $basedir/var/run
|
||||||
|
ex ln -s /tmp $basedir/var/tmp
|
||||||
|
ex ln -s /tmp $basedir/var/cache
|
||||||
|
ex ln -s /tmp $basedir/var/run
|
||||||
|
|
||||||
|
# any scripts?
|
||||||
|
for script in $scripts; do
|
||||||
|
ex install -m 755 $script -o root -g wheel $basedir/usr/bin/$script
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -n "$rw"; then
|
||||||
|
echo "You have choosen to create a build base with ports support"
|
||||||
|
echo -n "Want to fetch the ports collection now [Yn]? "
|
||||||
|
read yesno
|
||||||
|
case $yesno in
|
||||||
|
y|Y|yes|YES)
|
||||||
|
jaildk_fetchports
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user