From caab1f7d3027403f03fae289629b7a2c2ae733b7 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Sat, 29 Apr 2017 11:24:38 +0100 Subject: new devuan package for experimental --- debian/README.Debian | 132 ++++++++++++++++++++++++++++++++++++++++ debian/README.source | 10 ++++ debian/changelog | 52 ++++++++++++++++ debian/compat | 1 + debian/control | 19 ++++++ debian/copyright | 38 ++++++++++++ debian/docs | 3 + debian/init.d.ex | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++ debian/install | 5 ++ debian/rules | 32 ++++++++++ debian/source/format | 1 + debian/watch.ex | 23 +++++++ 12 files changed, 482 insertions(+) create mode 100644 debian/README.Debian create mode 100644 debian/README.source create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/init.d.ex create mode 100644 debian/install create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/watch.ex (limited to 'debian') diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..0cad044 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,132 @@ ++--------------+ +| setnet | ++--------------+ + +Copyleft (C) Vincenzo "KatolaZ" Nicosia + 2016, 2017 + +=== DESCRIPTION === + +setnet is a shell script with a dialog UI to configure ethernet and +wifi connections. It is meant to be POSIX-compliant, and has been +tested with bash, busybox, dash, ksh, mksh, posh, and yash. It is +still to be considered beta software, so you should use it AT YOUR OWN +RISK, but it is already fully functional. + +=== LICENSE === + +setnet is Free Software, and can be used and distributed under the +terms of the GNU General Public License, either version 3 of the +licence or, at your option, any later version. + +Please see the file LICENSE for more information + +=== DEPENDENCIES === + +In order to run setset, you MUST satisfy this (relatively small) set +of dependencies: + + - a posix-compliant shell (bash, busybox, dash, ksh, mksh, posh, and + yash have been tested) + + - dialog (version 1.2 tested, but it should work with previous + versions as well) + + - dhcp-client (for dhclient, tested with isc-dhcp-client) + + - iproute2 (for ip) + + - wireless-tools (for iwconfig, currently required for interface + identification) + +Most of those tools might already be installed in your system anyway. +In particular, setnet uses: + + - dialog: to provide a minimal Text-based User Interface, + - ip: to configure network interfaces and get information about them, + - dhclient: for DHCP-based IP configuration + - iwconfig: to check whether a network device is a wifi adapter + +In order to use the full set of functionalities provided by setnet, +you MIGHT also need the following packages: + + - wpa_supplicant (for wifi configuration) + + - net-tools (for netstat, to gather information about network status) + + - iputils-ping (for ping) + + - bind9-nost (for host, used to check DNS configuration) + + - traceroute (to trace the route between your host and any other host + in the Internet) + +Again, most of them should be already installed in your system anyway. + +=== USAGE === + +setnet is installed under /usr/sbin/setnet.sh. If invoked with "-h", +it provides a list of supported options: + +$ ./setnet.sh -h +Usage: setnet.sh [OPTION] +Options: + -c cfg_file Load configuration from cfg_file. + -v Print version number and exit. + -h Show this help. +$ + +If the argument "-c" is specified, setnet will use the provided +configuration file. Otherwise, it will look for its configuration file +in one of the following locations: + + - /etc/setnetrc + - ~/.setnetrc + +in the given order. The following configuration variables should be +defined in setnetrc: + + + - WPA_FILE + This is the file configuration file used by wpa_supplicant. + + - LOGNAME + This is the file used for logging. + + - TRUNCATE_LOG + if equal to "yes", the log file will be truncated when setnet + starts + + +=== root vs. mortal users === + +Networking is an amdinistration task, and as such should be performed +by the host administrator, i.e., the user with UID 0 (normally called +"root"). However, in many modern GNU/Linux systems it is customary to +allow normal users to perform some administration tasks. There are at +least two concrete possibilities to allow a particular user (in the +following we call such user "fool") to configure network interfaces +using setnet. + + +-- 1) First approach: using sudo + +If sudo is installed in your system, it is sufficient to add the +following line: + + fool ALL=NOPASSWD: /usr/sbin/setnet.sh + +to the file /etc/sudoers, and the user "fool" will be able to run +setnet.sh with effective UID 0 (i.e., as if it was root), by using the +command: + +[fool@host]$ sudo /usr/sbin/setnet.sh + +and thus will be able to perform all the needed admin tasks to +configure networking. + +-- 2) Second approach: using sup + +......TO BE DOCUMENTED...... + + diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000..7c8fb9c --- /dev/null +++ b/debian/README.source @@ -0,0 +1,10 @@ +setnet for Debian +----------------- + + + + + + -- Vincenzo (KatolaZ) Nicosia Sat, 29 Apr 2017 11:13:55 +0100 + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..9aaaa89 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,52 @@ +setnet (0.3.2-1) unstable; urgency=medium + + * Version 0.3.2 -- See ChangeLog for details + + -- Vincenzo (KatolaZ) Nicosia Wed, 08 Mar 2017 11:45:45 +0000 + +setnet (0.3.1-1) unstable; urgency=medium + + * Version 0.3.1 -- See ChangeLog for details + + -- Vincenzo (KatolaZ) Nicosia Tue, 07 Mar 2017 11:29:07 +0000 + +setnet (0.3-1) unstable; urgency=medium + + * Version 0.3 -- See ChangeLog for details + + -- Vincenzo (KatolaZ) Nicosia Sun, 29 Jan 2017 15:43:35 +0000 + +setnet (0.2.1-1) unstable; urgency=medium + + + * Version 0.2.1 -- See ChangeLog for details + + -- Vincenzo (KatolaZ) Nicosia Sat, 07 Jan 2017 23:29:44 +0000 + +setnet (0.2-1) unstable; urgency=medium + + * Initial release (20170104) + + == Major Changes == + + + Polished code to make it posix-shell compliant + + + Tested with bash, busybox, dash, ksh, mksh, posh, yash + + + Added support and checks for hard, soft, and optional + dependencies + + + Added standard command line options (-c, -h, -v) + + + Added submenu "Info" with basic network testing tools + + + Added submenu "Dump" to dump network information to a file + + + Added submenu "Log" (shows setnet logfile) + + + Added status information in device configuration panel + + + Added minimal README.Debian file + + + -- Vincenzo (KatolaZ) Nicosia Wed, 04 Jan 2017 18:52:56 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..4070ca4 --- /dev/null +++ b/debian/control @@ -0,0 +1,19 @@ +Source: setnet +Section: unknown +Priority: optional +Maintainer: Vincenzo (KatolaZ) Nicosia +Build-Depends: debhelper (>=9) +Standards-Version: 3.9.8 +Homepage: http://kalos.mine.nu/setnet +#Vcs-Git: git://anonscm.debian.org/collab-maint/setnet.git +#Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/setnet.git + +Package: setnet +Architecture: all +Depends: bash | busybox | dash | ksh | mksh | posh | yash | zsh, dhcp-client, dialog, iproute2, iw +Suggests: wpasupplicant, pastebinit, net-tools, iputils-ping, bind9-host, traceroute +Description: simple shell/dialog tool to configure networks + setnet is a shell script with a dialog UI to configure ethernet + and wifi connections. It is meant to be POSIX-compliant, and has + been tested on bash, busybox, dash, ksh, mksh, posh, yash, and zsh. + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..efdd21d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,38 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: setnet +Source: + +Files: * +Copyright: + +License: + + + . + + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: debian/* +Copyright: 2017 Vincenzo (KatolaZ) Nicosia +License: GPL-2+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid to pick license terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..770ae9a --- /dev/null +++ b/debian/docs @@ -0,0 +1,3 @@ +notes.txt +README.md +TODO.org diff --git a/debian/init.d.ex b/debian/init.d.ex new file mode 100644 index 0000000..34620c4 --- /dev/null +++ b/debian/init.d.ex @@ -0,0 +1,166 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: setnet +# Required-Start: $local_fs $network $remote_fs $syslog +# Required-Stop: $local_fs $network $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: +# Description: +# <...> +# <...> +### END INIT INFO + +# Author: Vincenzo (KatolaZ) Nicosia + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="setnet" +NAME=setnet +DAEMON=/usr/sbin/setnet +DAEMON_ARGS="" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 + # The above code will not work for interpreted scripts, use the next + # six lines below instead (Ref: #643337, start-stop-daemon(8) ) + #start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \ + # --name $NAME --test > /dev/null \ + # || return 1 + #start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \ + # --name $NAME -- $DAEMON_ARGS \ + # || return 2 + + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..dab18fe --- /dev/null +++ b/debian/install @@ -0,0 +1,5 @@ +setnet.sh /usr/sbin +setnetrc /etc/ +wpa_setnet.conf /etc/wpa_supplicant/ +setnet.8.gz /usr/share/man/man8/ +ChangeLog /usr/share/doc/setnet/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..ce15cce --- /dev/null +++ b/debian/rules @@ -0,0 +1,32 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#DH_VERBOSE = 1 + +# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/default.mk + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +# main packaging script based on dh7 syntax +%: + dh $@ + +# debmake generated override targets +# This is example for Cmake (See http://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- \ +# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + + + + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/watch.ex b/debian/watch.ex new file mode 100644 index 0000000..8efa24e --- /dev/null +++ b/debian/watch.ex @@ -0,0 +1,23 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# See uscan(1) for format + +# Compulsory line, this is a version 3 file +version=3 + +# Uncomment to examine a Webpage +# +#http://www.example.com/downloads.php setnet-(.*)\.tar\.gz + +# Uncomment to examine a Webserver directory +#http://www.example.com/pub/setnet-(.*)\.tar\.gz + +# Uncommment to examine a FTP server +#ftp://ftp.example.com/pub/setnet-(.*)\.tar\.gz debian uupdate + +# Uncomment to find new files on sourceforge, for devscripts >= 2.9 +# http://sf.net/setnet/setnet-(.*)\.tar\.gz + +# Uncomment to find new files on GooglePages +# http://example.googlepages.com/foo.html setnet-(.*)\.tar\.gz -- cgit v1.2.3