autogen beautysh

This commit is contained in:
6543 2018-05-12 20:19:38 +02:00
parent 7aadb795ff
commit 8885e4881f

View File

@ -2,106 +2,106 @@
# install | clean | debug | build-deb # install | clean | debug | build-deb


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


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


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


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


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


#modes #modes
function debug() { function debug() {
clean clean
copy copy
set_rootdir "`pwd`/build" set_rootdir "`pwd`/build"
set_libdir "`pwd`/build/usr/lib/remaster" set_libdir "`pwd`/build/usr/lib/remaster"
} }
function install() { function install() {
clean clean
copy copy
set_rootdir "" set_rootdir ""
set_libdir "/usr/lib/remaster" set_libdir "/usr/lib/remaster"
#cp -f -r build/* / #cp -f -r build/* /
} }
function build-deb() { function build-deb() {
clean clean
#prebuild #prebuild
copy copy
set_rootdir "" set_rootdir ""
set_libdir "/usr/lib/remaster" set_libdir "/usr/lib/remaster"
#### ####
## changes for deb file ## changes for deb file
#### ####
cp -v -r -f DEBIAN build/ cp -v -r -f DEBIAN build/
#create md5sums #create md5sums
find ./build -type f -exec md5sum {} \; | grep -v './build/DEBIAN' | sed 's/\.\/build\///g' > build/DEBIAN/md5sums find ./build -type f -exec md5sum {} \; | grep -v './build/DEBIAN' | sed 's/\.\/build\///g' > build/DEBIAN/md5sums
#set size #set size
SIZE="`du --exclude=build/DEBIAN -c build/ | cut -f 1 | tail -n 1`" SIZE="`du --exclude=build/DEBIAN -c build/ | cut -f 1 | tail -n 1`"
sed -i "s/<SIZE>/$SIZE/g" build/DEBIAN/control sed -i "s/<SIZE>/$SIZE/g" build/DEBIAN/control


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




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