From 80d2ad753d1142f39f45237470078ace16b3a09a Mon Sep 17 00:00:00 2001 From: 6543 Date: Sat, 12 May 2018 19:54:34 +0200 Subject: [PATCH 1/3] debian init --- .gitignore | 1 + DEBIAN/control | 12 ++++++++++++ DEBIAN/postinst | 1 + DEBIAN/postrm | 1 + DEBIAN/preinst | 1 + DEBIAN/prerm | 1 + autogen.sh | 34 +++++++++++++++++++++++++++++++++- script/set_version.sh | 4 ++++ 8 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 DEBIAN/control create mode 100755 DEBIAN/postinst create mode 100755 DEBIAN/postrm create mode 100755 DEBIAN/preinst create mode 100755 DEBIAN/prerm diff --git a/.gitignore b/.gitignore index 796b96d..67e07b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /build +/release diff --git a/DEBIAN/control b/DEBIAN/control new file mode 100644 index 0000000..7ae5be4 --- /dev/null +++ b/DEBIAN/control @@ -0,0 +1,12 @@ +Package: remaster +Source: remaster +Version: 1.9.3 +Architecture: all +Maintainer: 6543 <6543@obermui.de> +Installed-Size: +Depends: squashfs-tools, xorriso, wget, sed, sendemail, bash +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. diff --git a/DEBIAN/postinst b/DEBIAN/postinst new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/DEBIAN/postinst @@ -0,0 +1 @@ +#!/bin/sh diff --git a/DEBIAN/postrm b/DEBIAN/postrm new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/DEBIAN/postrm @@ -0,0 +1 @@ +#!/bin/sh diff --git a/DEBIAN/preinst b/DEBIAN/preinst new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/DEBIAN/preinst @@ -0,0 +1 @@ +#!/bin/sh diff --git a/DEBIAN/prerm b/DEBIAN/prerm new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/DEBIAN/prerm @@ -0,0 +1 @@ +#!/bin/sh diff --git a/autogen.sh b/autogen.sh index 3026a54..778d02e 100755 --- a/autogen.sh +++ b/autogen.sh @@ -26,6 +26,10 @@ function build() { 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 build/usr/share/doc/remaster/changelog } #config ... @@ -56,6 +60,31 @@ function install() { set_libdir "/usr/lib/remaster" #cp -f -r build/* / } +function build_deb() { + clean + #prebuild + build + 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 + #set size + SIZE="`du --exclude=build/DEBIAN -c build/ | cut -f 1 | tail -n 1`" + sed -i "s//$SIZE/g" build/DEBIAN/control + + ## + #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" + mv -v "build.deb" "release/remaster_"$version"_"$arch".deb" +} case "$1" in @@ -71,7 +100,10 @@ case "$1" in build) build || exit 1 ;; + build_deb) + build_deb || exit 1 + ;; *) - echo "Usage: install | clean | debug | build" + echo "Usage: install | clean | debug | build_deb" exit 1 esac diff --git a/script/set_version.sh b/script/set_version.sh index e9860c7..c8f7635 100755 --- a/script/set_version.sh +++ b/script/set_version.sh @@ -20,3 +20,7 @@ date=`date +%Y-%m-%d` echo $date - $version >> changes/remaster.md echo pleace update changes/remaster.md } + +[ -f "DEBIAN/control" ] && { + sed -i "s/Version:\ .\..\../Version:\ $version_sed/g" "DEBIAN/control" +} From 7aadb795fff967a420faa26f9723a68c1d18d155 Mon Sep 17 00:00:00 2001 From: 6543 Date: Sat, 12 May 2018 20:19:12 +0200 Subject: [PATCH 2/3] =?UTF-8?q?autogen=20irref=C3=BChrende=20namen=20ge?= =?UTF-8?q?=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autogen.sh | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/autogen.sh b/autogen.sh index 778d02e..c645734 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,15 +1,13 @@ #!/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 } -function build() { - echo "build ..." - ## skripte copieren ## +function copy() { + echo "copy files ..." # remaster mkdir -p build/usr/bin/ cp -v src/remaster.sh build/usr/bin/remaster @@ -49,21 +47,21 @@ function set_libdir() { #modes function debug() { clean - build + copy set_rootdir "`pwd`/build" set_libdir "`pwd`/build/usr/lib/remaster" } function install() { clean - build + copy set_rootdir "" set_libdir "/usr/lib/remaster" #cp -f -r build/* / } -function build_deb() { +function build-deb() { clean #prebuild - build + copy set_rootdir "" set_libdir "/usr/lib/remaster" #### @@ -97,13 +95,13 @@ case "$1" in debug) debug || exit 1 ;; - build) - build || exit 1 + copy) + copy || exit 1 ;; - build_deb) - build_deb || exit 1 + build-deb) + build-deb || exit 1 ;; *) - echo "Usage: install | clean | debug | build_deb" + echo "Usage: install | clean | debug | build-deb" exit 1 esac From 8885e4881f5cefc0bbcfd2e7bb907f6c590ae6e1 Mon Sep 17 00:00:00 2001 From: 6543 Date: Sat, 12 May 2018 20:19:38 +0200 Subject: [PATCH 3/3] autogen beautysh --- autogen.sh | 156 ++++++++++++++++++++++++++--------------------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/autogen.sh b/autogen.sh index c645734..922a731 100755 --- a/autogen.sh +++ b/autogen.sh @@ -2,106 +2,106 @@ # install | clean | debug | build-deb 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 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 + 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 build/usr/share/doc/remaster/changelog + #changelog + mkdir -p build/usr/share/doc/remaster + cp -v changes/remaster.md build/usr/share/doc/remaster/changelog + gzip build/usr/share/doc/remaster/changelog } #config ... function set_rootdir() { - sed -i "s##$1#g" build/usr/bin/remaster - for i in proj func mods; do - sed -i "s##$1#g" build/usr/lib/remaster/$i/* - done + sed -i "s##$1#g" build/usr/bin/remaster + for i in proj func mods; do + sed -i "s##$1#g" build/usr/lib/remaster/$i/* + done } function set_libdir() { - sed -i "s##$1#g" build/usr/bin/remaster - for i in proj func mods; do - sed -i "s##$1#g" build/usr/lib/remaster/$i/* - done + sed -i "s##$1#g" build/usr/bin/remaster + for i in proj func mods; do + sed -i "s##$1#g" build/usr/lib/remaster/$i/* + done } #modes function debug() { - clean - copy - set_rootdir "`pwd`/build" - set_libdir "`pwd`/build/usr/lib/remaster" + clean + copy + set_rootdir "`pwd`/build" + set_libdir "`pwd`/build/usr/lib/remaster" } function install() { - clean - copy - set_rootdir "" - set_libdir "/usr/lib/remaster" - #cp -f -r build/* / + clean + copy + set_rootdir "" + set_libdir "/usr/lib/remaster" + #cp -f -r build/* / } function build-deb() { - 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 - #set size - SIZE="`du --exclude=build/DEBIAN -c build/ | cut -f 1 | tail -n 1`" - sed -i "s//$SIZE/g" build/DEBIAN/control + 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 + #set size + SIZE="`du --exclude=build/DEBIAN -c build/ | cut -f 1 | tail -n 1`" + sed -i "s//$SIZE/g" build/DEBIAN/control - ## - #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" - mv -v "build.deb" "release/remaster_"$version"_"$arch".deb" + ## + #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" + mv -v "build.deb" "release/remaster_"$version"_"$arch".deb" } case "$1" in - 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 + 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