2018-04-30 16:57:01 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#remaster lib
|
2018-05-07 00:56:46 +00:00
|
|
|
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
|
2018-04-30 16:57:01 +00:00
|
|
|
|
|
|
|
#chroot_initial [chroot_dir]
|
|
|
|
function chroot_initial() {
|
|
|
|
echo -n "initial chroot ... "
|
|
|
|
|
|
|
|
#check chroot dir
|
|
|
|
chroot_dir="$1"
|
|
|
|
[ -d "$chroot_dir" ] || {
|
|
|
|
echo "### ERROR ### chroot_initial: chroot directory not exist"
|
|
|
|
return 12
|
|
|
|
}
|
|
|
|
|
2018-05-10 13:12:06 +00:00
|
|
|
[ -d "/var/lib/lxc/_remaster_/" ] && {
|
|
|
|
echo "### Warning ### chroot_initial: lxc container exists"
|
|
|
|
[ -f "/var/lib/lxc/_remaster_/config" ] && {
|
|
|
|
mv -f "/var/lib/lxc/_remaster_/config" "/var/lib/lxc/_remaster_/config.old"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mkdir -p "/var/lib/lxc/_remaster_/"
|
2018-04-30 16:57:01 +00:00
|
|
|
|
|
|
|
rm "$chroot_dir/etc/resolv.conf"
|
|
|
|
cp "/etc/resolv.conf" "$chroot_dir/etc/resolv.conf"
|
|
|
|
|
|
|
|
echo "done"
|
|
|
|
}
|
2018-05-10 15:13:19 +00:00
|
|
|
|
2018-05-10 22:04:02 +00:00
|
|
|
#this func is standalone executable
|
2018-05-10 15:13:19 +00:00
|
|
|
[ -n "$1" ] && {
|
2018-05-10 22:04:02 +00:00
|
|
|
chroot_initial $@
|
2018-05-10 15:13:19 +00:00
|
|
|
}
|