Merge pull request #19 from 6543/develop

update feature-fxc branch
This commit is contained in:
6543 2018-05-17 01:13:02 +02:00 committed by GitHub
commit fb524720f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 173 additions and 61 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/build
/release

1
DEBIAN/conffiles Normal file
View File

@ -0,0 +1 @@
/etc/remaster/config.sample.cfg

12
DEBIAN/control Normal file
View File

@ -0,0 +1,12 @@
Package: remaster
Source: remaster
Version: 2.0.2
Architecture: all
Maintainer: 6543 <6543@obermui.de>
Installed-Size: <SIZE>
Depends: squashfs-tools, xorriso, wget, sed (>= 4.2), sendemail, bash (>= 4.3)
Suggests: nfs-kernel-server, isc-dhcp-server
Section: utils
Priority: optional
Homepage: https://github.com/6543/remaster
Description: The aim of this Project is to create a daemon for a server, witch update live systems.

1
DEBIAN/postinst Executable file
View File

@ -0,0 +1 @@
#!/bin/sh

1
DEBIAN/postrm Executable file
View File

@ -0,0 +1 @@
#!/bin/sh

1
DEBIAN/preinst Executable file
View File

@ -0,0 +1 @@
#!/bin/sh

1
DEBIAN/prerm Executable file
View File

@ -0,0 +1 @@
#!/bin/sh

View File

@ -1,77 +1,131 @@
#!/bin/bash
# at the moment only generate dir structure in /build
# install | clean | debug | build-deb

