Revize 1484
Přidáno uživatelem Ondřej Fibich před více než 12 roky(ů)
freenetis/branches/testing/application/vendors/deb/templates | ||
---|---|---|
Template: freenetis/servername
|
||
Type: string
|
||
Default: localhost/freenetis
|
||
Description: Server Name:
|
||
Server Name on which the FreenetIS will be hosted.
|
||
|
||
Template: freenetis/protocol
|
||
Type: select
|
||
Choices: http, https
|
||
Default: http
|
||
Description: Protocol:
|
||
Protocol for accessing of FreenetIS.
|
freenetis/branches/testing/application/vendors/deb/changelog | ||
---|---|---|
freenetis (1.0.0~beta1) unstable; urgency=low
|
||
* First official beta release
|
||
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 26 Jun 2012 21:28:47 +0200
|
freenetis/branches/testing/application/vendors/deb/control | ||
---|---|---|
Priority: optional
|
||
Section: web
|
||
Pre-Depends: debconf (>= 0.5) | debconf-2.0
|
||
Depends: apache2, php5, php5-curl, libapache2-mod-php5, php5-mysql | php5-mysqli, mysql-client
|
||
Suggests: mysql-server (>= 5.0.0), mysql-client
|
||
Architecture: all
|
||
Maintainer: Ondrej Fibich <ondrej.fibich@gmail.com>
|
||
Homepage: http://www.freenetis.org
|
||
Description: FreenetIS - information system for managing non-profit networks
|
||
FreenetIS is multilanguage information system for managing non-profit networks
|
||
which is capable to:
|
||
- manage groups and their users;
|
||
- double-entry accounting system (payments, double-entry transfers, bank transfers, accounts, bank accounts, cash flow);
|
||
- network infrastructure (devices, segments, interfaces, IP addresses, subnets, VLANs, VLAN interfaces, ports);
|
||
- monitoring (devices);
|
||
- QoS;
|
||
- notifications (unknown devices page, page for debtors or just information page using SMS, email or redirection);
|
||
- work reporting of active users and work approval;
|
||
- lists of calls and billing of VoIP;
|
||
- etc.
|
freenetis/branches/testing/application/vendors/deb/postrm | ||
---|---|---|
#!/bin/sh
|
||
# FreenetIS DEB: actions before uninstalling of package
|
||
|
||
set -e
|
||
. /usr/share/debconf/confmodule
|
||
|
||
# get config
|
||
db_get freenetis/servername
|
||
SERVERNAME="$RET"
|
||
|
||
db_get freenetis/protocol
|
||
PROTOCOL="$RET"
|
||
|
||
# remove from Apache config
|
||
SERVER=apache2
|
||
rm -rf /etc/$SERVER/conf.d/freenetis.conf
|
||
|
||
# remove from CRON
|
||
CRON_TABLE_TMP=/tmp/fn_cron_tab
|
||
CRON_TABLE_TMP2=/tmp/fn_cron_tab2
|
||
CRON_LINE="* * * * * root wget -O /dev/null ${PROTOCOL}://${SERVERNAME}/cs/scheduler/run"
|
||
|
||
set +e
|
||
crontab -l > $CRON_TABLE_TMP
|
||
if [ $? -ne 0 ]; then
|
||
echo "" > $CRON_TABLE_TMP
|
||
fi
|
||
set -e
|
||
|
||
sed --silent '/$CRON_LINE/d' $CRON_TABLE_TMP
|
||
|
||
while read line; do
|
||
if [ "$CRON_LINE" != "$line" ]; then
|
||
echo "$line"
|
||
fi
|
||
done < $CRON_TABLE_TMP > $CRON_TABLE_TMP2
|
||
|
||
crontab $CRON_TABLE_TMP2
|
||
|
||
# remove all configuration if purge
|
||
if [ "$1" = purge ]; then
|
||
# remove defconf values
|
||
if [ -e /usr/share/debconf/confmodule ]; then
|
||
db_purge
|
||
fi
|
||
# remove config files
|
||
rm -rf /etc/freenetis
|
||
# remove all files
|
||
rm -rf /var/www/freenetis
|
||
fi
|
||
|
||
# restart apache
|
||
#/etc/init.d/apache2 restart
|
||
|
||
#DEBHELPER#
|
freenetis/branches/testing/application/vendors/deb/conffiles | ||
---|---|---|
/etc/freenetis/freenetis.conf
|
freenetis/branches/testing/application/vendors/deb/config | ||
---|---|---|
#!/bin/sh
|
||
|
||
set -e
|
||
. /usr/share/debconf/confmodule
|
||
|
||
CONFIGFILE=/etc/freenetis/freenetis.conf
|
||
|
||
# Load config file, if it exists.
|
||
if [ -e $CONFIGFILE ]; then
|
||
. $CONFIGFILE || true
|
||
db_set freenetis/servername "$SERVERNAME"
|
||
db_set freenetis/protocol "$PROTOCOL"
|
||
fi
|
||
|
||
# Ask questions.
|
||
db_input critical freenetis/servername || true
|
||
db_input critical freenetis/protocol || true
|
||
db_go || true
|
freenetis/branches/testing/application/vendors/deb/postinst | ||
---|---|---|
#!/bin/bash
|
||
# FreenetIS DEB: actions after installing of package
|
||
|
||
set -e
|
||
. /usr/share/debconf/confmodule
|
||
|
||
SERVER=apache2
|
||
CONFIGFILE=/etc/freenetis/freenetis.conf
|
||
|
||
# Generate config file, if it doesn’t exist.
|
||
# An alternative is to copy in a template
|
||
# file from elsewhere.
|
||
|
||
if [ ! -e $CONFIGFILE ]; then
|
||
mkdir /etc/freenetis/
|
||
echo "# Config file for FreenetIS" > $CONFIGFILE
|
||
echo "SERVERNAME=\"localhost/freenetis\"" >> $CONFIGFILE
|
||
echo "PROTOCOL=\"http\"" >> $CONFIGFILE
|
||
fi
|
||
|
||
# Substitute in the values from the debconf db.
|
||
# There are obvious optimizations possible here.
|
||
# The cp before the sed ensures we do not mess up
|
||
# the config file’s ownership and permissions.
|
||
|
||
db_get freenetis/servername
|
||
SERVERNAME="$RET"
|
||
|
||
db_get freenetis/protocol
|
||
PROTOCOL="$RET"
|
||
|
||
cp -a -f $CONFIGFILE $CONFIGFILE.tmp
|
||
|
||
# If the admin deleted or commented some variables but then set
|
||
# them via debconf, (re-)add them to the conffile.
|
||
|
||
test -z "$SERVERNAME" || grep -Eq '^ *SERVERNAME=' $CONFIGFILE || echo "SERVERNAME=" >> $CONFIGFILE
|
||
SERVERNAME_ESCAPED="${SERVERNAME//\//\\/}"
|
||
sed -e "s/^ *SERVERNAME=.*/SERVERNAME=\"$SERVERNAME_ESCAPED\"/" < $CONFIGFILE > $CONFIGFILE.tmp
|
||
|
||
test -z "$PROTOCOL" || grep -Eq '^ *PROTOCOL=' $CONFIGFILE || echo "PROTOCOL=" >> $CONFIGFILE
|
||
sed -e "s/^ *PROTOCOL=.*/PROTOCOL=\"$PROTOCOL\"/" < $CONFIGFILE > $CONFIGFILE.tmp
|
||
|
||
mv -f $CONFIGFILE.tmp $CONFIGFILE
|
||
|
||
# check server name
|
||
if [ -z "$SERVERNAME" ]; then
|
||
echo "Wrong server name, configuration failed!"
|
||
exit 3
|
||
fi
|
||
|
||
# check protocol
|
||
if [ -z "$PROTOCOL" ]; then
|
||
echo "Wrong protocol, configuration failed!"
|
||
exit 3
|
||
fi
|
||
|
||
# Make post install things
|
||
|
||
# 1) Apache config
|
||
|
||
A2CF=/etc/$SERVER/conf.d/freenetis.conf
|
||
|
||
# activate redirection
|
||
a2enmod rewrite > /dev/null
|
||
|
||
# make config
|
||
if [[ "$SERVERNAME" == localhost* ]]; then
|
||
|
||
echo "<Directory /var/www/freenetis>" >> $A2CF
|
||
echo " Options Indexes FollowSymLinks MultiViews" >> $A2CF
|
||
echo " AllowOverride All" >> $A2CF
|
||
echo " Order allow,deny" >> $A2CF
|
||
echo " allow from all" >> $A2CF
|
||
echo "</Directory>" >> $A2CF
|
||
|
||
else
|
||
|
||
if [ "$PROTOCOL" = "https" ]; then
|
||
echo "NameVirtualHost *:443" > $A2CF
|
||
echo "<VirtualHost *:443>" >> $A2CF
|
||
else
|
||
echo "NameVirtualHost *:80" > $A2CF
|
||
echo "<VirtualHost *:80>" >> $A2CF
|
||
fi
|
||
|
||
echo " ServerName ${SERVERNAME}" >> $A2CF
|
||
echo " DocumentRoot /var/www/freenetis" >> $A2CF
|
||
echo " <Directory /var/www/freenetis>" >> $A2CF
|
||
echo " Options Indexes FollowSymLinks MultiViews" >> $A2CF
|
||
echo " AllowOverride All" >> $A2CF
|
||
echo " Order allow,deny" >> $A2CF
|
||
echo " allow from all" >> $A2CF
|
||
echo " </Directory>" >> $A2CF
|
||
echo " ErrorLog /var/log/apache2/freenetis.error.log" >> $A2CF
|
||
echo " CustomLog /var/log/apache2/freenetis.log common" >> $A2CF
|
||
|
||
if [ "$PROTOCOL" = "https" ]; then
|
||
echo " SSLEngine on" >> $A2CF
|
||
echo " SSLProtocol all -SSLv2" >> $A2CF
|
||
echo " SSLCipherSuite ALLADHEXPORTSSLv2:RC4+RSA:+HIGH:+MEDIUM" >> $A2CF
|
||
echo " SSLCertificateFile /etc/freenetis/ssl.crt" >> $A2CF
|
||
echo " SSLCertificateKeyFile /etc/freenetis/ssl.key" >> $A2CF
|
||
echo " SSLCertificateChainFile /etc/freenetis/sub.class1.server.ca.pem" >> $A2CF
|
||
echo " SSLCACertificateFile /etc/freenetis/ca.pem" >> $A2CF
|
||
echo " SetEnvIf User-Agent \".*MSIE.*\" nokeepalive ssl-unclean-shutdown" >> $A2CF
|
||
fi
|
||
|
||
echo "</VirtualHost>" >> $A2CF
|
||
|
||
fi
|
||
|
||
# restart
|
||
set +e
|
||
apache2ctl restart
|
||
set -e
|
||
|
||
# 2) CRON
|
||
|
||
CRON_LINE="* * * * * root wget -O /dev/null ${PROTOCOL}://${SERVERNAME}/cs/scheduler/run"
|
||
CRON_TABLE_TMP=/tmp/fn_cron_tab
|
||
|
||
set +e
|
||
crontab -u root -l > $CRON_TABLE_TMP
|
||
set -e
|
||
|
||
echo "$CRON_LINE" >> $CRON_TABLE_TMP
|
||
crontab -u root $CRON_TABLE_TMP
|
||
|
||
# 3) locales
|
||
|
||
# list of required locales for FreenetIS -> add some for different language muttation
|
||
locales=(en_US.UTF-8 cs_CZ.UTF-8)
|
||
locales_lowered=(en_US.utf8 cs_CZ.utf8)
|
||
|
||
# is reconfigure of locales required?
|
||
reconfigure=0
|
||
debian=1
|
||
|
||
for index in ${!locales[*]}
|
||
do
|
||
|
||
loc=${locales[index]}
|
||
loc_lowered=${locales_lowered[index]}
|
||
|
||
set +e
|
||
locale -a | grep "^$loc_lowered$" > /dev/null
|
||
ret=$?
|
||
set -e
|
||
|
||
# locale not present
|
||
if [ $ret -ne 0 ]; then
|
||
reconfigure=1
|
||
encoding=`echo $loc | cut -f2 -d'.'`
|
||
loc_str="$loc $encoding"
|
||
|
||
if [ -f "/etc/locale.gen" ]; then # Debian
|
||
loc_str_esc="${loc_str//\//\\/}"
|
||
sed 's/# $loc_str_esc/$loc_str_esc/' /etc/locale.gen > /tmp/fn_locale.gen
|
||
mv /tmp/fn_locale.gen /etc/locale.gen
|
||
elif [ -d "/var/lib/locales/supported.d" ]; then # Ubuntu
|
||
debian=0
|
||
short_cut=`echo $loc | cut -f1 -d'_'`
|
||
touch /var/lib/locales/supported.d/${short_cut}
|
||
echo $loc_str >> /var/lib/locales/supported.d/${short_cut}
|
||
else
|
||
echo "Unknown locale generation, cannot generate locales"
|
||
exit 5
|
||
fi
|
||
fi
|
||
|
||
done
|
||
|
||
# reconfigure locales if any missingon Ubuntu
|
||
if [ $reconfigure -eq 1 ]; then
|
||
if [ $debian -eq 1 ]; then
|
||
locale-gen
|
||
else
|
||
dpkg-reconfigure locales
|
||
fi
|
||
fi
|
||
|
||
#DEBHELPER#
|
freenetis/branches/testing/application/vendors/deb/freenetis/control | ||
---|---|---|
Priority: optional
|
||
Section: web
|
||
Pre-Depends: debconf (>= 0.5) | debconf-2.0
|
||
Depends: apache2, php5, php5-curl, libapache2-mod-php5, php5-mysql | php5-mysqli, mysql-client
|
||
Suggests: mysql-server (>= 5.0.0), mysql-client
|
||
Architecture: all
|
||
Maintainer: Ondrej Fibich <ondrej.fibich@gmail.com>
|
||
Homepage: http://www.freenetis.org
|
||
Description: FreenetIS - information system for managing non-profit networks
|
||
FreenetIS is multilanguage information system for managing non-profit networks
|
||
which is capable to:
|
||
- manage groups and their users;
|
||
- double-entry accounting system (payments, double-entry transfers, bank transfers, accounts, bank accounts, cash flow);
|
||
- network infrastructure (devices, segments, interfaces, IP addresses, subnets, VLANs, VLAN interfaces, ports);
|
||
- monitoring (devices);
|
||
- QoS;
|
||
- notifications (unknown devices page, page for debtors or just information page using SMS, email or redirection);
|
||
- work reporting of active users and work approval;
|
||
- lists of calls and billing of VoIP;
|
||
- etc.
|
freenetis/branches/testing/application/vendors/deb/freenetis/postinst | ||
---|---|---|
#!/bin/bash
|
||
# FreenetIS DEB: actions after installing of package
|
||
|
||
set -e
|
||
. /usr/share/debconf/confmodule
|
||
|
||
SERVER=apache2
|
||
CONFIGFILE=/etc/freenetis/freenetis.conf
|
||
|
||
# Generate config file, if it doesn’t exist.
|
||
# An alternative is to copy in a template
|
||
# file from elsewhere.
|
||
|
||
if [ ! -e $CONFIGFILE ]; then
|
||
mkdir /etc/freenetis/
|
||
echo "# Config file for FreenetIS" > $CONFIGFILE
|
||
echo "SERVERNAME=\"localhost/freenetis\"" >> $CONFIGFILE
|
||
echo "PROTOCOL=\"http\"" >> $CONFIGFILE
|
||
fi
|
||
|
||
# Substitute in the values from the debconf db.
|
||
# There are obvious optimizations possible here.
|
||
# The cp before the sed ensures we do not mess up
|
||
# the config file’s ownership and permissions.
|
||
|
||
db_get freenetis/servername
|
||
SERVERNAME="$RET"
|
||
|
||
db_get freenetis/protocol
|
||
PROTOCOL="$RET"
|
||
|
||
cp -a -f $CONFIGFILE $CONFIGFILE.tmp
|
||
|
||
# If the admin deleted or commented some variables but then set
|
||
# them via debconf, (re-)add them to the conffile.
|
||
|
||
test -z "$SERVERNAME" || grep -Eq '^ *SERVERNAME=' $CONFIGFILE || echo "SERVERNAME=" >> $CONFIGFILE
|
||
SERVERNAME_ESCAPED="${SERVERNAME//\//\\/}"
|
||
sed -e "s/^ *SERVERNAME=.*/SERVERNAME=\"$SERVERNAME_ESCAPED\"/" < $CONFIGFILE > $CONFIGFILE.tmp
|
||
|
||
test -z "$PROTOCOL" || grep -Eq '^ *PROTOCOL=' $CONFIGFILE || echo "PROTOCOL=" >> $CONFIGFILE
|
||
sed -e "s/^ *PROTOCOL=.*/PROTOCOL=\"$PROTOCOL\"/" < $CONFIGFILE > $CONFIGFILE.tmp
|
||
|
||
mv -f $CONFIGFILE.tmp $CONFIGFILE
|
||
|
||
# check server name
|
||
if [ -z "$SERVERNAME" ]; then
|
||
echo "Wrong server name, configuration failed!"
|
||
exit 3
|
||
fi
|
||
|
||
# check protocol
|
||
if [ -z "$PROTOCOL" ]; then
|
||
echo "Wrong protocol, configuration failed!"
|
||
exit 3
|
||
fi
|
||
|
||
# Make post install things
|
||
|
||
# 1) Apache config
|
||
|
||
A2CF=/etc/$SERVER/conf.d/freenetis.conf
|
||
|
||
# activate redirection
|
||
a2enmod rewrite > /dev/null
|
||
|
||
# make config
|
||
if [[ "$SERVERNAME" == localhost* ]]; then
|
||
|
||
echo "<Directory /var/www/freenetis>" >> $A2CF
|
||
echo " Options Indexes FollowSymLinks MultiViews" >> $A2CF
|
||
echo " AllowOverride All" >> $A2CF
|
||
echo " Order allow,deny" >> $A2CF
|
||
echo " allow from all" >> $A2CF
|
||
echo "</Directory>" >> $A2CF
|
||
|
||
else
|
||
|
||
if [ "$PROTOCOL" = "https" ]; then
|
||
echo "NameVirtualHost *:443" > $A2CF
|
||
echo "<VirtualHost *:443>" >> $A2CF
|
||
else
|
||
echo "NameVirtualHost *:80" > $A2CF
|
||
echo "<VirtualHost *:80>" >> $A2CF
|
||
fi
|
||
|
||
echo " ServerName ${SERVERNAME}" >> $A2CF
|
||
echo " DocumentRoot /var/www/freenetis" >> $A2CF
|
||
echo " <Directory /var/www/freenetis>" >> $A2CF
|
||
echo " Options Indexes FollowSymLinks MultiViews" >> $A2CF
|
||
echo " AllowOverride All" >> $A2CF
|
||
echo " Order allow,deny" >> $A2CF
|
||
echo " allow from all" >> $A2CF
|
||
echo " </Directory>" >> $A2CF
|
||
echo " ErrorLog /var/log/apache2/freenetis.error.log" >> $A2CF
|
||
echo " CustomLog /var/log/apache2/freenetis.log common" >> $A2CF
|
||
|
||
if [ "$PROTOCOL" = "https" ]; then
|
||
echo " SSLEngine on" >> $A2CF
|
||
echo " SSLProtocol all -SSLv2" >> $A2CF
|
||
echo " SSLCipherSuite ALLADHEXPORTSSLv2:RC4+RSA:+HIGH:+MEDIUM" >> $A2CF
|
||
echo " SSLCertificateFile /etc/freenetis/ssl.crt" >> $A2CF
|
||
echo " SSLCertificateKeyFile /etc/freenetis/ssl.key" >> $A2CF
|
||
echo " SSLCertificateChainFile /etc/freenetis/sub.class1.server.ca.pem" >> $A2CF
|
||
echo " SSLCACertificateFile /etc/freenetis/ca.pem" >> $A2CF
|
||
echo " SetEnvIf User-Agent \".*MSIE.*\" nokeepalive ssl-unclean-shutdown" >> $A2CF
|
||
fi
|
||
|
||
echo "</VirtualHost>" >> $A2CF
|
||
|
||
fi
|
||
|
||
# restart
|
||
set +e
|
||
apache2ctl restart
|
||
set -e
|
||
|
||
# 2) CRON
|
||
|
||
CRON_LINE="* * * * * root wget -O /dev/null ${PROTOCOL}://${SERVERNAME}/cs/scheduler/run"
|
||
CRON_TABLE_TMP=/tmp/fn_cron_tab
|
||
|
||
set +e
|
||
crontab -u root -l > $CRON_TABLE_TMP
|
||
set -e
|
||
|
||
echo "$CRON_LINE" >> $CRON_TABLE_TMP
|
||
crontab -u root $CRON_TABLE_TMP
|
||
|
||
# 3) locales
|
||
|
||
# list of required locales for FreenetIS -> add some for different language muttation
|
||
locales=(en_US.UTF-8 cs_CZ.UTF-8)
|
||
locales_lowered=(en_US.utf8 cs_CZ.utf8)
|
||
|
||
# is reconfigure of locales required?
|
||
reconfigure=0
|
||
debian=1
|
||
|
||
for index in ${!locales[*]}
|
||
do
|
||
|
||
loc=${locales[index]}
|
||
loc_lowered=${locales_lowered[index]}
|
||
|
||
set +e
|
||
locale -a | grep "^$loc_lowered$" > /dev/null
|
||
ret=$?
|
||
set -e
|
||
|
||
# locale not present
|
||
if [ $ret -ne 0 ]; then
|
||
reconfigure=1
|
||
encoding=`echo $loc | cut -f2 -d'.'`
|
||
loc_str="$loc $encoding"
|
||
|
||
if [ -f "/etc/locale.gen" ]; then # Debian
|
||
loc_str_esc="${loc_str//\//\\/}"
|
||
sed 's/# $loc_str_esc/$loc_str_esc/' /etc/locale.gen > /tmp/fn_locale.gen
|
||
mv /tmp/fn_locale.gen /etc/locale.gen
|
||
elif [ -d "/var/lib/locales/supported.d" ]; then # Ubuntu
|
||
debian=0
|
||
short_cut=`echo $loc | cut -f1 -d'_'`
|
||
touch /var/lib/locales/supported.d/${short_cut}
|
||
echo $loc_str >> /var/lib/locales/supported.d/${short_cut}
|
||
else
|
||
echo "Unknown locale generation, cannot generate locales"
|
||
exit 5
|
||
fi
|
||
fi
|
||
|
||
done
|
||
|
||
# reconfigure locales if any missingon Ubuntu
|
||
if [ $reconfigure -eq 1 ]; then
|
||
if [ $debian -eq 1 ]; then
|
||
locale-gen
|
||
else
|
||
dpkg-reconfigure locales
|
||
fi
|
||
fi
|
||
|
||
#DEBHELPER#
|
freenetis/branches/testing/application/vendors/deb/freenetis/postrm | ||
---|---|---|
#!/bin/sh
|
||
# FreenetIS DEB: actions before uninstalling of package
|
||
|
||
set -e
|
||
. /usr/share/debconf/confmodule
|
||
|
||
# get config
|
||
db_get freenetis/servername
|
||
SERVERNAME="$RET"
|
||
|
||
db_get freenetis/protocol
|
||
PROTOCOL="$RET"
|
||
|
||
# remove from Apache config
|
||
SERVER=apache2
|
||
rm -rf /etc/$SERVER/conf.d/freenetis.conf
|
||
|
||
# remove from CRON
|
||
CRON_TABLE_TMP=/tmp/fn_cron_tab
|
||
CRON_TABLE_TMP2=/tmp/fn_cron_tab2
|
||
CRON_LINE="* * * * * root wget -O /dev/null ${PROTOCOL}://${SERVERNAME}/cs/scheduler/run"
|
||
|
||
set +e
|
||
crontab -l > $CRON_TABLE_TMP
|
||
if [ $? -ne 0 ]; then
|
||
echo "" > $CRON_TABLE_TMP
|
||
fi
|
||
set -e
|
||
|
||
sed --silent '/$CRON_LINE/d' $CRON_TABLE_TMP
|
||
|
||
while read line; do
|
||
if [ "$CRON_LINE" != "$line" ]; then
|
||
echo "$line"
|
||
fi
|
||
done < $CRON_TABLE_TMP > $CRON_TABLE_TMP2
|
||
|
||
crontab $CRON_TABLE_TMP2
|
||
|
||
# remove all configuration if purge
|
||
if [ "$1" = purge ]; then
|
||
# remove defconf values
|
||
if [ -e /usr/share/debconf/confmodule ]; then
|
||
db_purge
|
||
fi
|
||
# remove config files
|
||
rm -rf /etc/freenetis
|
||
# remove all files
|
||
rm -rf /var/www/freenetis
|
||
fi
|
||
|
||
# restart apache
|
||
#/etc/init.d/apache2 restart
|
||
|
||
#DEBHELPER#
|
freenetis/branches/testing/application/vendors/deb/freenetis/config | ||
---|---|---|
#!/bin/sh
|
||
|
||
set -e
|
||
. /usr/share/debconf/confmodule
|
||
|
||
CONFIGFILE=/etc/freenetis/freenetis.conf
|
||
|
||
# Load config file, if it exists.
|
||
if [ -e $CONFIGFILE ]; then
|
||
. $CONFIGFILE || true
|
||
db_set freenetis/servername "$SERVERNAME"
|
||
db_set freenetis/protocol "$PROTOCOL"
|
||
fi
|
||
|
||
# Ask questions.
|
||
db_input critical freenetis/servername || true
|
||
db_input critical freenetis/protocol || true
|
||
db_go || true
|
freenetis/branches/testing/application/vendors/deb/freenetis/changelog | ||
---|---|---|
freenetis (1.0.0~beta1) unstable; urgency=low
|
||
* First official beta release
|
||
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 26 Jun 2012 21:28:47 +0200
|
freenetis/branches/testing/application/vendors/deb/freenetis/conffiles | ||
---|---|---|
/etc/freenetis/freenetis.conf
|
freenetis/branches/testing/application/vendors/deb/freenetis/debianization.sh | ||
---|---|---|
#!/bin/sh
|
||
################################################################################
|
||
# Script for debianization of FreenetIS base package
|
||
# (c) Ondrej Fibich, 2012
|
||
#
|
||
# Takes two arguments (version of package - FreenetIS).
|
||
#
|
||
################################################################################
|
||
|
||
if [ $# -ne 1 ]; then
|
||
echo "Wrong arg count.. Terminating"
|
||
exit 1
|
||
fi
|
||
NAME=freenetis
|
||
VERSION=$1
|
||
|
||
# create dirs ##################################################################
|
||
mkdir deb_packages/tmp
|
||
cd deb_packages/tmp
|
||
|
||
mkdir DEBIAN
|
||
mkdir var
|
||
mkdir var/www
|
||
mkdir var/www/${NAME}
|
||
|
||
# copy content of package ######################################################
|
||
|
||
cd ..
|
||
tar -zcvf /tmp/${NAME}_packaging.tar.gz ../../../../ 1>/dev/null
|
||
|
||
if [ $? -ne 0 ]; then
|
||
echo "error during packaging"
|
||
exit 2
|
||
fi
|
||
|
||
cd tmp/var/www/${NAME}
|
||
|
||
tar -xvf /tmp/${NAME}_packaging.tar.gz 1>/dev/null
|
||
|
||
if [ $? -ne 0 ]; then
|
||
echo "error during unpackaging"
|
||
exit 3
|
||
fi
|
||
|
||
rm /tmp/${NAME}_packaging.tar.gz
|
||
|
||
cd ../../../
|
||
|
||
# remove dev parts of FN
|
||
rm -rf var/www/${NAME}/application/vendors/deb
|
||
rm -rf var/www/${NAME}/application/vendors/unit_tester
|
||
rm -rf var/www/${NAME}/application/controllers/unit_tester.php
|
||
rm -rf var/www/${NAME}/application/views/unit_tester
|
||
# remove hidden
|
||
rm -rf var/www/${NAME}/.htaccess
|
||
rm -rf var/www/${NAME}/config.php
|
||
rm -rf var/www/${NAME}/upload/*
|
||
rm -rf var/www/${NAME}/logs
|
||
rm -rf var/www/${NAME}/doc
|
||
# remove .svn
|
||
rm -rf `find var/www/${NAME} -type d -name .svn`
|
||
|
||
# count size
|
||
SIZE=`du -s var | cut -f1`
|
||
|
||
# calculate checksum ###########################################################
|
||
|
||
find * -type f ! -regex '^DEBIAN/.*' -exec md5sum {} \; >> DEBIAN/md5sums
|
||
|
||
# create info files ############################################################
|
||
|
||
# create package info
|
||
|
||
echo "Package: ${NAME}" >> DEBIAN/control
|
||
echo "Version: ${VERSION}" >> DEBIAN/control
|
||
echo "Installed-Size: ${SIZE}" >> DEBIAN/control
|
||
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 var/www/${NAME}/AUTHORS >> DEBIAN/copyright
|
||
echo "" >> DEBIAN/copyright
|
||
echo "License:" >> DEBIAN/copyright
|
||
cat var/www/${NAME}/COPYING >> DEBIAN/copyright
|
||
|
||
# scripts ######################################################################
|
||
|
||
cat ../../${NAME}/postinst >> DEBIAN/postinst
|
||
cat ../../${NAME}/postrm >> DEBIAN/postrm
|
||
cat ../../${NAME}/templates >> DEBIAN/templates
|
||
cat ../../${NAME}/config >> DEBIAN/config
|
||
|
||
chmod +x DEBIAN/postinst DEBIAN/postrm DEBIAN/config
|
||
|
||
# create deb ###################################################################
|
||
|
||
# change owner of files to root (security)
|
||
cd ..
|
||
sudo chown -hR root:root *
|
||
cd tmp
|
||
sudo chmod ugo+w var/www/${NAME} var/www/${NAME}/upload
|
||
sudo mkdir -m 0777 var/www/${NAME}/logs
|
||
|
||
# make package
|
||
cd ..
|
||
sudo dpkg-deb -b tmp ${NAME}_${VERSION}_all.deb
|
||
|
||
# clean-up mess ################################################################
|
||
|
||
# clean
|
||
sudo rm -rf tmp
|
||
freenetis/branches/testing/application/vendors/deb/freenetis/templates | ||
---|---|---|
Template: freenetis/servername
|
||
Type: string
|
||
Default: localhost/freenetis
|
||
Description: Server Name:
|
||
Server Name on which the FreenetIS will be hosted.
|
||
|
||
Template: freenetis/protocol
|
||
Type: select
|
||
Choices: http, https
|
||
Default: http
|
||
Description: Protocol:
|
||
Protocol for accessing of FreenetIS.
|
freenetis/branches/testing/application/vendors/deb/debianization.sh | ||
---|---|---|
#!/bin/sh
|
||
#!/bin/bash
|
||
################################################################################
|
||
# Script for debianization of FreenetIS
|
||
# (c) Ondrej Fibich, 2012
|
||
#
|
||
# Takes one argument (version of package - FreenetIS). Example:
|
||
# Takes one argument (version of package - FreenetIS) and it generates all
|
||
# FreenetIS packages to directory deb_packages.
|
||
#
|
||
# $ freenetis_debianization 1.1
|
||
#
|
||
################################################################################
|
||
|
||
if [ $# -ne 1 ]; then
|
||
... | ... | |
exit 1
|
||
fi
|
||
|
||
NAME=freenetis
|
||
NAMES=(freenetis freenetis-monitoring freenetis-redirection freenetis-ulogd)
|
||
VERSION=$1
|
||
|
||
# functions ####################################################################
|
||
|
||
function red_echo() {
|
||
echo -e "\e[01;31m$1\e[0m"
|
||
}
|
||
|
||
function green_echo() {
|
||
echo -e "\e[01;32m$1\e[0m"
|
||
}
|
||
|
||
# create dirs ##################################################################
|
||
rm -rf deb_packages
|
||
mkdir deb_packages
|
||
mkdir deb_packages/tmp
|
||
cd deb_packages/tmp
|
||
|
||
mkdir DEBIAN
|
||
mkdir var
|
||
mkdir var/www
|
||
mkdir var/www/${NAME}
|
||
# call all debianization utils #################################################
|
||
|
||
# copy content of package ######################################################
|
||
for name in ${NAMES[*]}
|
||
do
|
||
deb_sh=./$name/debianization.sh
|
||
|
||
if [ -f "$deb_sh" ]; then
|
||
./$deb_sh "$VERSION"
|
||
|
||
cd ..
|
||
tar -zcvf /tmp/freenetis_packaging.tar.gz ../../../../ 1>/dev/null
|
||
if [ $? -eq 0 ]; then
|
||
green_echo ">>>> [$name] debianized"
|
||
else
|
||
red_echo ">>>> [$name] an error occured during debianization"
|
||
fi
|
||
else
|
||
red_echo ">>>> [$name] not debianized (debianization utility is missing)"
|
||
fi
|
||
done
|
||
|
||
if [ $? -ne 0 ]; then
|
||
echo "error during packaging"
|
||
exit 2
|
||
fi
|
||
|
||
cd tmp/var/www/${NAME}
|
||
|
||
tar -xvf /tmp/freenetis_packaging.tar.gz 1>/dev/null
|
||
|
||
if [ $? -ne 0 ]; then
|
||
echo "error during unpackaging"
|
||
exit 3
|
||
fi
|
||
|
||
rm /tmp/freenetis_packaging.tar.gz
|
||
|
||
cd ../../../
|
||
|
||
# remove dev parts of FN
|
||
rm -rf var/www/${NAME}/application/vendors/deb
|
||
rm -rf var/www/${NAME}/application/vendors/unit_tester
|
||
rm -rf var/www/${NAME}/application/controllers/unit_tester.php
|
||
rm -rf var/www/${NAME}/application/views/unit_tester
|
||
# remove hidden
|
||
rm -rf var/www/${NAME}/.htaccess
|
||
rm -rf var/www/${NAME}/config.php
|
||
rm -rf var/www/${NAME}/upload/*
|
||
rm -rf var/www/${NAME}/logs
|
||
rm -rf var/www/${NAME}/doc
|
||
# remove .svn
|
||
rm -rf `find var/www/${NAME} -type d -name .svn`
|
||
|
||
# count size
|
||
SIZE=`du -s var | cut -f1`
|
||
|
||
# calculate checksum ###########################################################
|
||
|
||
find * -type f ! -regex '^DEBIAN/.*' -exec md5sum {} \; >> DEBIAN/md5sums
|
||
|
||
# create info files ############################################################
|
||
|
||
# create package info
|
||
|
||
echo "Package: ${NAME}" >> DEBIAN/control
|
||
echo "Version: ${VERSION}" >> DEBIAN/control
|
||
echo "Installed-Size: ${SIZE}" >> DEBIAN/control
|
||
cat ../../control >> DEBIAN/control
|
||
|
||
# change log
|
||
|
||
cat ../../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 var/www/${NAME}/AUTHORS >> DEBIAN/copyright
|
||
echo "" >> DEBIAN/copyright
|
||
echo "License:" >> DEBIAN/copyright
|
||
cat var/www/${NAME}/COPYING >> DEBIAN/copyright
|
||
|
||
# scripts ######################################################################
|
||
|
||
cat ../../postinst >> DEBIAN/postinst
|
||
cat ../../postrm >> DEBIAN/postrm
|
||
cat ../../templates >> DEBIAN/templates
|
||
cat ../../config >> DEBIAN/config
|
||
|
||
chmod +x DEBIAN/postinst DEBIAN/postrm DEBIAN/config
|
||
|
||
# create deb ###################################################################
|
||
|
||
# change owner of files to root (security)
|
||
cd ..
|
||
sudo chown -hR root:root *
|
||
cd tmp
|
||
sudo chmod ugo+w var/www/${NAME} var/www/${NAME}/upload
|
||
sudo mkdir -m 0777 var/www/${NAME}/logs
|
||
|
||
# make package
|
||
cd ..
|
||
sudo dpkg-deb -b tmp ${NAME}_${VERSION}_all.deb
|
||
|
||
# clean-up mess ################################################################
|
||
|
||
# clean
|
||
sudo rm -rf tmp
|
Také k dispozici: Unified diff
Upravy:
- upravena hierarchie slozek pro generovani vice deb baliku (#147)
- pridan skript, ktery vola podskripty, ktere generuji jednotlive podbaliky