Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 5af3ffcf

Přidáno uživatelem Ondřej Fibich před téměř 11 roky(ů)

Moves from the main FreenetIS repository. Fixes #772: Error detected by lintian.

Zobrazit rozdíly:

LICENSE
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
FreenetIS QoS - QoS tool for FreenetIS
Copyright (C) 2013 FreenetIS
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
FreenetIS QoS Copyright (C) 2013 FreenetIS
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
README.md
- set priority of services (dedicated services may be set)
Data that are required are fetched dynamically from FreenetIS using wget tool.
For more informations see <http://wiki.freenetis.org/index.php/Instalace#Bal.C3.ADk_freenetis-qos>.
Changelog
---------
Changelog in debian format is available [here](deb/changelog).
deb/changelog
freenetis-qos (0.9.3) stable; urgency=low
* Improved building of ipset on squeeze (#454)
-- Ondrej Fibich <ondrej.fibich@gmail.com> Wed, 23 Jan 2013 14:24:32 +0100
freenetis-qos (0.9.2) stable; urgency=low
* Fixes in dependencies
-- Ondrej Fibich <ondrej.fibich@gmail.com> Mon, 13 Aug 2012 11:10:52 +0200
freenetis-qos (0.9.1) stable; urgency=low
* Fixes in postinst script
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 07 Aug 2012 15:59:41 +0200
freenetis-qos (0.9.0) stable; urgency=low
* First release
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 07 Aug 2012 15:05:33 +0200
deb/conffiles
/etc/freenetis/freenetis-qos.conf
/etc/init.d/freenetis-qos
deb/config
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
CONFIGFILE=/etc/freenetis/freenetis-qos.conf
# Load config file, if it exists.
if [ -e $CONFIGFILE ]; then
db_get freenetis-qos/hack_reload
if [ "$RET" = true ]; then
. $CONFIGFILE || true
db_set freenetis-qos/path_freenetis "$PATH_FN"
db_set freenetis-qos/input_interface "$INPUT_INTERFACE"
db_set freenetis-qos/output_interface "$OUTPUT_INTERFACE"
fi
fi
# h@ck for not reloading variables from config file (enabled again by postinst)
db_set freenetis-qos/hack_reload false
# Ask questions.
db_input critical freenetis-qos/path_freenetis || true
db_input critical freenetis-qos/input_interface || true
db_input critical freenetis-qos/output_interface || true
db_go || true
deb/control
Priority: optional
Section: web
Pre-Depends: debconf (>= 0.5) | debconf-2.0
Suggests: freenetis
Architecture: all
Maintainer: Ondrej Fibich <ondrej.fibich@gmail.com>
Homepage: http://www.freenetis.org
Description: FreenetIS QoS - QoS tool for FreenetIS
The tool is capable of:
* enforcing of download and upload rate of users (max and guaranteed)
* set priority of services (dedicated services may be set)
Data that are required are fetched dynamically from FreenetIS using wget tool.
Description-cs.UTF-8: FreenetIS QoS - QoS nástroj pro FreenetIS
Nástroj je schopný:
* vynutit rychlost downloadu a uploadu uživatelů (maximální and garantovanou)
* nastavit priritu služeb (dedikované služby mohou být nastaveny)
Data, která jsou nutná pro jsou získávány dynamicky z FreenetISu pomoví nástroje wget.
deb/debianization.sh
#!/bin/sh
################################################################################
# Script for debianization of FreenetIS redirection and QoS package
# (c) Ondrej Fibich, 2012
#
# Takes two arguments (version of package - FreenetIS and debian version).
#
################################################################################
if [ $# -ne 2 ]; then
echo "Wrong arg count.. Terminating"
exit 1
fi
NAME=freenetis-qos
VERSION=$1
DEBIAN=$2
# create dirs ##################################################################
mkdir -p deb_packages/tmp
cd deb_packages/tmp
mkdir -m 755 DEBIAN
mkdir -m 755 etc
mkdir -m 755 etc/init.d
mkdir -m 755 etc/freenetis
mkdir -m 755 usr
mkdir -m 755 usr/share
mkdir -m 755 usr/share/doc
mkdir -m 755 usr/share/doc/${NAME}
mkdir -m 755 usr/sbin
mkdir -m 755 usr/share/man
mkdir -m 755 usr/share/man/man8
# copy content of package ######################################################
cp ../../../freenetis-qos.init.sh etc/init.d/${NAME}
cp ../../../freenetis-qos-sync.sh usr/sbin/freenetis-qos-sync
cp ../../../freenetis-qos.conf etc/freenetis/
# doc ##########################################################################
# change log
cat ../../changelog >> usr/share/doc/${NAME}/changelog
# debian change log is same
cp usr/share/doc/${NAME}/changelog usr/share/doc/${NAME}/changelog.Debian
# copywriting
echo "This package was debianized by Ondrej Fibich <ondrej.fibich@gmail.com> on `date -R`" >> usr/share/doc/${NAME}/copyright
echo "It was downloaded from <http://freenetis.org/>\n" >> usr/share/doc/${NAME}/copyright
echo "Copyright:\n" >> usr/share/doc/${NAME}/copyright
echo " Copyright 2010-2013 Ondřej Fibich <ondrej.fibich@gmail.com>" >> usr/share/doc/${NAME}/copyright
echo " Copyright 2018-2013 Michal Kliment <kliment@freenetis.org>" >> usr/share/doc/${NAME}/copyright
echo " Copyright 2008-2012 Roman Ševčík <sevcik.roman@mail.unart.cz>" >> usr/share/doc/${NAME}/copyright
echo "\nLicense:\n" >> usr/share/doc/${NAME}/copyright
echo " This program is free software: you can redistribute it and/or modify" >> usr/share/doc/${NAME}/copyright
echo " it under the terms of the GNU General Public License as published by" >> usr/share/doc/${NAME}/copyright
echo " the Free Software Foundation, either version 3 of the License, or" >> usr/share/doc/${NAME}/copyright
echo " (at your option) any later version." >> usr/share/doc/${NAME}/copyright
echo "" >> usr/share/doc/${NAME}/copyright
echo " This program is distributed in the hope that it will be useful," >> usr/share/doc/${NAME}/copyright
echo " but WITHOUT ANY WARRANTY; without even the implied warranty of" >> usr/share/doc/${NAME}/copyright
echo " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" >> usr/share/doc/${NAME}/copyright
echo " GNU General Public License for more details." >> usr/share/doc/${NAME}/copyright
echo "" >> usr/share/doc/${NAME}/copyright
echo "On Debian systems, the complete text of the GNU General" >> usr/share/doc/${NAME}/copyright
echo "Public License can be found in \`/usr/share/common-licenses/GPL-3'.\n" >> usr/share/doc/${NAME}/copyright
echo -n "The Debian packaging is (C) `date +%Y`, Ondrej Fibich <ondrej.fibich@gmail.com> and" >> usr/share/doc/${NAME}/copyright
echo " it is licensed under the GPL, see above.\n" >> usr/share/doc/${NAME}/copyright
# man pages
cp ../../../man/freenetis-qos-sync.8 usr/share/man/man8/
# rights
chmod 644 usr/share/doc/${NAME}/changelog usr/share/doc/${NAME}/changelog.Debian \
usr/share/doc/${NAME}/copyright usr/share/man/man8/freenetis-qos-sync.8
# compress doc
gzip --best usr/share/doc/${NAME}/changelog
gzip --best usr/share/doc/${NAME}/changelog.Debian
gzip --best usr/share/man/man8/freenetis-qos-sync.8
# 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}" >> DEBIAN/control
echo "Installed-Size: ${SIZE}" >> DEBIAN/control
if [ "$DEBIAN" = lenny ] || [ "$DEBIAN" = squeeze ]; then
echo "Depends: coreutils (>= 6.10-6), ipset, wget (>= 1.11-4.1), procps, iptables, ipset-source, module-assistant, lsb-release" >> DEBIAN/control
else
echo "Depends: coreutils (>= 6.10-6), ipset, wget (>= 1.11-4.1), procps, iptables, lsb-release" >> DEBIAN/control
fi
cat ../../control >> DEBIAN/control
# scripts ######################################################################
cat ../../postinst >> DEBIAN/postinst
cat ../../prerm >> DEBIAN/prerm
cat ../../postrm >> DEBIAN/postrm
cat ../../templates >> DEBIAN/templates
cat ../../config >> DEBIAN/config
cp -a -f ../../conffiles DEBIAN/conffiles
chmod 644 DEBIAN/control DEBIAN/md5sums DEBIAN/templates DEBIAN/conffiles \
etc/freenetis/freenetis-qos.conf
chmod 755 DEBIAN/postinst DEBIAN/postrm DEBIAN/prerm DEBIAN/config \
etc/init.d/${NAME} usr/sbin/freenetis-qos-sync
# create deb ###################################################################
# change owner of files to root (security)
cd ..
fakeroot chown -hR root:root *
# make package
fakeroot dpkg-deb -b tmp ${NAME}_${VERSION}+${DEBIAN}.deb
# clean-up mess ################################################################
# clean
rm -rf tmp
deb/postinst
#!/bin/bash
# FreenetIS-qos DEB: actions after installing of package
set -e
. /usr/share/debconf/confmodule
NAME=freenetis-qos
CONFIGFILE=/etc/freenetis/freenetis-qos.conf
# Quit if config file is missing.
if [ ! -e $CONFIGFILE ]; then
echo "$CONFIGFILE not founded!"
exit 1
fi
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-qos/path_freenetis
PATH_FN="$RET"
db_get freenetis-qos/input_interface
INPUT_INTERFACE="$RET"
db_get freenetis-qos/output_interface
OUTPUT_INTERFACE="$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
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
test -z "$INPUT_INTERFACE" || grep -Eq '^ *INPUT_INTERFACE=' $CONFIGFILE || echo "INPUT_INTERFACE=" >> $CONFIGFILE
test -z "$OUTPUT_INTERFACE" || grep -Eq '^ *OUTPUT_INTERFACE=' $CONFIGFILE || echo "OUTPUT_INTERFACE=" >> $CONFIGFILE
PATH_FN_ESCAPED="${PATH_FN//\//\\/}"
INPUT_INTERFACE_ESCAPED="${INPUT_INTERFACE//\//\\/}"
OUTPUT_INTERFACE_ESCAPED="${OUTPUT_INTERFACE//\//\\/}"
sed -e "s/^ *PATH_FN=.*/PATH_FN=\"$PATH_FN_ESCAPED\"/" \
-e "s/^ *INPUT_INTERFACE=.*/INPUT_INTERFACE=\"$INPUT_INTERFACE_ESCAPED\"/" \
-e "s/^ *OUTPUT_INTERFACE=.*/OUTPUT_INTERFACE=\"$OUTPUT_INTERFACE_ESCAPED\"/" < $CONFIGFILE > $CONFIGFILE.tmp
mv -f $CONFIGFILE.tmp $CONFIGFILE
# Make post install things
# 1) Startup at boot
# set on fire after boot
update-rc.d freenetis-qos defaults
exit 0
deb/postrm
#!/bin/sh
# FreenetIS-qos DEB: actions before uninstalling of package
set -e
. /usr/share/debconf/confmodule
NAME=freenetis-qos
CONFIGFILE=/etc/freenetis/freenetis-qos.conf
# disable startup from update-rc.d
update-rc.d -f freenetis-qos 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
exit 0
deb/prerm
#!/bin/sh
# FreenetIS-qos DEB: actions before uninstalling of package
set -e
NAME=freenetis-qos
# stop daemon
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $NAME stop 3>/dev/null || true
else
/etc/init.d/$NAME stop 3>/dev/null || true
fi
exit 0
deb/templates
Template: freenetis-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-qos/input_interface
Type: string
Default: eth0
Description: Input interface:
Input interface on which QoS download rules are applicated on.
Description-cs.UTF-8: Vstupní rozhraní:
Vstupní rozhraní, na kterém jsou aplikována QoS download pravidla.
Template: freenetis-qos/output_interface
Type: string
Default: eth0
Description: Output interface:
Output interface on which QoS upload rules are applicated on
Description-cs.UTF-8: Výstupní rozhraní:
Výstupní rozhraní, na které je aplikován QoS upload pravidla.
Template: freenetis-qos/hack_reload
Type: boolean
Default: true
Description: Hack for propper working of loading package?
freenetis-qos.init.sh
exit 0
;;
restart)
restart|reload|force-reload) # reload is same thing as reload
stop_qos
start_qos
exit 0
man/freenetis-qos-sync.8
.\" Manpage for freenetis-redirection.
.\" Contact ondrej.fibich@gmail.com.in to correct errors or typos.
.TH man 8 "21 November 2013" "1.0" "freenetis-qos-sync man page"
.SH NAME
freenetis-qos-sync \- QoS policy demon for FreenetIS
.SH SYNOPSIS
freenetis-qos-sync
.SH DESCRIPTION
freenetis-qos-sync demon is a part of FreenetIS QoS and it serves for QoS policy of IS FreenetIS. This script should not be used directly.
.SH OPTIONS
The freenetis-qos-sync should not be run directly. It is commonly managed by an init.d script.
.SH AUTHOR
Michal Kliment <kliment@freenetis.org>,
Roman Sevcik <sevcik.roman@slfree.net>

Také k dispozici: Unified diff