merge diff
This commit is contained in:
parent
49901e1f32
commit
76fc7b342f
@ -5,7 +5,7 @@
|
||||
#check_dependency
|
||||
# -> 0 | -> 16
|
||||
function check_dependency() {
|
||||
for packet in squashfs-tools xorriso wget sed sendemail; do
|
||||
for packet in squashfs-tools xorriso lxc wget sed sendemail; do
|
||||
[ "`dpkg -l $packet 2>&1`" == "dpkg-query: Kein Paket gefunden, das auf $packet passt" ] && {
|
||||
echo "### ERROR ### Packet $packet not installed"
|
||||
return 16
|
||||
|
23
src/func/chroot
Normal file
23
src/func/chroot
Normal file
@ -0,0 +1,23 @@
|
||||
## overload chroot with lxc
|
||||
function chroot() {
|
||||
lxc-attach -n _remaster_ -- "$2" "$3" "$4" "$5" "$6" "$7"
|
||||
}
|
||||
|
||||
## create lxc config
|
||||
|
||||
#chroot_config [chroot_dir]
|
||||
function chroot_config() {
|
||||
|
||||
chroot_dir="$1"
|
||||
|
||||
# Container specific configuration
|
||||
echo "lxc.rootfs = $chroot_dir"
|
||||
echo "lxc.rootfs.backend = dir"
|
||||
echo "lxc.utsname = _remaster_"
|
||||
|
||||
# Network configuration
|
||||
echo "lxc.network.type = veth"
|
||||
echo "lxc.network.link = lxcbr0"
|
||||
echo "lxc.network.flags = up"
|
||||
echo "lxc.network.hwaddr = 00:16:3e:5a:ba:1e"
|
||||
}
|
@ -13,11 +13,13 @@ function chroot_initial() {
|
||||
return 12
|
||||
}
|
||||
|
||||
#mount virus definitions
|
||||
mount -t tmpfs tmpfs "$chroot_dir/tmp"
|
||||
mount -t tmpfs tmpfs "$chroot_dir/root"
|
||||
mount --bind /dev "$chroot_dir/dev"
|
||||
mount --bind /proc "$chroot_dir/proc"
|
||||
[ -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_/"
|
||||
|
||||
rm "$chroot_dir/etc/resolv.conf"
|
||||
cp "/etc/resolv.conf" "$chroot_dir/etc/resolv.conf"
|
||||
|
@ -7,11 +7,14 @@
|
||||
function chroot_is_mounted() {
|
||||
#$1 = chroot directory
|
||||
|
||||
if [ "`mount | grep "$1"`" != "" ] ; then
|
||||
#ther is smething mounted
|
||||
echo "true"
|
||||
else
|
||||
#nothing mounted
|
||||
#get state of _remaster from lxc
|
||||
STATE=`lxc-ls _remaster_ -f -F STATE | tail -n 1 | sed 's/ //g'`
|
||||
|
||||
if [ "#$STATE#" == "#STOPPED#" ] ; then
|
||||
#nothing running
|
||||
echo "false"
|
||||
else
|
||||
#container is running
|
||||
echo "true"
|
||||
fi
|
||||
}
|
||||
|
@ -10,5 +10,8 @@ function workspace_erase() {
|
||||
[ -d "$dir" ] && rm -r -f "$dir"
|
||||
done
|
||||
|
||||
#lxc
|
||||
[ -d /var/lib/lxc/_remaster_/ ] && rm -R /var/lib/lxc/_remaster_/
|
||||
|
||||
echo "done"
|
||||
}
|
||||
|
@ -619,6 +619,18 @@ function chroot_initial_desinfect2017() {
|
||||
|
||||
chroot_initial "$1"
|
||||
|
||||
#LXC Start
|
||||
config="/var/lib/lxc/_remaster_/config"
|
||||
|
||||
#special conf for distros:
|
||||
echo "lxc.include = /usr/share/lxc/config/nesting.conf" > $config
|
||||
echo "lxc.include = /usr/share/lxc/config/ubuntu.common.conf" >> $config
|
||||
echo "lxc.arch = x86_64" >> $config
|
||||
|
||||
#normal config
|
||||
chroot_config "$chroot_dir" >> $config
|
||||
#LXC End
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
1680
src/remaster_lxc.sh
Normal file
1680
src/remaster_lxc.sh
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user