Merge branch 'restructure-use-overide' into restructure-as-describe-in-doc

This commit is contained in:
6543 2018-05-22 01:08:33 +02:00
commit 631d78798d
5 changed files with 83 additions and 113 deletions

View File

@ -13,7 +13,7 @@ project_relation="debian"


#tools_add [chroot_dir] [tools_list]
function tools_add() {
function tools_add-debian() {
echo "add tools ... "
#$1 = chroot directory
chroot_dir="$1"
@ -24,9 +24,10 @@ function tools_add() {
chroot "$chroot_dir" /bin/bash -c "apt-get install -y $tools_list" | grep -v "wird eingerichtet ..." | grep -v "Vormals nicht ausgewähltes Paket" | grep -v "Entpacken von" | grep -v "Holen: " | grep -v "Trigger für" | grep -v "update-alternatives:"
echo "done"
}
function tools_add() { tools_add-debian $@; }

#os_update [chroot_dir]
function os_update() {
function os_update-debian() {
echo "updating os ... "
#$1 = chroot directory

@ -39,9 +40,10 @@ function os_update() {

echo "done"
}
function os_update() { os_update-debian $@; }

#proxy_enable [chroot_dir] [proxy_host] [proxy_port]
function proxy_enable() {
function proxy_enable-debian() {
echo -n "enable proxy ... "

chroot_dir="$1"
@ -77,9 +79,10 @@ function proxy_enable() {
fi
fi
}
function proxy_enable() { proxy_enable-debian $@; }

#dns_set [chroot_dir] [domain] [nameserver]
function dns_set() {
function dns_set-debian() {
echo -n "set dns config ... "

rm "$chroot_dir/etc/resolv.conf"
@ -92,3 +95,4 @@ function dns_set() {

echo "done"
}
function dns_set() { dns_set-debian $@; }

View File

@ -9,8 +9,8 @@ project_relation="desinfect.15 $project_relation"



#iso_create_desinfect2015 [chroot_path] [iso_extr_dir] [iso_aim] [iso_lable]
function iso_create_desinfect2015() {
#iso_create-desinfect.15 [chroot_path] [iso_extr_dir] [iso_aim] [iso_lable]
function iso_create-desinfect.15() {
echo "prepere iso folder ... "

chroot_path="$1"
@ -24,14 +24,15 @@ function iso_create_desinfect2015() {

echo "done"

iso_create "$chroot_path" "$iso_extr_dir" "$iso_aim" "$iso_lable"
iso_create-debian "$chroot_path" "$iso_extr_dir" "$iso_aim" "$iso_lable"
}
function iso_create() { iso_create-desinfect.15 $@; }

#chroot_initial_desinfect2015 [chroot_dir]
function chroot_initial_desinfect2015() {
#chroot_initial-desinfect.15 [chroot_dir]
function chroot_initial-desinfect.15() {
#$1 = chroot dir

chroot_initial "$1"
chroot_initial-debian "$1"

echo -n "initial desinfect on chroot ... "

@ -49,11 +50,12 @@ function chroot_initial_desinfect2015() {

echo "done"
}
function iso_create() { iso_create-desinfect.15 $@; }

#chroot_umount_desinfect2015 [chroot_dir]
function chroot_umount_desinfect2015() {
#chroot_umount-desinfect.15 [chroot_dir]
function chroot_umount-desinfect.15() {
#call main mount
chroot_umount "$1"
chroot_umount-debian "$1"

echo -n "unmount desinfect on chroot ... "
#check chroot dir
@ -74,11 +76,12 @@ function chroot_umount_desinfect2015() {

echo "done"
}
function chroot_umount() { chroot_umount-desinfect.15 $@; }

#proxy_enable_desinfect2015 [chroot_dir] [proxy_host] [proxy_port]
function proxy_enable_desinfect2015() {
#proxy_enable-desinfect.15 [chroot_dir] [proxy_host] [proxy_port]
function proxy_enable-desinfect.15() {

proxy_enable $1 $2 $3
proxy_enable-debian $1 $2 $3

echo -n "enable proxy for desinfect's av ... "

@ -105,6 +108,7 @@ function proxy_enable_desinfect2015() {

echo "done"
}
function proxy_enable() { proxy_enable-desinfect.15 $@; }

#sourcelist_desinfect_set_nomal2015 [chroot_dir]
function sourcelist_desinfect_set_nomal2015() {
@ -173,14 +177,14 @@ function sourcelist_desinfect_set_extendet2015() {
echo "done"
}

#os_update_desinfect2015 [chroot_dir]
function os_update_desinfect2015() {
#os_update-desinfect.15 [chroot_dir]
function os_update-desinfect.15() {
#$1 = chroot directory

chroot_dir="$1"

#call main os_update
os_update "$chroot_dir"
os_update-debian "$chroot_dir"

echo "update virus definitions ... "

@ -208,14 +212,16 @@ function os_update_desinfect2015() {

echo "done"
}
function os_update() { os_update-desinfect.15 $@; }

#tools_add_desinfect2015 [chroot_dir] [tools_list]
function tools_add_desinfect2015() {
#tools_add-desinfect.15 [chroot_dir] [tools_list]
function tools_add-desinfect.15() {
#$1 = chroot directory
chroot_dir="$1"
tools_list="$2"

sourcelist_desinfect_set_extendet2015 "$chroot_dir"
tools_add "$chroot_dir" "$tools_list"
tools_add-debian "$chroot_dir" "$tools_list"
sourcelist_desinfect_set_nomal2015 "$chroot_dir"
}
function tools_add() { tools_add-desinfect.15 $@; }

View File

@ -8,30 +8,11 @@ source <LIBDIR>/proj/ubuntu.14.04
project_relation="desinfect.16 $project_relation"



#iso_create_desinfect2016 [chroot_path] [iso_extr_dir] [iso_aim] [iso_lable]
function iso_create_desinfect2016() {
#echo "prepere iso folder ... "

chroot_path="$1"
iso_extr_dir="$2"
iso_aim="$3"
iso_lable="$4"

#desinfect
#rm "$iso_extr_dir/casper/initrd.lz"
#wget http://www.heise.de/ct/projekte/desinfect/des15/initrd.lz -O "$iso_extr_dir/casper/initrd.lz"

#echo "done"

iso_create "$chroot_path" "$iso_extr_dir" "$iso_aim" "$iso_lable"
}

#chroot_initial_desinfect2016 [chroot_dir]
function chroot_initial_desinfect2016() {
#chroot_initial-desinfect.16 [chroot_dir]
function chroot_initial-desinfect.16() {
#$1 = chroot dir

chroot_initial "$1"
chroot_initial-debian "$1"

echo -n "initial desinfect on chroot ... "

@ -47,11 +28,12 @@ function chroot_initial_desinfect2016() {

echo "done"
}
function chroot_initial() { chroot_initial-desinfect.16 $@; }

#chroot_umount_desinfect2016 [chroot_dir]
function chroot_umount_desinfect2016() {
#chroot_umount-desinfect.16 [chroot_dir]
function chroot_umount-desinfect.16() {
#call main mount
chroot_umount "$1"
chroot_umount-debian "$1"

echo -n "unmount desinfect on chroot ... "
#check chroot dir
@ -69,11 +51,12 @@ function chroot_umount_desinfect2016() {

echo "done"
}
function chroot_umount() { chroot_umount-desinfect.16 $@; }

#proxy_enable_desinfect2016 [chroot_dir] [proxy_host] [proxy_port]
function proxy_enable_desinfect2016() {
#proxy_enable-desinfect.16 [chroot_dir] [proxy_host] [proxy_port]
function proxy_enable-desinfect.16() {

proxy_enable $1 $2 $3
proxy_enable-debian $1 $2 $3

echo -n "enable proxy for desinfect's av ... "

@ -112,6 +95,7 @@ function proxy_enable_desinfect2016() {

echo "done"
}
function proxy_enable() { proxy_enable-desinfect.16 $@; }

#sourcelist_desinfect_set_nomal2016 [chroot_dir]
function sourcelist_desinfect_set_nomal2016() {
@ -180,14 +164,14 @@ function sourcelist_desinfect_set_extendet2016() {
echo "done"
}

#os_update_desinfect2016 [chroot_dir]
function os_update_desinfect2016() {
#os_update-desinfect.16 [chroot_dir]
function os_update-desinfect.16() {
#$1 = chroot directory

chroot_dir="$1"

#call main os_update
os_update "$chroot_dir"
os_update-debian "$chroot_dir"

echo "update virus definitions ... "

@ -263,14 +247,16 @@ function os_update_desinfect2016() {

echo "update virus definitions done"
}
function os_update() { os_update-desinfect.16 $@; }

#tools_add_desinfect2016 [chroot_dir] [tools_list]
function tools_add_desinfect2016() {
#tools_add-desinfect.16 [chroot_dir] [tools_list]
function tools_add-desinfect.16() {
#$1 = chroot directory
chroot_dir="$1"
tools_list="$2"

sourcelist_desinfect_set_extendet2016 "$chroot_dir"
tools_add "$chroot_dir" "$tools_list"
tools_add-debian "$chroot_dir" "$tools_list"
sourcelist_desinfect_set_nomal2016 "$chroot_dir"
}
function tools_add() { tools_add-desinfect.16 $@; }

View File

@ -69,14 +69,14 @@ function sourcelist_desinfect_set_extendet2017() {
echo "done"
}

#os_update_desinfect.17 [chroot_dir]
function os_update_desinfect.17() {
#os_update-desinfect.17 [chroot_dir]
function os_update-desinfect.17() {
#$1 = chroot directory

chroot_dir="$1"

#call main os_update
os_update "$chroot_dir"
#call main os_update from debian
os_update-debian "$chroot_dir"

echo "update virus definitions ... "

@ -162,37 +162,12 @@ function os_update_desinfect.17() {

echo "update virus definitions done"
}
function os_update() { os_update-desinfect.17 $@; }

#iso_create_desinfect.17 [chroot_path] [iso_extr_dir] [iso_aim] [iso_lable]
function iso_create_desinfect.17() {
#echo "prepere iso folder ... "
#proxy_enable-desinfect.17 [chroot_dir] [proxy_host] [proxy_port]
function proxy_enable-desinfect.17() {

chroot_path="$1"
iso_extr_dir="$2"
iso_aim="$3"
iso_lable="$4"

iso_create "$chroot_path" "$iso_extr_dir" "$iso_aim" "$iso_lable"
}

#chroot_initial_desinfect.17 [chroot_dir]
function chroot_initial_desinfect.17() {
#$1 = chroot dir

chroot_initial "$1"

}

#chroot_umount_desinfect.17 [chroot_dir]
function chroot_umount_desinfect.17() {
#call main mount
chroot_umount "$1"
}

#proxy_enable_desinfect.17 [chroot_dir] [proxy_host] [proxy_port]
function proxy_enable_desinfect.17() {

proxy_enable $1 $2 $3
proxy_enable-debian $1 $2 $3

echo "enable proxy for desinfect's av ... "

@ -262,14 +237,16 @@ function proxy_enable_desinfect.17() {

echo "done"
}
function proxy_enable() { proxy_enable-desinfect.17 $@; }

#tools_add_desinfect.17 [chroot_dir] [tools_list]
function tools_add_desinfect.17() {
#tools_add-desinfect.17 [chroot_dir] [tools_list]
function tools_add-desinfect.17() {
#$1 = chroot directory
chroot_dir="$1"
tools_list="$2"

sourcelist_desinfect_set_extendet2017 "$chroot_dir"
tools_add "$chroot_dir" "$tools_list"
tools_add-debian "$chroot_dir" "$tools_list"
sourcelist_desinfect_set_nomal2017 "$chroot_dir"
}
function tools_add() { tools_add-desinfect.17 $@; }

View File

@ -111,8 +111,6 @@ function main_renew() {

check_update >> "$log_file"

[ "$project" != "" ] && project="_$project"

# 2. Entpacke ISO
iso_extract "$iso_source" "$iso_extr_dir" >> "$log_file"

@ -128,12 +126,12 @@ function main_renew() {

# 4. Vorbereiten für chroot-Umgebung:

chroot_initial$project "$chroot_path" >> "$log_file"
chroot_initial "$chroot_path" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

# 5. Setzen der Netzwerk-Einstellungen:
[ -n "$proxy_host" ] && {
proxy_enable$project "$chroot_path" "$proxy_host" "$proxy_port" >> "$log_file"
proxy_enable "$chroot_path" "$proxy_host" "$proxy_port" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
}

@ -141,12 +139,12 @@ function main_renew() {
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

# 6. Updaten von Desinfec't:
os_update$project "$chroot_path" >> "$log_file"
os_update "$chroot_path" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

# 7. Installation optionaler Tools:

tools_add$project "$chroot_path" "$tools_list" >> "$log_file"
tools_add "$chroot_path" "$tools_list" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

#addo ClamAV to conky_info
@ -169,7 +167,7 @@ function main_renew() {

# 9. Umount - Chroot Umgebung auflösen

chroot_umount$project "$chroot_path" >> "$log_file"
chroot_umount "$chroot_path" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

#Überprüfen ob alles ausgehängt wurde
@ -187,7 +185,7 @@ function main_renew() {

# wenn iso gewünscht
[ "$iso_aim" != "" ] && {
iso_create$project "$chroot_path" "$iso_extr_dir" "$iso_aim" "$iso_lable" >> "$log_file"
iso_create "$chroot_path" "$iso_extr_dir" "$iso_aim" "$iso_lable" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
}

@ -266,8 +264,6 @@ function main_update_pxe() {
check_config >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

[ "$project" != "" ] && project="_$project"

# 1. Entpacken der Dateien des Live-Systems
[ -e "$squashfs_path" ] || {
echo "### ERROR ### \"$squashfs_path\" does not exist!" >> "$log_file"
@ -279,7 +275,7 @@ function main_update_pxe() {

# 2. Vorbereiten für chroot-Umgebung:

chroot_initial$project "$chroot_path" >> "$log_file"
chroot_initial "$chroot_path" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

# 3. Setzen der Netzwerk-Einstellungen:
@ -288,7 +284,7 @@ function main_update_pxe() {
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

# 4. Updaten von Desinfec't:
os_update$project "$chroot_path" >> "$log_file"
os_update "$chroot_path" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

# 5. Manuelle Aktionen - deaktiviert
@ -301,7 +297,7 @@ function main_update_pxe() {

# 6. Umount - Chroot Umgebung auflösen

chroot_umount$project "$chroot_path" >> "$log_file"
chroot_umount "$chroot_path" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

#Überprüfen ob alles ausgehängt wurde
@ -391,8 +387,6 @@ function main_update_iso() {
check_config >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

[ "$project" != "" ] && project="_$project"

# 2. Entpacke ISO
iso_extract "$iso_source" "$iso_extr_dir" >> "$log_file"

@ -418,12 +412,12 @@ function main_update_iso() {

# 4. Vorbereiten für chroot-Umgebung:

chroot_initial$project "$chroot_path" >> "$log_file"
chroot_initial "$chroot_path" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

# 5. Setzen der Netzwerk-Einstellungen:
[ -n "$proxy_host" ] && {
proxy_enable$project "$chroot_path" "$proxy_host" "$proxy_port" >> "$log_file"
proxy_enable "$chroot_path" "$proxy_host" "$proxy_port" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
}

@ -431,12 +425,12 @@ function main_update_iso() {
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

# 6. Updaten von Desinfec't:
os_update$project "$chroot_path" >> "$log_file"
os_update "$chroot_path" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

# 7. Installation optionaler Tools:

tools_add$project "$chroot_path" "$tools_list" >> "$log_file"
tools_add "$chroot_path" "$tools_list" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

#addo ClamAV to conky_info
@ -454,7 +448,7 @@ function main_update_iso() {

# 9. Umount - Chroot Umgebung auflösen

chroot_umount$project "$chroot_path" >> "$log_file"
chroot_umount "$chroot_path" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

#Überprüfen ob alles ausgehängt wurde
@ -472,7 +466,7 @@ function main_update_iso() {

# wenn iso gewünscht
[ "$iso_aim" != "" ] && {
iso_create$project "$chroot_path" "$iso_extr_dir" "$iso_aim" "$iso_lable" >> "$log_file"
iso_create "$chroot_path" "$iso_extr_dir" "$iso_aim" "$iso_lable" >> "$log_file"
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
}

@ -566,7 +560,10 @@ source <LIBDIR>/func/chroot_is_mounted
#chroot_sh [chroot_dir] [command]
source <LIBDIR>/func/chroot_sh

####################################
### Workaround - set Project
source <LIBDIR>/proj/desinfect.17
####################################

### Handle Parameters & Modes ###