freenetis-github/application/vendors/deb/freenetis-qos/debianization.sh @ c2e44ab0
8baed187 | Michal Kliment | #!/bin/sh
|
|
################################################################################
|
|||
# Script for debianization of FreenetIS redirection and QoS package
|
|||
# (c) Ondrej Fibich, 2012
|
|||
#
|
|||
c2e44ab0 | Michal Kliment | # Takes two arguments (version of package - FreenetIS and debian version).
|
|
8baed187 | Michal Kliment | #
|
|
################################################################################
|
|||
c2e44ab0 | Michal Kliment | if [ $# -ne 2 ]; then
|
|
8baed187 | Michal Kliment | echo "Wrong arg count.. Terminating"
|
|
exit 1
|
|||
fi
|
|||
NAME=freenetis-qos
|
|||
VERSION=$1
|
|||
c2e44ab0 | Michal Kliment | DEBIAN=$2
|
|
8baed187 | Michal Kliment | ||
# create dirs ##################################################################
|
|||
mkdir deb_packages/tmp
|
|||
cd deb_packages/tmp
|
|||
mkdir DEBIAN
|
|||
mkdir etc
|
|||
mkdir etc/init.d
|
|||
mkdir etc/freenetis
|
|||
mkdir usr
|
|||
mkdir usr/sbin
|
|||
# copy content of package ######################################################
|
|||
cp ../../../qos/freenetis-qos.init.sh etc/init.d/${NAME}
|
|||
cp ../../../qos/freenetis-qos-sync.sh usr/sbin/freenetis-qos-sync
|
|||
cp ../../../qos/freenetis-qos.conf etc/freenetis/
|
|||
# count size
|
|||
SIZE=`du -s etc usr | cut -f1 | paste -sd+ | bc`
|
|||
# calculate checksum ###########################################################
|
|||
find * -type f ! -regex '^DEBIAN/.*' -exec md5sum {} \; >> DEBIAN/md5sums
|
|||
# create info files ############################################################
|
|||
# create package info
|
|||
echo "Package: ${NAME}" >> DEBIAN/control
|
|||
c2e44ab0 | Michal Kliment | echo "Version: ${VERSION}-${DEBIAN}" >> DEBIAN/control
|
|
8baed187 | Michal Kliment | echo "Installed-Size: ${SIZE}" >> DEBIAN/control
|
|
c2e44ab0 | Michal Kliment | ||
if [ "$DEBIAN" = lenny ] || [ "$DEBIAN" = squeeze ]; then
|
|||
echo "Depends: coreutils, ipset, wget, procps, iptables, ipset-source, module-assistant, lsb-release" >> DEBIAN/control
|
|||
else
|
|||
echo "Depends: coreutils, ipset, wget, procps, iptables, lsb-release" >> DEBIAN/control
|
|||
fi
|
|||
8baed187 | Michal Kliment | cat ../../${NAME}/control >> DEBIAN/control
|
|
# change log
|
|||
cat ../../${NAME}/changelog >> DEBIAN/changelog
|
|||
# copywriting
|
|||
echo "This package was debianized by Ondrej Fibich <ondrej.fibich@gmail.com> on" >> DEBIAN/copyright
|
|||
date -R >> DEBIAN/copyright
|
|||
echo "" >> DEBIAN/copyright
|
|||
echo "It was downloaded from <http://freenetis.org/>" >> DEBIAN/copyright
|
|||
echo "" >> DEBIAN/copyright
|
|||
echo "Upstream Author:" >> DEBIAN/copyright
|
|||
cat ../../../../../AUTHORS >> DEBIAN/copyright
|
|||
echo "" >> DEBIAN/copyright
|
|||
echo "License:" >> DEBIAN/copyright
|
|||
cat ../../../../../COPYING >> DEBIAN/copyright
|
|||
# scripts ######################################################################
|
|||
cat ../../${NAME}/postinst >> DEBIAN/postinst
|
|||
cat ../../${NAME}/prerm >> DEBIAN/prerm
|
|||
cat ../../${NAME}/postrm >> DEBIAN/postrm
|
|||
cat ../../${NAME}/templates >> DEBIAN/templates
|
|||
cat ../../${NAME}/config >> DEBIAN/config
|
|||
chmod +x DEBIAN/postinst DEBIAN/postrm DEBIAN/prerm DEBIAN/config
|
|||
# create deb ###################################################################
|
|||
# change owner of files to root (security)
|
|||
cd ..
|
|||
sudo chown -hR root:root *
|
|||
# make package
|
|||
c2e44ab0 | Michal Kliment | sudo dpkg-deb -b tmp ${NAME}_${VERSION}+${DEBIAN}.deb
|
|
8baed187 | Michal Kliment | ||
# clean-up mess ################################################################
|
|||
# clean
|
|||
sudo rm -rf tmp
|