From 55a17ad2cec013e73b7438412cc1276520250187 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 17 May 2018 01:04:21 +0200 Subject: [PATCH 01/24] beautysh --- src/func/on_exit | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/func/on_exit b/src/func/on_exit index 0801b75..9a33c01 100755 --- a/src/func/on_exit +++ b/src/func/on_exit @@ -4,28 +4,28 @@ #on_exit [error_level] function on_exit() { - #send log and errorlevel[success/errorr xy] + #send log and errorlevel[success/errorr xy] - if [ "$1" != "0" ]; then - log_mail_subject="$log_mail_subject [ERROR]" - else - log_mail_subject="$log_mail_subject [Success]" - fi + if [ "$1" != "0" ]; then + log_mail_subject="$log_mail_subject [ERROR]" + else + log_mail_subject="$log_mail_subject [Success]" + fi - #Mail Body: - for mail_aim in `echo "$log_mail_aim" | tr "," " "`; do - { - echo "$log_mail_subject" - echo $'####################################################################################\n\n' - cat "$log_file" - } | sendemail -s "$log_mail_smtp" -f "$log_mail_source" -t "$mail_aim" -u "$log_mail_subject" -o tls=no - done + #Mail Body: + for mail_aim in `echo "$log_mail_aim" | tr "," " "`; do + { + echo "$log_mail_subject" + echo $'####################################################################################\n\n' + cat "$log_file" + } | sendemail -s "$log_mail_smtp" -f "$log_mail_source" -t "$mail_aim" -u "$log_mail_subject" -o tls=no + done - [ "$1" != "0" ] && { - chroot_umount$distro "$chroot_path" 2> /dev/null - workspace_erase "$iso_extr_dir/" "$chroot_path/" 2> /dev/null - } - exit $1 + [ "$1" != "0" ] && { + chroot_umount$distro "$chroot_path" 2> /dev/null + workspace_erase "$iso_extr_dir/" "$chroot_path/" 2> /dev/null + } + exit $1 } #this func is standalone executable From ca02c443d39beaa97310d8a36cc0a186b824a1d8 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 17 May 2018 01:05:56 +0200 Subject: [PATCH 02/24] make mail optional --- src/func/on_exit | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/func/on_exit b/src/func/on_exit index 9a33c01..59774f1 100755 --- a/src/func/on_exit +++ b/src/func/on_exit @@ -4,23 +4,26 @@ #on_exit [error_level] function on_exit() { - #send log and errorlevel[success/errorr xy] + ### send mail + [ -n "$log_mail_aim" ] && { + #send log and errorlevel[success/errorr xy] + if [ "$1" != "0" ]; then + log_mail_subject="$log_mail_subject [ERROR]" + else + log_mail_subject="$log_mail_subject [Success]" + fi - if [ "$1" != "0" ]; then - log_mail_subject="$log_mail_subject [ERROR]" - else - log_mail_subject="$log_mail_subject [Success]" - fi - - #Mail Body: - for mail_aim in `echo "$log_mail_aim" | tr "," " "`; do - { - echo "$log_mail_subject" - echo $'####################################################################################\n\n' - cat "$log_file" - } | sendemail -s "$log_mail_smtp" -f "$log_mail_source" -t "$mail_aim" -u "$log_mail_subject" -o tls=no - done + #Mail Body: + for mail_aim in `echo "$log_mail_aim" | tr "," " "`; do + { + echo "$log_mail_subject" + echo $'####################################################################################\n\n' + cat "$log_file" + } | sendemail -s "$log_mail_smtp" -f "$log_mail_source" -t "$mail_aim" -u "$log_mail_subject" -o tls=no + done + } + ### clean up [ "$1" != "0" ] && { chroot_umount$distro "$chroot_path" 2> /dev/null workspace_erase "$iso_extr_dir/" "$chroot_path/" 2> /dev/null From d0c53279b5f58987a8d9b6b1256993174d69b51e Mon Sep 17 00:00:00 2001 From: 6543 Date: Sat, 19 May 2018 22:45:42 +0200 Subject: [PATCH 03/24] update Dependencys <- update feature --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 780fda9..b1c35b1 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ The aim of this Project is to create a daemon for a server, witch update live sy - wget - sed - sendemail +- curl ## To Do From 5767355c217d799313fd001e64a382f1511b8f17 Mon Sep 17 00:00:00 2001 From: 6543 Date: Sun, 20 May 2018 00:43:38 +0200 Subject: [PATCH 04/24] draft --- doc/Strukture.md | 80 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/doc/Strukture.md b/doc/Strukture.md index f209963..ad599c5 100644 --- a/doc/Strukture.md +++ b/doc/Strukture.md @@ -1,28 +1,70 @@ -# Src +1. Starte "remaster" -raw scripts .. +1.1 Lade Grundfunctionen [-> #functions] -## functions +1.2 Überprüfe ... + * auf Updates + * auf Rechte - - creat iso - - burn cd ... - - clean workspace ... +1.3 Lade Richtige Einstellungen [-> #config] + * Lade /etc/remaster/ + * Überprüfe Conf. (Proj Exist; Mods Exist; ...) +1.4 Lade Proj-Func [-> #projects] + * Überlade nach Abhängigkeit + * (z.B. ubuntu.16.04 -> ubuntu -> debian) + * Prüfe Conf. (Proj Conform) -## distros +1.5 Lade $n Mods (optional) [-> #mods] + * Überprüfen + * Spechern in MOD_LST -scripts vor distros - - update - - set network settings - - set OS settings +2. Init Chroot -## mods - - for example: install & enable xrdp - - set default passwd - - ... +2.1 Dateien Entpacken + * ISO + * Squashfs -## web -placeholder for webfiles ... +2.2 Config für Chroot (chroot_initial) + * (lxc-conf / tmpdir) + * Netzwerk -## pxe -placeholder for pxefiles ... +2.3 Starte Chroot + * (lxc-start / mount ...) + +3. Modivikationen + +3.1 Netzwerk + +3.2 Proj-Spez. + * (z.B. Desinfect: conky_info) + +3.3 Packet Mgr + * Updates + * Install + * Delete + +3.4 Weitere in $MOD_LST + * z.B. xrdp + * z.B. default pw + +4. Finish + +4.1 Aufreumen Live-Sys + * tmpfiles + * Packet Mgr + +4.2 Stop chroot + * Umount + +4.3. Gen ISO/PXE + +4.4. Del Chroot + +5. Send Log + +---- + +lxc +-> chroot_sh exec lxc-attach +-> chroot_dir = container name From 897ddfd3a613ba7ab4c9448c033ed83fbcaff351 Mon Sep 17 00:00:00 2001 From: 6543 Date: Sun, 20 May 2018 01:13:03 +0200 Subject: [PATCH 05/24] format --- doc/Strukture.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/doc/Strukture.md b/doc/Strukture.md index ad599c5..bd90ec3 100644 --- a/doc/Strukture.md +++ b/doc/Strukture.md @@ -1,67 +1,67 @@ -1. Starte "remaster" +# 1. Starte "remaster" -1.1 Lade Grundfunctionen [-> #functions] +## 1.1 Lade Grundfunctionen [-> #functions] -1.2 Überprüfe ... +## 1.2 Überprüfe ... * auf Updates * auf Rechte -1.3 Lade Richtige Einstellungen [-> #config] +## 1.3 Lade Richtige Einstellungen [-> #config] * Lade /etc/remaster/ * Überprüfe Conf. (Proj Exist; Mods Exist; ...) -1.4 Lade Proj-Func [-> #projects] +## 1.4 Lade Proj-Func [-> #projects] * Überlade nach Abhängigkeit * (z.B. ubuntu.16.04 -> ubuntu -> debian) * Prüfe Conf. (Proj Conform) -1.5 Lade $n Mods (optional) [-> #mods] +## 1.5 Lade $n Mods (optional) [-> #mods] * Überprüfen * Spechern in MOD_LST -2. Init Chroot +# 2. Init Chroot -2.1 Dateien Entpacken +## 2.1 Dateien Entpacken * ISO * Squashfs -2.2 Config für Chroot (chroot_initial) +## 2.2 Config für Chroot (chroot_initial) * (lxc-conf / tmpdir) * Netzwerk -2.3 Starte Chroot +## 2.3 Starte Chroot * (lxc-start / mount ...) -3. Modivikationen +# 3. Modivikationen -3.1 Netzwerk +## 3.1 Netzwerk -3.2 Proj-Spez. +## 3.2 Proj-Spez. * (z.B. Desinfect: conky_info) -3.3 Packet Mgr +## 3.3 Packet Mgr * Updates * Install * Delete -3.4 Weitere in $MOD_LST +## 3.4 Weitere in $MOD_LST * z.B. xrdp * z.B. default pw -4. Finish +# 4. Finish -4.1 Aufreumen Live-Sys +## 4.1 Aufreumen Live-Sys * tmpfiles * Packet Mgr -4.2 Stop chroot +## 4.2 Stop chroot * Umount -4.3. Gen ISO/PXE +## 4.3. Gen ISO/PXE -4.4. Del Chroot +## 4.4. Del Chroot -5. Send Log +# 5. Send Log ---- From ff9a384ce636589fb24156fda5b292e9e0131d34 Mon Sep 17 00:00:00 2001 From: 6543 Date: Sun, 20 May 2018 01:29:25 +0200 Subject: [PATCH 06/24] draft_v2 --- doc/Strukture.md | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/doc/Strukture.md b/doc/Strukture.md index bd90ec3..434d51f 100644 --- a/doc/Strukture.md +++ b/doc/Strukture.md @@ -65,6 +65,47 @@ ---- -lxc +## lxc + -> chroot_sh exec lxc-attach + -> chroot_dir = container name + +---- + +## PXE + +-> Install + * DHCP Relay + * NFS-Server + * TFTP-Server + * [Samba] + +-> Setup + * (use /proj/ func) + * SMB/NFS LiveSys export + * TFTP (Boot Menue; Boot Loader; Kernel&Initrd) + +-> Deinstall + * RM TFTP-Root + * RM SMB/NFS LiveSys export + * del DHCP Relay conf + +---- + +## Jobs + +---- + +## Web + +show/edit #Configs + +show (+live) #Logs + +start/stop/plan #Jobs + +start/stop/edit #PXE menue + * default + * all / single / none + * live view new clients From 6aa13ce326d79e810d589f4390b489d326b6512c Mon Sep 17 00:00:00 2001 From: 6543 Date: Sun, 20 May 2018 01:34:10 +0200 Subject: [PATCH 07/24] draft_v3 --- doc/Strukture.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/Strukture.md b/doc/Strukture.md index 434d51f..0a6e53f 100644 --- a/doc/Strukture.md +++ b/doc/Strukture.md @@ -94,6 +94,8 @@ ---- ## Jobs + * Read Confs -> get time interfall I + * Exec remaster for I ---- From d65cddc2f5a6495713b14d5710fa0785933ce7a0 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 11:59:47 +0200 Subject: [PATCH 08/24] proxy optional --- src/remaster.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/remaster.sh b/src/remaster.sh index 9fded8b..4abfee6 100755 --- a/src/remaster.sh +++ b/src/remaster.sh @@ -113,9 +113,10 @@ function main_renew() { error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" # 5. Setzen der Netzwerk-Einstellungen: - - proxy_enable$distro "$chroot_path" "$proxy_host" "$proxy_port" >> "$log_file" - error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" + [ -n "$proxy_host" ] && { + proxy_enable$distro "$chroot_path" "$proxy_host" "$proxy_port" >> "$log_file" + error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" + } dns_set "$chroot_path" "$domain" "$nameserver" >> "$log_file" error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" @@ -397,9 +398,10 @@ function main_update_iso() { error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" # 5. Setzen der Netzwerk-Einstellungen: - - proxy_enable$distro "$chroot_path" "$proxy_host" "$proxy_port" >> "$log_file" - error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" + [ -n "$proxy_host" ] && { + proxy_enable$distro "$chroot_path" "$proxy_host" "$proxy_port" >> "$log_file" + error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" + } dns_set "$chroot_path" "$domain" "$nameserver" >> "$log_file" error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" From 22c8d8081eaad2f00639eefb344a31e8ad5ec8bd Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 12:24:51 +0200 Subject: [PATCH 09/24] Load check_update func --- src/remaster.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/remaster.sh b/src/remaster.sh index 9fded8b..449fc61 100755 --- a/src/remaster.sh +++ b/src/remaster.sh @@ -490,6 +490,8 @@ source /func/check_user # -> 0 | -> 16 source /func/check_dependency +#check_update +source /func/check_update ### Workspace ### From fb4afed081f92630905076b79f8a9d53c279e1ad Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 20:32:55 +0200 Subject: [PATCH 10/24] subvers --- DEBIAN/control | 2 +- changes/remaster.md | 4 ++++ script/get_version.sh | 3 +++ script/set_version.sh | 6 +++--- src/remaster.sh | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) create mode 100755 script/get_version.sh diff --git a/DEBIAN/control b/DEBIAN/control index e35de60..546040e 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,6 +1,6 @@ Package: remaster Source: remaster -Version: 2.0.2 +Version: 2.0.2-2 Architecture: all Maintainer: 6543 <6543@obermui.de> Installed-Size: diff --git a/changes/remaster.md b/changes/remaster.md index eb79d3f..d910dfe 100644 --- a/changes/remaster.md +++ b/changes/remaster.md @@ -18,3 +18,7 @@ 2018-05-13 - 2.0.2 * hotfix-2.0.2 ( create release folder if not exist ) + +2018-05-20 - 2.0.2-2 + * make email, proxy optional + * change Strukture.md diff --git a/script/get_version.sh b/script/get_version.sh new file mode 100755 index 0000000..e58d5ec --- /dev/null +++ b/script/get_version.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +grep '@version ' src/remaster.sh | cut -d " " -f 2 diff --git a/script/set_version.sh b/script/set_version.sh index d170fe9..e012b21 100755 --- a/script/set_version.sh +++ b/script/set_version.sh @@ -8,10 +8,10 @@ date=`date +%Y-%m-%d` version_sed=`echo $version | sed 's/\./\\./g'` #nummer - sed -i "s/@version\ .\..\../@version\ $version_sed/g" src/remaster.sh + sed -i "/#@version\ /c\#@version\ $version_sed" src/remaster.sh #datum - sed -i "s/@date\ ....-..-../@date\ $date/g" src/remaster.sh + sed -i "/#@date\ /c\#@date\ $date" src/remaster.sh } [ -e "changes/remaster.md" ] && { @@ -22,5 +22,5 @@ date=`date +%Y-%m-%d` } [ -f "DEBIAN/control" ] && { - sed -i "s/Version:\ .\..\../Version:\ $version_sed/g" "DEBIAN/control" + sed -i "/Version:\ /c\Version:\ $version_sed" "DEBIAN/control" } diff --git a/src/remaster.sh b/src/remaster.sh index 5a740d3..8874202 100755 --- a/src/remaster.sh +++ b/src/remaster.sh @@ -1,7 +1,7 @@ #!/bin/bash -#@version 2.0.2 +#@version 2.0.2-2 #@autor 6543@obermui.de -#@date 2018-05-13 +#@date 2018-05-20 #@licence GNUv3 ##################################################################################### From 3510f44ef8dad9e643b307a922b5d7c9515f9a73 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 20:50:06 +0200 Subject: [PATCH 11/24] appropriate name --- doc/{lib-header.txt => lib-head+tail} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/{lib-header.txt => lib-head+tail} (100%) diff --git a/doc/lib-header.txt b/doc/lib-head+tail similarity index 100% rename from doc/lib-header.txt rename to doc/lib-head+tail From 051f8636a29113521c1d223b8708d8f21122b79b Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 21:02:45 +0200 Subject: [PATCH 12/24] init check_config --- src/func/check_config | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 src/func/check_config diff --git a/src/func/check_config b/src/func/check_config new file mode 100755 index 0000000..2b68c8c --- /dev/null +++ b/src/func/check_config @@ -0,0 +1,13 @@ +#!/bin/bash +#remaster lib +[ -d "" ] || { echo "LIBDIR not exist"; exit 1; } + +# +function () { + #Code of +} + +#this func is standalone executable +[ -n "$1" ] && { + $@ +} From 89053e3ed19c816cb103f4ef701e201c8f348ad4 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 21:16:19 +0200 Subject: [PATCH 13/24] add script --- doc/lib-head+tail | 8 +++++--- script/add_function.sh | 12 ++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100755 script/add_function.sh diff --git a/doc/lib-head+tail b/doc/lib-head+tail index d3c48f7..597257f 100644 --- a/doc/lib-head+tail +++ b/doc/lib-head+tail @@ -2,10 +2,12 @@ #remaster lib [ -d "" ] || { echo "LIBDIR not exist"; exit 1; } -#beginn func - +# [param] +function () { + #Code of +} #this func is standalone executable [ -n "$1" ] && { - check_user + $@ } diff --git a/script/add_function.sh b/script/add_function.sh new file mode 100755 index 0000000..17bd495 --- /dev/null +++ b/script/add_function.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +#check param +[ -z "$1" ] && { echo "$0 [name]"; exit 1; } +name="$1" + +#gen function +cp "doc/lib-head+tail" "src/func/$name" +sed -i "s//$name/g" "src/func/$name" + +#open +editor "src/func/$name" From d11b96947c532ac2fa34bfa3f144cdfc79c6040c Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 21:53:56 +0200 Subject: [PATCH 14/24] add log check --- src/func/check_config | 27 +++++++++++++++++++++++---- src/remaster.sh | 8 +++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/func/check_config b/src/func/check_config index 2b68c8c..3a0653f 100755 --- a/src/func/check_config +++ b/src/func/check_config @@ -2,12 +2,31 @@ #remaster lib [ -d "" ] || { echo "LIBDIR not exist"; exit 1; } -# -function () { - #Code of +#check_config [param] +function check_config() { + + #LOG + [ -z "$log_file" ] && log_file="/tmp/remaster_`date '+%Y-%m-%d'`" + + if [ -f "$log_file" ]; then + echo > "$log_file" + else + #check if folder exist + [ -d "${log_file%/*}" ] || { + # N-> exit 3 + echo "Directory for Log didnt exist" + exit 3 + } + #create LOG + touch "$log_file" + fi + + + + } #this func is standalone executable [ -n "$1" ] && { - $@ + check_config $@ } diff --git a/src/remaster.sh b/src/remaster.sh index 8874202..dd6202f 100755 --- a/src/remaster.sh +++ b/src/remaster.sh @@ -32,8 +32,7 @@ fi #remaster.sh renew function main_renew() { - - [ -f "$log_file" ] || touch "$log_file" + check_config tail -f "$log_file" --pid="$$" & chroot_path="`mktemp -d`" @@ -195,8 +194,7 @@ function main_renew() { #remaster.sh update_pxe function main_update_pxe() { - [ "$log_file" == "" ] && log_file="`mktemp`" - [ -f "$log_file" ] || touch "$log_file" + check_config tail -f "$log_file" --pid="$$" & chroot_path="`mktemp -d`" @@ -308,7 +306,7 @@ function main_update_pxe() { #remaster.sh update_iso #in arbeit function main_update_iso() { - [ -f "$log_file" ] || touch "$log_file" + check_config tail -f "$log_file" --pid="$$" & chroot_path="`mktemp -d`" From 74b3a8b12bca42b48edb4c4a11e6e694628d6e92 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 22:43:33 +0200 Subject: [PATCH 15/24] log check at init --- src/func/check_config | 15 ++++++++------- src/remaster.sh | 32 +++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/func/check_config b/src/func/check_config index 3a0653f..0b1ccec 100755 --- a/src/func/check_config +++ b/src/func/check_config @@ -2,15 +2,17 @@ #remaster lib [ -d "" ] || { echo "LIBDIR not exist"; exit 1; } -#check_config [param] +#check_config [log_file] function check_config() { #LOG - [ -z "$log_file" ] && log_file="/tmp/remaster_`date '+%Y-%m-%d'`" + { + log_file=$1 + [ -z "$log_file" ] && log_file="/tmp/remaster_`date '+%Y-%m-%d'`" - if [ -f "$log_file" ]; then + if [ -f "$log_file" ]; then echo > "$log_file" - else + else #check if folder exist [ -d "${log_file%/*}" ] || { # N-> exit 3 @@ -19,9 +21,8 @@ function check_config() { } #create LOG touch "$log_file" - fi - - + fi + } } diff --git a/src/remaster.sh b/src/remaster.sh index dd6202f..be7d97c 100755 --- a/src/remaster.sh +++ b/src/remaster.sh @@ -25,6 +25,23 @@ else exit 1 fi fi +#check LOG +{ + [ -z "$log_file" ] && log_file="/tmp/remaster_`date '+%Y-%m-%d'`" + + if [ -f "$log_file" ]; then + echo > "$log_file" + else + #check if folder exist + [ -d "${log_file%/*}" ] || { + # N-> exit 3 + echo "Directory for Log didnt exist" + exit 3 + } + #create LOG + touch "$log_file" + fi +} ##################################################################################### ################## M o d e s ######################################################## @@ -32,7 +49,7 @@ fi #remaster.sh renew function main_renew() { - check_config + #Start LOG tail -f "$log_file" --pid="$$" & chroot_path="`mktemp -d`" @@ -89,6 +106,9 @@ function main_renew() { check_dependency error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" + check_config "$log_file" + error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" + check_update | tee -a "$log_file" [ "$distro" != "" ] && distro="_$distro" @@ -194,7 +214,7 @@ function main_renew() { #remaster.sh update_pxe function main_update_pxe() { - check_config + #Start LOG tail -f "$log_file" --pid="$$" & chroot_path="`mktemp -d`" @@ -243,6 +263,9 @@ function main_update_pxe() { check_dependency error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" + check_config "$log_file" + error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" + [ "$distro" != "" ] && distro="_$distro" # 1. Entpacken der Dateien des Live-Systems @@ -306,7 +329,7 @@ function main_update_pxe() { #remaster.sh update_iso #in arbeit function main_update_iso() { - check_config + #Start LOG tail -f "$log_file" --pid="$$" & chroot_path="`mktemp -d`" @@ -365,6 +388,9 @@ function main_update_iso() { check_dependency error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" + check_config "$log_file" + error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" + [ "$distro" != "" ] && distro="_$distro" # 2. Entpacke ISO From 8b782fa5e1eb7b12a56c61bf9ebf184258d85976 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 22:44:33 +0200 Subject: [PATCH 16/24] add live-system files check --- src/func/check_config | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/func/check_config b/src/func/check_config index 0b1ccec..19eddeb 100755 --- a/src/func/check_config +++ b/src/func/check_config @@ -25,6 +25,37 @@ function check_config() { } + #check live-system files + if [ -f "$iso_source" ]; then + if [ -n "$iso_destination" ] && [ -d "${iso_destination%/*}" ]; then + # iso_source -> iso_destination + # iso_source -> squashfs [optinal] + else + if [ -n "$filesystem_source" ] && [ -d "${filesystem_source%/*}" ]; then + # iso_source -> squashfs + else + # ERROR + echo "No corect AIM in Settings" | tee -a "$log_file" + return 3 + fi + fi + else + if [ -f "$filesystem_source" ]; then + if [ -n "$iso_destination" ]; then + # ERROR + echo "only Squashfs source in Settings, cant creat ISO" | tee -a "$log_file" + return 3 + else + # squashfs -> squashfs + fi + else + # ERROR + echo "No corect Source in Settings" | tee -a "$log_file" + return 3 + fi + fi + + } #this func is standalone executable From cdf2cc900e7c9e4dea0221f293a7e80beb29548d Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 22:52:20 +0200 Subject: [PATCH 17/24] add project check --- src/func/check_config | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/func/check_config b/src/func/check_config index 19eddeb..d3e33b8 100755 --- a/src/func/check_config +++ b/src/func/check_config @@ -25,6 +25,13 @@ function check_config() { } + + #Project + [ -f "/proj/$distro" ] || { + echo "No Project \"$distrp\" is not supported" | tee -a "$log_file" + return 3 + } + #check live-system files if [ -f "$iso_source" ]; then if [ -n "$iso_destination" ] && [ -d "${iso_destination%/*}" ]; then From 242421fbabcdbe1d10b602749341ea0a7d99546b Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 22:53:00 +0200 Subject: [PATCH 18/24] format... --- src/func/check_config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/func/check_config b/src/func/check_config index d3e33b8..4e413dc 100755 --- a/src/func/check_config +++ b/src/func/check_config @@ -32,7 +32,7 @@ function check_config() { return 3 } - #check live-system files + #live-system files if [ -f "$iso_source" ]; then if [ -n "$iso_destination" ] && [ -d "${iso_destination%/*}" ]; then # iso_source -> iso_destination @@ -63,6 +63,8 @@ function check_config() { fi + + } #this func is standalone executable From 6ce556ef8423acbbd63a9d9f45135bcbb5b6957b Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 22:55:54 +0200 Subject: [PATCH 19/24] add lable; smal fix --- src/func/check_config | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/func/check_config b/src/func/check_config index 4e413dc..aeb7e5f 100755 --- a/src/func/check_config +++ b/src/func/check_config @@ -28,13 +28,16 @@ function check_config() { #Project [ -f "/proj/$distro" ] || { - echo "No Project \"$distrp\" is not supported" | tee -a "$log_file" + echo "No Project \"$distro\" is not supported" | tee -a "$log_file" return 3 } #live-system files if [ -f "$iso_source" ]; then if [ -n "$iso_destination" ] && [ -d "${iso_destination%/*}" ]; then + #Lable + [ -z "$iso_lable" ] && iso_lable="$distro" + # iso_source -> iso_destination # iso_source -> squashfs [optinal] else From 310b670631fcf3071a829e1aaad7aea58b38245c Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 23:04:52 +0200 Subject: [PATCH 20/24] aktivate --- src/remaster.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/remaster.sh b/src/remaster.sh index be7d97c..17b3d2b 100755 --- a/src/remaster.sh +++ b/src/remaster.sh @@ -503,6 +503,9 @@ function main_update_iso() { ### Error Handlings ### +#check_config [log_file] +source /func/check_config + #on_exit [error_level] source /func/on_exit From 20bb090cb3f56f051c23840d2b170c79b1c78b50 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 23:12:12 +0200 Subject: [PATCH 21/24] fixes... --- src/func/check_config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/func/check_config b/src/func/check_config index aeb7e5f..8bed903 100755 --- a/src/func/check_config +++ b/src/func/check_config @@ -38,11 +38,11 @@ function check_config() { #Lable [ -z "$iso_lable" ] && iso_lable="$distro" - # iso_source -> iso_destination - # iso_source -> squashfs [optinal] + echo 'iso_source -> iso_destination' | tee -a "$log_file" + echo 'iso_source -> squashfs [optinal]' | tee -a "$log_file" else if [ -n "$filesystem_source" ] && [ -d "${filesystem_source%/*}" ]; then - # iso_source -> squashfs + echo 'iso_source -> squashfs' | tee -a "$log_file" else # ERROR echo "No corect AIM in Settings" | tee -a "$log_file" @@ -56,7 +56,7 @@ function check_config() { echo "only Squashfs source in Settings, cant creat ISO" | tee -a "$log_file" return 3 else - # squashfs -> squashfs + echo 'squashfs -> squashfs' | tee -a "$log_file" fi else # ERROR From cee345cd257f26725fe9312479e141ab368c7600 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 23:16:24 +0200 Subject: [PATCH 22/24] fix until name change --- src/proj/desinfect2017 | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/proj/desinfect2017 diff --git a/src/proj/desinfect2017 b/src/proj/desinfect2017 new file mode 100644 index 0000000..e69de29 From c0ddfe7c1c2e892fe69cd69822ef493881413b01 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 23:29:33 +0200 Subject: [PATCH 23/24] v 2.0.3 --- DEBIAN/control | 2 +- changes/remaster.md | 4 +++- src/remaster.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index 546040e..132f7d0 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,6 +1,6 @@ Package: remaster Source: remaster -Version: 2.0.2-2 +Version: 2.0.3 Architecture: all Maintainer: 6543 <6543@obermui.de> Installed-Size: diff --git a/changes/remaster.md b/changes/remaster.md index d910dfe..d5f582d 100644 --- a/changes/remaster.md +++ b/changes/remaster.md @@ -19,6 +19,8 @@ 2018-05-13 - 2.0.2 * hotfix-2.0.2 ( create release folder if not exist ) -2018-05-20 - 2.0.2-2 +2018-05-20 - 2.0.3 * make email, proxy optional * change Strukture.md + * add config check + * some help scripts diff --git a/src/remaster.sh b/src/remaster.sh index 17b3d2b..391083b 100755 --- a/src/remaster.sh +++ b/src/remaster.sh @@ -1,5 +1,5 @@ #!/bin/bash -#@version 2.0.2-2 +#@version 2.0.3 #@autor 6543@obermui.de #@date 2018-05-20 #@licence GNUv3 From 9301b1a39c0c6ad0a9f928d2ea38d2efd346cf07 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 20 May 2018 23:44:26 +0200 Subject: [PATCH 24/24] fix duble report --- src/func/check_config | 39 +++++++++------------------------------ src/func/check_update | 4 ++-- src/remaster.sh | 14 +++++++------- 3 files changed, 18 insertions(+), 39 deletions(-) diff --git a/src/func/check_config b/src/func/check_config index 8bed903..fcb70b0 100755 --- a/src/func/check_config +++ b/src/func/check_config @@ -2,33 +2,12 @@ #remaster lib [ -d "" ] || { echo "LIBDIR not exist"; exit 1; } -#check_config [log_file] +#check_config function check_config() { - #LOG - { - log_file=$1 - [ -z "$log_file" ] && log_file="/tmp/remaster_`date '+%Y-%m-%d'`" - - if [ -f "$log_file" ]; then - echo > "$log_file" - else - #check if folder exist - [ -d "${log_file%/*}" ] || { - # N-> exit 3 - echo "Directory for Log didnt exist" - exit 3 - } - #create LOG - touch "$log_file" - fi - } - - - #Project [ -f "/proj/$distro" ] || { - echo "No Project \"$distro\" is not supported" | tee -a "$log_file" + echo "No Project \"$distro\" is not supported" return 3 } @@ -38,14 +17,14 @@ function check_config() { #Lable [ -z "$iso_lable" ] && iso_lable="$distro" - echo 'iso_source -> iso_destination' | tee -a "$log_file" - echo 'iso_source -> squashfs [optinal]' | tee -a "$log_file" + echo 'iso_source -> iso_destination' + echo 'iso_source -> squashfs [optinal]' else if [ -n "$filesystem_source" ] && [ -d "${filesystem_source%/*}" ]; then - echo 'iso_source -> squashfs' | tee -a "$log_file" + echo 'iso_source -> squashfs' else # ERROR - echo "No corect AIM in Settings" | tee -a "$log_file" + echo "No corect AIM in Settings" return 3 fi fi @@ -53,14 +32,14 @@ function check_config() { if [ -f "$filesystem_source" ]; then if [ -n "$iso_destination" ]; then # ERROR - echo "only Squashfs source in Settings, cant creat ISO" | tee -a "$log_file" + echo "only Squashfs source in Settings, cant creat ISO" return 3 else - echo 'squashfs -> squashfs' | tee -a "$log_file" + echo 'squashfs -> squashfs' fi else # ERROR - echo "No corect Source in Settings" | tee -a "$log_file" + echo "No corect Source in Settings" return 3 fi fi diff --git a/src/func/check_update b/src/func/check_update index 7a1847d..79d6d99 100755 --- a/src/func/check_update +++ b/src/func/check_update @@ -5,9 +5,9 @@ #check_update function check_update() { if curl https://raw.githubusercontent.com/6543/remaster/master/changes/remaster.md | diff - <(zcat /usr/share/doc/remaster/changelog.gz ); then - echo 'REMASTER: Aktuell' + echo 'INFO: Programm Aktuell' else - echo 'REMASTER: Warning: neue Version verfügbar' + echo 'WARNUNG: neue Version verfügbar' fi } diff --git a/src/remaster.sh b/src/remaster.sh index 391083b..ddcd498 100755 --- a/src/remaster.sh +++ b/src/remaster.sh @@ -106,10 +106,10 @@ function main_renew() { check_dependency error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" - check_config "$log_file" + check_config >> "$log_file" error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" - check_update | tee -a "$log_file" + check_update >> "$log_file" [ "$distro" != "" ] && distro="_$distro" @@ -258,12 +258,12 @@ function main_update_pxe() { check_user error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" - check_update | tee -a "$log_file" + check_update >> "$log_file" check_dependency error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" - check_config "$log_file" + check_config >> "$log_file" error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" [ "$distro" != "" ] && distro="_$distro" @@ -383,12 +383,12 @@ function main_update_iso() { check_user error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" - check_update | tee -a "$log_file" + check_update >> "$log_file" check_dependency error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" - check_config "$log_file" + check_config >> "$log_file" error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file" [ "$distro" != "" ] && distro="_$distro" @@ -503,7 +503,7 @@ function main_update_iso() { ### Error Handlings ### -#check_config [log_file] +#check_config source /func/check_config #on_exit [error_level]