Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1595

Přidáno uživatelem Ondřej Fibich před více než 12 roky(ů)

Opravy:

- odstraneni chybnzch souboru v predchozim commitu

Zobrazit rozdíly:

freenetis/branches/testing/application/vendors/deb/freenetis-redir-qos_1/templates
Template: freenetis-redir-qos/path_freenetis
Type: string
Default: http://localhost/freenetis
Description: FreenetIS URL:
Base path to running FreenetIS instance (e.g. http://freenet.org/is)
Description-cs.UTF-8: FreenetIS URL:
Cesta ke kořenu běžící instalace FreenetISu (např. http://freenet.org/is)
Template: freenetis-redir-qos/input_interface
Type: string
Default: eth0
Description: Input interface:
Input interface on which redirection rules and QoS download are applicated on.
Description-cs.UTF-8: Vstupní rozhraní:
Vstupní rozhraní, na které jsou aplikována pravidla přesměrování a QoS download.
Template: freenetis-redir-qos/output_interface
Type: string
Default: eth0
Description: Output interface:
Output interface on which QoS upload is applicated on
Description-cs.UTF-8: Výstupní rozhraní:
Výstupní rozhraní, na které je aplikován QoS upload.
Template: freenetis-redir-qos/self_cancel_target_ip
Type: string
Default:
Description: Self cancel IP:
IP address which is use for self-canceling of the redirection directly by a redirected member.
Description-cs.UTF-8: IP adresa samozrušení
IP adresa, která je použita pro samozrušení přesměrování přesměrovaným členem.
freenetis/branches/testing/application/vendors/deb/freenetis-redir-qos_1/debianization.sh
#!/bin/sh
################################################################################
# Script for debianization of FreenetIS redirection and QoS 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-redir-qos
VERSION=$1
# 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 ../../../redirection/freenetis-redir-qos.init.sh etc/init.d/${NAME}
cp ../../../redirection/freenetis-qos-sync.sh usr/sbin/
cp ../../../redirection/freenetis-redir-sync.sh usr/sbin/
cp ../../../redirection/freenetis-redir-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
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 ../../../../../AUTHORS >> DEBIAN/copyright
echo "" >> DEBIAN/copyright
echo "License:" >> DEBIAN/copyright
cat ../../../../../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 *
# make package
sudo dpkg-deb -b tmp ${NAME}_${VERSION}_all.deb
# clean-up mess ################################################################
# clean
sudo rm -rf tmp
freenetis/branches/testing/application/vendors/deb/freenetis-redir-qos_1/changelog
freenetis-redirection (1.0.0~beta1) unstable; urgency=low
* First release
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 26 Jun 2012 21:28:47 +0200
freenetis/branches/testing/application/vendors/deb/freenetis-redir-qos_1/control
Priority: optional
Section: web
Pre-Depends: debconf (>= 0.5) | debconf-2.0
Depends: ipset, lighttpd
Suggests: freenetis
Architecture: all
Maintainer: Ondrej Fibich <ondrej.fibich@gmail.com>
Homepage: http://www.freenetis.org
Description: FreenetIS redirection and QoS
FreenetIS redirection and QoS is system which depends on FreenetIS for
restriction which is capable to:
- traffic restriction of clouds, subnets, members and IP address;
- QoS using ToS classes of IP.
freenetis/branches/testing/application/vendors/deb/freenetis-redir-qos_1/postrm
#!/bin/sh
# FreenetIS DEB: actions before uninstalling of package
set -e
. /usr/share/debconf/confmodule
NAME=freenetis-redir-qos
CONFIGFILE=/etc/freenetis/freenetis-redir-qos.conf
LIGHTTPD_CONFIGFILE=/etc/lighttpd/lighttpd.conf
# get lighttpd configuration to previous state
if [ -f "$LIGHTTPD_CONFIGFILE.before_fn_install" ]; then
mv $LIGHTTPD_CONFIGFILE.before_fn_install $LIGHTTPD_CONFIGFILE
fi
# disable startup from update-rc.d
update-rc.d -f ${NAME} remove
# 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 $CONFIGFILE
# remove dir if empty
[ "$(ls -A /etc/freenetis)" ] || rm -rf /etc/freenetis
fi
#DEBHELPER#
freenetis/branches/testing/application/vendors/deb/freenetis-redir-qos_1/conffiles
/etc/freenetis/freenetis-redir-qos.conf
freenetis/branches/testing/application/vendors/deb/freenetis-redir-qos_1/config
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
CONFIGFILE=/etc/freenetis/freenetis-redir-qos.conf
# Load config file, if it exists.
if [ -e $CONFIGFILE ]; then
. $CONFIGFILE || true
db_set freenetis-redir-qos/path_freenetis "$PATH_FN"
db_set freenetis-redir-qos/input_interface "$INPUT_INTERFACE"
db_set freenetis-redir-qos/output_interface "$OUTPUT_INTERFACE"
db_set freenetis-redir-qos/self_cancel_target_ip "$IP_TARGET"
fi
# Ask questions.
db_input critical freenetis-redir-qos/path_freenetis || true
db_input critical freenetis-redir-qos/input_interface || true
db_input critical freenetis-redir-qos/output_interface || true
db_input critical freenetis-redir-qos/self_cancel_target_ip || true
db_go || true
freenetis/branches/testing/application/vendors/deb/freenetis-redir-qos_1/postinst
#!/bin/bash
# FreenetIS-redir-qos DEB: actions after installing of package
set -e
. /usr/share/debconf/confmodule
NAME=freenetis-redir-qos
CONFIGFILE=/etc/freenetis/freenetis-redir-qos.conf
LIGHTTPD_CONFIGFILE=/etc/lighttpd/lighttpd.conf
# Quit if config file is missing.
if [ ! -e $CONFIGFILE ]; then
echo "$CONFIGFILE not founded!"
exit 1
fi
ip_regex='^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$'
url_regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
# 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-redir-qos/path_freenetis
PATH_FN="$RET"
db_get freenetis-redir-qos/input_interface
INPUT_INTERFACE="$RET"
db_get freenetis-redir-qos/output_interface
OUTPUT_INTERFACE="$RET"
db_get freenetis-redir-qos/self_cancel_target_ip
IP_TARGET="$RET"
# check path
if [ -z "$PATH_FN" ]; then
echo "Empty path to FreenetIS instance, configuration failed!"
exit 3
fi
# check path format
if [[ ! "$PATH_FN" =~ $url_regex ]]; then
echo "Wrong format of the path to FreenetIS instance, configuration failed!"
exit 3
fi
# check input iface
if [ -z "$INPUT_INTERFACE" ]; then
echo "Empty input interface, configuration failed!"
exit 3
fi
# check output iface
if [ -z "$OUTPUT_INTERFACE" ]; then
echo "Empty output interface, configuration failed!"
exit 3
fi
# check IP target
if [ -z "$IP_TARGET" ]; then
echo "Empty target IP for self-canceling, configuration failed!"
exit 3
fi
# check IP target format
if [[ ! "$IP_TARGET" =~ $ip_regex ]]; then
echo "Wrong format of the target IP for self-canceling, configuration failed!"
exit 3
fi
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 "$PATH_FN" || grep -Eq '^ *PATH_FN=' $CONFIGFILE || echo "PATH_FN=" >> $CONFIGFILE
PATH_FN_ESCAPED="${PATH_FN//\//\\/}"
sed -e "s/^ *PATH_FN=.*/PATH_FN=\"$PATH_FN_ESCAPED\"/" < $CONFIGFILE > $CONFIGFILE.tmp
test -z "$INPUT_INTERFACE" || grep -Eq '^ *INPUT_INTERFACE=' $CONFIGFILE || echo "INPUT_INTERFACE=" >> $CONFIGFILE
INPUT_INTERFACE_ESCAPED="${INPUT_INTERFACE//\//\\/}"
sed -e "s/^ *INPUT_INTERFACE=.*/INPUT_INTERFACE=\"$INPUT_INTERFACE_ESCAPED\"/" < $CONFIGFILE > $CONFIGFILE.tmp
test -z "$OUTPUT_INTERFACE" || grep -Eq '^ *OUTPUT_INTERFACE=' $CONFIGFILE || echo "OUTPUT_INTERFACE=" >> $CONFIGFILE
OUTPUT_INTERFACE_ESCAPED="${OUTPUT_INTERFACE//\//\\/}"
sed -e "s/^ *OUTPUT_INTERFACE=.*/OUTPUT_INTERFACE=\"$OUTPUT_INTERFACE_ESCAPED\"/" < $CONFIGFILE > $CONFIGFILE.tmp
test -z "$IP_TARGET" || grep -Eq '^ *IP_TARGET=' $CONFIGFILE || echo "IP_TARGET=" >> $CONFIGFILE
IP_TARGET_ESCAPED="${IP_TARGET//\//\\/}"
sed -e "s/^ *IP_TARGET=.*/IP_TARGET=\"$IP_TARGET_ESCAPED\"/" < $CONFIGFILE > $CONFIGFILE.tmp
mv -f $CONFIGFILE.tmp $CONFIGFILE
# Make post install things
# 1) Rights
# set rights
chmod 755 /etc/init.d/${NAME}
chmod +x /etc/init.d/${NAME}
chmod "a+x" /usr/sbin/freenetis-qos-sync.sh
chmod "a+x" /usr/sbin/freenetis-redir-sync.sh
# 2) Lighttpd
# configure lighttpd ###########################################################
cp -a -f $LIGHTTPD_CONFIGFILE $LIGHTTPD_CONFIGFILE.tmp
# bacup
cp -a -f $LIGHTTPD_CONFIGFILE $LIGHTTPD_CONFIGFILE.before_fn_install
# port redirect from
test -z "$PORT_REDIRECT" || grep -Eq '^ *server.port *=' $LIGHTTPD_CONFIGFILE || echo "server.port=" >> $LIGHTTPD_CONFIGFILE
PORT_REDIRECT_ESCAPED="${PORT_REDIRECT//\//\\/}"
sed -e "s/^ *server.port *=.*/server.port=\"$PORT_REDIRECT_ESCAPED\"/" < $LIGHTTPD_CONFIGFILE > $LIGHTTPD_CONFIGFILE.tmp
# append other config
# set config
mv -f $LIGHTTPD_CONFIGFILE.tmp $LIGHTTPD_CONFIGFILE
# restart #
/etc/init.d/lighttpd restart
# 3) Startup at boot
# set on fire after boot
update-rc.d ${NAME} defaults
# 4) Start
${NAME} start
exit 0

Také k dispozici: Unified diff