Compare commits

...

13 Commits

Author SHA1 Message Date
6543 2ffe939f5c Merge branch 'develop' into feature-lxc
lxc version aktuall.
2018-06-02 22:16:16 +02:00
6543 268e327351 mod proj template 2018-05-22 02:12:28 +02:00
6543 f5a2ddb0c4 apply changes to main script too 2018-05-22 02:10:45 +02:00
6543 27b9155cd9 apply all new changes 2018-05-22 02:07:01 +02:00
6543 226c2567d9
Merge pull request #23 from 6543/develop
update feature branch
2018-05-20 23:51:20 +02:00
6543 fb524720f4
Merge pull request #19 from 6543/develop
update feature-fxc branch
2018-05-17 01:13:02 +02:00
6543 adc9f4f7b5 Merge branch 'fix-standalone_executable' into feature-lxc
fix-standalone_executable
2018-05-11 00:06:48 +02:00
6543 edfeec5868 Merge branch 'hotfix-1.9.3' into feature-lxc
hotfix-1.9.3
2018-05-10 22:48:08 +02:00
6543 a5de57abb7 Merge branch 'bugfix-1.9.2' into feature-lxc
docu
2018-05-10 18:52:04 +02:00
6543 127d682cfb bugfix-1.9.2++ 2018-05-10 17:27:36 +02:00
6543 d4b7654769 Merge branch 'bugfix-1.9.2' into feature-lxc
finished bugfix-1.9.2
2018-05-10 17:15:04 +02:00
6543 a45c267641 use lxc 2018-05-10 15:12:36 +02:00
6543 76fc7b342f merge diff 2018-05-10 15:12:06 +02:00
7 changed files with 73 additions and 11 deletions

View File

@ -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

32
src/func/chroot Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
#remaster lib
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }

## 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"
}

[ -n "$1" ] && {
echo param
$1
}

View File

@ -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"

View File

@ -7,12 +7,15 @@
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
}


View File

@ -10,6 +10,9 @@ function workspace_erase() {
[ -d "$dir" ] && rm -r -f "$dir"
done

#lxc
[ -d /var/lib/lxc/_remaster_/ ] && rm -R /var/lib/lxc/_remaster_/

echo "done"
}


View File

@ -261,3 +261,22 @@ function project_mods-desinfect.17() {
}
}
function project_mods() { project_mods-desinfect.17 $@; }

function chroot_initial-desinfect2017() {
#$1 = chroot dir

<LIBDIR>/func/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
}
function chroot_initial() { chroot_initial-desinfect.17 $@; }

View File

@ -96,6 +96,9 @@ source <LIBDIR>/func/iso_create

### chroot ###

## overload chroot with lxc
source <LIBDIR>/func/chroot

#chroot_initial [chroot_dir]
source <LIBDIR>/func/chroot_initial