parent
3b73cc1063
commit
caab1f7d30
@ -0,0 +1,132 @@ |
||||
+--------------+ |
||||
| setnet | |
||||
+--------------+ |
||||
|
||||
Copyleft (C) Vincenzo "KatolaZ" Nicosia <katolaz@freaknet.org> |
||||
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...... |
||||
|
||||
|
@ -0,0 +1,10 @@ |
||||
setnet for Debian |
||||
----------------- |
||||
|
||||
<this file describes information about the source package, see Debian policy |
||||
manual section 4.14. You WILL either need to modify or delete this file> |
||||
|
||||
|
||||
|
||||
-- Vincenzo (KatolaZ) Nicosia <katolaz@freaknet.org> Sat, 29 Apr 2017 11:13:55 +0100 |
||||
|
@ -0,0 +1,52 @@ |
||||
setnet (0.3.2-1) unstable; urgency=medium |
||||
|
||||
* Version 0.3.2 -- See ChangeLog for details |
||||
|
||||
-- Vincenzo (KatolaZ) Nicosia <katolaz@freaknet.org> 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 <katolaz@freaknet.org> 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 <katolaz@freaknet.org> 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 <katolaz@freaknet.org> 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 <katolaz@freaknet.org> Wed, 04 Jan 2017 18:52:56 +0000 |
@ -0,0 +1 @@ |
||||
9 |
@ -0,0 +1,19 @@ |
||||
Source: setnet |
||||
Section: unknown |
||||
Priority: optional |
||||
Maintainer: Vincenzo (KatolaZ) Nicosia <katolaz@freaknet.org> |
||||
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. |
||||
|
@ -0,0 +1,38 @@ |
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ |
||||
Upstream-Name: setnet |
||||
Source: <url://example.com> |
||||
|
||||
Files: * |
||||
Copyright: <years> <put author's name and email here> |
||||
<years> <likewise for another author> |
||||
License: <special license> |
||||
<Put the license of the package here indented by 1 space> |
||||
<This follows the format of Description: lines in control file> |
||||
. |
||||
<Including paragraphs> |
||||
|
||||
# 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 <katolaz@freaknet.org> |
||||
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 <http://www.gnu.org/licenses/> |
||||
. |
||||
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. |
@ -0,0 +1,3 @@ |
||||
notes.txt |
||||
README.md |
||||
TODO.org |
@ -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: <Enter a short description of the software> |
||||
# Description: <Enter a long description of the software> |
||||
# <...> |
||||
# <...> |
||||
### END INIT INFO |
||||
|
||||
# Author: Vincenzo (KatolaZ) Nicosia <katolaz@freaknet.org> |
||||
|
||||
# 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 |
||||
|
||||
: |
@ -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/ |
@ -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) |
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1 @@ |
||||
3.0 (quilt) |
@ -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 |
||||
# <Webpage URL> <string match> |
||||
#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 |
Loading…
Reference in new issue