#make ...
function clean() {
echo "clear build"
[ -d build ] && rm -v -R build
mkdir build
echo "clear build"
[ -d build ] && rm -v -R build
mkdir build
}
function build() {
echo "build ..."
## skripte copieren ##
# remaster
mkdir -p build/usr/bin/
cp -v src/remaster.sh build/usr/bin/remaster
chmod +x build/usr/bin/remaster
function copy() {
echo "copy files ..."
# remaster
mkdir -p build/usr/bin/
cp -v src/remaster.sh build/usr/bin/remaster
chmod +x build/usr/bin/remaster

# modules
mkdir -p build/usr/lib/remaster/
for i in proj func mods; do
mkdir -p build/usr/lib/remaster/$i
cp -v src/$i/* build/usr/lib/remaster/$i/
done
# modules
mkdir -p build/usr/lib/remaster/
for i in proj func mods; do
mkdir -p build/usr/lib/remaster/$i
cp -v src/$i/* build/usr/lib/remaster/$i/
done

# setting
mkdir -p build/etc/remaster/
cp -v src/config.sample.cfg build/etc/remaster/config.sample.cfg
# setting
mkdir -p build/etc/remaster/
cp -v src/config.sample.cfg build/etc/remaster/config.sample.cfg

#changelog
mkdir -p build/usr/share/doc/remaster
cp -v changes/remaster.md build/usr/share/doc/remaster/changelog
gzip --best build/usr/share/doc/remaster/changelog
}

#config ...
function set_rootdir() {
sed -i "s#<ROOTDIR>#$1#g" build/usr/bin/remaster
for i in proj func mods; do
sed -i "s#<ROOTDIR>#$1#g" build/usr/lib/remaster/$i/*
done
sed -i "s#<ROOTDIR>#$1#g" build/usr/bin/remaster
for i in proj func mods; do
sed -i "s#<ROOTDIR>#$1#g" build/usr/lib/remaster/$i/*
done
}
function set_libdir() {
sed -i "s#<LIBDIR>#$1#g" build/usr/bin/remaster
for i in proj func mods; do
sed -i "s#<LIBDIR>#$1#g" build/usr/lib/remaster/$i/*
done
sed -i "s#<LIBDIR>#$1#g" build/usr/bin/remaster
for i in proj func mods; do
sed -i "s#<LIBDIR>#$1#g" build/usr/lib/remaster/$i/*
done
}

#modes
function debug() {
clean
build
set_rootdir "`pwd`/build"
set_libdir "`pwd`/build/usr/lib/remaster"
clean

#prebuild
copy
set_rootdir "`pwd`/build"
set_libdir "`pwd`/build/usr/lib/remaster"
}
function install() {
clean
build
set_rootdir ""
set_libdir "/usr/lib/remaster"
#cp -f -r build/* /
#überprüfe auf root
[ "`id -u`" != "0" ] && { echo "Error start as root"; exit 1; }

#lösche alltes build dir
clean

#prebuild
copy
set_rootdir ""
set_libdir "/usr/lib/remaster"

#set owner
chown -r root:root build/

#install
cp -f -r build/* /
}
function build-deb() {
#überprüfe auf root
[ "`id -u`" != "0" ] && { echo "Error start as root"; exit 1; }

#lösche alltes build dir
clean

#prebuild
copy
set_rootdir ""
set_libdir "/usr/lib/remaster"
####
## changes for deb file
####
cp -v -r -f DEBIAN build/
#create md5sums
find ./build -type f -exec md5sum {} \; | grep -v './build/DEBIAN' | sed 's/\.\/build\///g' > build/DEBIAN/md5sums
chmod 0644 build/DEBIAN/md5sums

#set size
SIZE="`du --exclude=build/DEBIAN -c build/ | cut -f 1 | tail -n 1`"
sed -i "s/<SIZE>/$SIZE/g" build/DEBIAN/control

#set owner
chown -r root:root build/

##
#build deb
##
dpkg -b build/
version="`cat build/DEBIAN/control | grep Version | cut -d " " -f 2`"
arch="`cat build/DEBIAN/control | grep Arch | cut -d " " -f 2`"
[ -f "release/remaster_"$version"_"$arch".deb" ] && rm "release/remaster_"$version"_"$arch".deb"
mkdir -p release
mv -v "build.deb" "release/remaster_"$version"_"$arch".deb"
}


case "$1" in
install)
install || exit 1
;;
clean)
clean || exit 1
;;
debug)
debug || exit 1
;;
build)
build || exit 1
;;
*)
echo "Usage: install | clean | debug | build"
exit 1
install)
install || exit 1
;;
clean)
clean || exit 1
;;
debug)
debug || exit 1
;;
copy)
copy || exit 1
;;
build-deb)
build-deb || exit 1
;;
*)
echo "Usage: install | clean | debug | build-deb"
exit 1
esac

View File

@ -6,3 +6,15 @@

2018-05-10 - 1.9.3
* hotfix-1.9.3

2018-05-12 - 2.0.0
* add feature build debian packages
* add Doc "Server Bedienung"
* split functions
* separate config into /etc/remaster/

2018-05-13 - 2.0.1
* Update-Prüfmechanismus #15

2018-05-13 - 2.0.2
* hotfix-2.0.2 ( create release folder if not exist )

View File

@ -3,3 +3,9 @@
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }

#beginn func


#this func is standalone executable
[ -n "$1" ] && {
check_user
}

View File

@ -18,5 +18,9 @@ date=`date +%Y-%m-%d`

echo >> changes/remaster.md
echo $date - $version >> changes/remaster.md
echo pleace update changes/remaster.md
editor changes/remaster.md
}

[ -f "DEBIAN/control" ] && {
sed -i "s/Version:\ .\..\../Version:\ $version_sed/g" "DEBIAN/control"
}

17
src/func/check_update Executable file
View File

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

#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'
else
echo 'REMASTER: Warning: neue Version verfügbar'
fi
}

#this func is standalone executable
[ -n "$1" ] && {
check_update
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#@version 1.9.3
#@version 2.0.2
#@autor 6543@obermui.de
#@date 2018-05-10
#@date 2018-05-13
#@licence GNUv3

#####################################################################################
@ -90,6 +90,8 @@ function main_renew() {
check_dependency
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

check_update | tee -a "$log_file"

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

# 2. Entpacke ISO
@ -237,6 +239,8 @@ function main_update_pxe() {
check_user
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

check_update | tee -a "$log_file"

check_dependency
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

@ -357,6 +361,8 @@ function main_update_iso() {
check_user
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

check_update | tee -a "$log_file"

check_dependency
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"

@ -465,11 +471,6 @@ function main_update_iso() {
on_exit 0
}

#remaster.sh update
function main_update() {
main_update_pxe
}

#####################################################################################
################## F u n c t i o n s ################################################
#####################################################################################