commit
226c2567d9
@ -1,6 +1,6 @@
|
||||
Package: remaster
|
||||
Source: remaster
|
||||
Version: 2.0.2
|
||||
Version: 2.0.3
|
||||
Architecture: all
|
||||
Maintainer: 6543 <6543@obermui.de>
|
||||
Installed-Size: <SIZE>
|
||||
|
@ -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
|
||||
|
||||
|
@ -18,3 +18,9 @@
|
||||
|
||||
2018-05-13 - 2.0.2
|
||||
* hotfix-2.0.2 ( create release folder if not exist )
|
||||
|
||||
2018-05-20 - 2.0.3
|
||||
* make email, proxy optional
|
||||
* change Strukture.md
|
||||
* add config check
|
||||
* some help scripts
|
||||
|
123
doc/Strukture.md
123
doc/Strukture.md
@ -1,28 +1,113 @@
|
||||
# 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/<Conf>
|
||||
* Ü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
|
||||
|
||||
----
|
||||
|
||||
## PXE
|
||||
|
||||
-> Install
|
||||
* DHCP Relay
|
||||
* NFS-Server
|
||||
* TFTP-Server
|
||||
* [Samba]
|
||||
|
||||
-> Setup
|
||||
* (use <Lib>/proj/<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
|
||||
* Read Confs -> get time interfall I
|
||||
* Exec remaster <Conf> for I
|
||||
|
||||
----
|
||||
|
||||
## Web
|
||||
|
||||
show/edit #Configs
|
||||
|
||||
show (+live) #Logs
|
||||
|
||||
start/stop/plan #Jobs
|
||||
|
||||
start/stop/edit #PXE menue
|
||||
* default
|
||||
* all / single / none
|
||||
* live view new clients
|
||||
|
@ -2,10 +2,12 @@
|
||||
#remaster lib
|
||||
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
|
||||
|
||||
#beginn func
|
||||
|
||||
#<function> [param]
|
||||
function <function>() {
|
||||
#Code of <function>
|
||||
}
|
||||
|
||||
#this func is standalone executable
|
||||
[ -n "$1" ] && {
|
||||
check_user
|
||||
<function> $@
|
||||
}
|
12
script/add_function.sh
Executable file
12
script/add_function.sh
Executable file
@ -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/<function>/$name/g" "src/func/$name"
|
||||
|
||||
#open
|
||||
editor "src/func/$name"
|
3
script/get_version.sh
Executable file
3
script/get_version.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
grep '@version ' src/remaster.sh | cut -d " " -f 2
|
@ -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"
|
||||
}
|
||||
|
55
src/func/check_config
Executable file
55
src/func/check_config
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
#remaster lib
|
||||
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
|
||||
|
||||
#check_config
|
||||
function check_config() {
|
||||
|
||||
#Project
|
||||
[ -f "<LIBDIR>/proj/$distro" ] || {
|
||||
echo "No Project \"$distro\" is not supported"
|
||||
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"
|
||||
|
||||
echo 'iso_source -> iso_destination'
|
||||
echo 'iso_source -> squashfs [optinal]'
|
||||
else
|
||||
if [ -n "$filesystem_source" ] && [ -d "${filesystem_source%/*}" ]; then
|
||||
echo 'iso_source -> squashfs'
|
||||
else
|
||||
# ERROR
|
||||
echo "No corect AIM in Settings"
|
||||
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"
|
||||
return 3
|
||||
else
|
||||
echo 'squashfs -> squashfs'
|
||||
fi
|
||||
else
|
||||
# ERROR
|
||||
echo "No corect Source in Settings"
|
||||
return 3
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#this func is standalone executable
|
||||
[ -n "$1" ] && {
|
||||
check_config $@
|
||||
}
|
@ -5,9 +5,9 @@
|
||||
#check_update
|
||||
function check_update() {
|
||||
if curl https://raw.githubusercontent.com/6543/remaster/master/changes/remaster.md | diff - <(zcat <ROOTDIR>/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
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,9 @@
|
||||
|
||||
#on_exit [error_level]
|
||||
function on_exit() {
|
||||
### 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
|
||||
@ -20,7 +21,9 @@ function on_exit() {
|
||||
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
|
||||
|
0
src/proj/desinfect2017
Normal file
0
src/proj/desinfect2017
Normal file
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#@version 2.0.2
|
||||
#@version 2.0.3
|
||||
#@autor 6543@obermui.de
|
||||
#@date 2018-05-13
|
||||
#@date 2018-05-20
|
||||
#@licence GNUv3
|
||||
|
||||
#####################################################################################
|
||||
@ -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,8 +49,7 @@ fi
|
||||
|
||||
#remaster.sh renew
|
||||
function main_renew() {
|
||||
|
||||
[ -f "$log_file" ] || touch "$log_file"
|
||||
#Start LOG
|
||||
tail -f "$log_file" --pid="$$" &
|
||||
|
||||
chroot_path="`mktemp -d`"
|
||||
@ -90,7 +106,10 @@ function main_renew() {
|
||||
check_dependency
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
check_update | tee -a "$log_file"
|
||||
check_config >> "$log_file"
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
check_update >> "$log_file"
|
||||
|
||||
[ "$distro" != "" ] && distro="_$distro"
|
||||
|
||||
@ -113,9 +132,10 @@ function main_renew() {
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
# 5. Setzen der Netzwerk-Einstellungen:
|
||||
|
||||
[ -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"
|
||||
@ -194,8 +214,7 @@ function main_renew() {
|
||||
#remaster.sh update_pxe
|
||||
function main_update_pxe() {
|
||||
|
||||
[ "$log_file" == "" ] && log_file="`mktemp`"
|
||||
[ -f "$log_file" ] || touch "$log_file"
|
||||
#Start LOG
|
||||
tail -f "$log_file" --pid="$$" &
|
||||
|
||||
chroot_path="`mktemp -d`"
|
||||
@ -239,11 +258,14 @@ 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"
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
[ "$distro" != "" ] && distro="_$distro"
|
||||
|
||||
# 1. Entpacken der Dateien des Live-Systems
|
||||
@ -307,7 +329,7 @@ function main_update_pxe() {
|
||||
|
||||
#remaster.sh update_iso #in arbeit
|
||||
function main_update_iso() {
|
||||
[ -f "$log_file" ] || touch "$log_file"
|
||||
#Start LOG
|
||||
tail -f "$log_file" --pid="$$" &
|
||||
|
||||
chroot_path="`mktemp -d`"
|
||||
@ -361,11 +383,14 @@ 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"
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
[ "$distro" != "" ] && distro="_$distro"
|
||||
|
||||
# 2. Entpacke ISO
|
||||
@ -397,9 +422,10 @@ function main_update_iso() {
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
# 5. Setzen der Netzwerk-Einstellungen:
|
||||
|
||||
[ -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"
|
||||
@ -477,6 +503,9 @@ function main_update_iso() {
|
||||
|
||||
### Error Handlings ###
|
||||
|
||||
#check_config
|
||||
source <LIBDIR>/func/check_config
|
||||
|
||||
#on_exit [error_level]
|
||||
source <LIBDIR>/func/on_exit
|
||||
|
||||
@ -490,6 +519,8 @@ source <LIBDIR>/func/check_user
|
||||
# -> 0 | -> 16
|
||||
source <LIBDIR>/func/check_dependency
|
||||
|
||||
#check_update
|
||||
source <LIBDIR>/func/check_update
|
||||
|
||||
### Workspace ###
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user