diff options
-rw-r--r-- | LICENSE | 20 | ||||
-rw-r--r-- | Makefile | 73 | ||||
-rw-r--r-- | NEWS | 174 | ||||
-rw-r--r-- | README | 29 | ||||
-rw-r--r-- | config/iftab | 20 | ||||
-rw-r--r-- | config/netcfg | 16 | ||||
-rw-r--r-- | contrib/PKGBUILD | 31 | ||||
-rwxr-xr-x | contrib/iptables.hook | 17 | ||||
-rwxr-xr-x | contrib/logging.hook | 86 | ||||
-rwxr-xr-x | contrib/pm-utils.handler | 73 | ||||
-rw-r--r-- | contrib/zsh-completion | 52 | ||||
-rw-r--r-- | docs/Makefile | 19 | ||||
-rw-r--r-- | docs/examples/openvpn | 5 | ||||
-rw-r--r-- | docs/examples/ppp | 4 | ||||
-rw-r--r-- | docs/features.txt | 147 | ||||
-rw-r--r-- | docs/footer.txt | 22 | ||||
-rw-r--r-- | docs/index.txt | 57 | ||||
-rw-r--r-- | docs/netctl.1.txt (renamed from docs/netcfg.8.txt) | 0 | ||||
-rw-r--r-- | docs/netctl.profile.5.txt (renamed from docs/netcfg-profiles.5.txt) | 0 | ||||
-rwxr-xr-x | rc.d/net-auto-wired | 62 | ||||
-rwxr-xr-x | rc.d/net-auto-wireless | 61 | ||||
-rwxr-xr-x | rc.d/net-profiles | 55 | ||||
-rwxr-xr-x | rc.d/net-rename | 28 | ||||
-rw-r--r-- | rc.d/net-set-variable | 10 | ||||
-rwxr-xr-x | scripts/netcfg-daemon | 102 | ||||
-rwxr-xr-x | scripts/netcfg-menu | 55 | ||||
-rwxr-xr-x | scripts/pm-utils | 26 | ||||
-rw-r--r-- | services/netctl-auto@.service (renamed from systemd/net-auto-wireless.service) | 0 | ||||
-rw-r--r-- | services/netctl-ifplugd@.service (renamed from systemd/net-auto-wired.service) | 0 | ||||
-rw-r--r-- | services/netctl.service (renamed from systemd/netcfg.service) | 0 | ||||
-rw-r--r-- | services/netctl@.service (renamed from systemd/netcfg@.service) | 0 | ||||
-rw-r--r-- | src/connections/openvpn | 52 | ||||
-rw-r--r-- | src/connections/ppp | 31 | ||||
-rwxr-xr-x | src/hooks/fancy | 90 | ||||
-rwxr-xr-x | src/hooks/initscripts | 35 | ||||
-rwxr-xr-x | src/ifplugd.action (renamed from scripts/ifplugd.action) | 0 | ||||
-rw-r--r-- | src/lib/8021x (renamed from src/8021x) | 0 | ||||
-rwxr-xr-x | src/lib/auto.action (renamed from scripts/netcfg-wpa_actiond-action) | 0 | ||||
-rw-r--r-- | src/lib/connections/README | 28 | ||||
-rw-r--r-- | src/lib/connections/bond (renamed from src/connections/bond) | 0 | ||||
-rw-r--r-- | src/lib/connections/bridge (renamed from src/connections/bridge) | 0 | ||||
-rw-r--r-- | src/lib/connections/ethernet (renamed from src/connections/ethernet) | 0 | ||||
-rw-r--r-- | src/lib/connections/pppoe (renamed from src/connections/pppoe) | 0 | ||||
-rw-r--r-- | src/lib/connections/tunnel (renamed from src/connections/tunnel) | 0 | ||||
-rw-r--r-- | src/lib/connections/tuntap (renamed from src/connections/tuntap) | 0 | ||||
-rw-r--r-- | src/lib/connections/vlan (renamed from src/connections/vlan) | 0 | ||||
-rw-r--r-- | src/lib/connections/wireless (renamed from src/connections/wireless) | 0 | ||||
-rw-r--r-- | src/lib/globals (renamed from src/globals) | 0 | ||||
-rw-r--r-- | src/lib/network (renamed from src/network) | 0 | ||||
-rw-r--r-- | src/lib/rfkill (renamed from src/rfkill) | 0 | ||||
-rwxr-xr-x | src/netctl (renamed from scripts/netcfg) | 0 | ||||
-rwxr-xr-x | src/netctl-auto (renamed from scripts/netcfg-wpa_actiond) | 0 | ||||
-rwxr-xr-x | src/wifi-menu (renamed from scripts/wifi-menu) | 0 |
53 files changed, 87 insertions, 1393 deletions
diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 4cb113c..0000000 --- a/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2007, James Rayner - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -Neither the name of the Arch Linux nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -1,74 +1,53 @@ -export VERSION = 3.1 +export VERSION = 0.1 -.PHONY: install install-docs docs tarball pkgbuild upload clean +.PHONY: install install-docs docs tarball pkgbuild clean install: install-docs # Configuration files - install -d $(DESTDIR)/etc/network.d/{examples,interfaces} - install -Dm644 config/netcfg $(DESTDIR)/etc/conf.d/netcfg - install -m644 config/iftab $(DESTDIR)/etc/iftab + install -d $(DESTDIR)/etc/network.d/{examples,hooks,interfaces} install -m644 docs/examples/* $(DESTDIR)/etc/network.d/examples/ # Libs - install -d $(DESTDIR)/usr/lib/network/{connections,hooks} - install -m644 src/{network,rfkill,8021x,globals} $(DESTDIR)/usr/lib/network/ - install -m755 src/connections/* $(DESTDIR)/usr/lib/network/connections/ - # Hooks - install -m755 src/hooks/* $(DESTDIR)/usr/lib/network/hooks/ + install -d $(DESTDIR)/usr/lib/network/connections + install -m644 src/lib/{8021x,globals,ip,rfkill} $(DESTDIR)/usr/lib/network/ + install -m644 src/lib/connections/* $(DESTDIR)/usr/lib/network/connections/ + install -m755 src/lib/{auto.action,network} $(DESTDIR)/usr/lib/network/ # Scripts install -d $(DESTDIR)/usr/bin install -m755 \ - scripts/netcfg \ - scripts/netcfg-daemon \ - scripts/netcfg-menu \ - scripts/netcfg-wpa_actiond \ - scripts/netcfg-wpa_actiond-action \ - scripts/wifi-menu \ + src/netctl \ + src/netctl-auto \ + src/wifi-menu \ $(DESTDIR)/usr/bin/ - install -Dm755 scripts/ifplugd.action $(DESTDIR)/etc/ifplugd/netcfg.action - install -Dm755 scripts/pm-utils $(DESTDIR)/usr/lib/pm-utils/sleep.d/50netcfg - # Daemons - install -Dm755 rc.d/net-set-variable $(DESTDIR)/etc/rc.d/functions.d/net-set-variable - install -m755 \ - rc.d/net-profiles \ - rc.d/net-rename \ - rc.d/net-auto-wired \ - rc.d/net-auto-wireless \ - $(DESTDIR)/etc/rc.d/ + install -Dm755 src/ifplugd.action $(DESTDIR)/etc/ifplugd/netctl.action + # Services install -d $(DESTDIR)/usr/lib/systemd/system - install -m644 \ - systemd/*.service \ - $(DESTDIR)/usr/lib/systemd/system/ + install -m644 services/*.service $(DESTDIR)/usr/lib/systemd/system/ install-docs: docs - install -d $(DESTDIR)/usr/share/man/{man5,man8} + install -d $(DESTDIR)/usr/share/man/{man1,man5,man7} + install -m644 docs/*.1 $(DESTDIR)/usr/share/man/man1/ install -m644 docs/*.5 $(DESTDIR)/usr/share/man/man5/ - install -m644 docs/*.8 $(DESTDIR)/usr/share/man/man8/ - install -d $(DESTDIR)/usr/share/doc/netcfg/contrib - install -m644 contrib/{*.hook,pm-utils.handler} $(DESTDIR)/usr/share/doc/netcfg/contrib/ + install -m644 docs/*.7 $(DESTDIR)/usr/share/man/man7/ docs: $(MAKE) -C $@ -tarball: netcfg-$(VERSION).tar.xz -netcfg-$(VERSION).tar.xz: | docs - cp scripts/netcfg{,.orig} - sed -i "s/NETCFG_VER=.*/NETCFG_VER=$(VERSION)/" scripts/netcfg +tarball: netctl-$(VERSION).tar.xz +netctl-$(VERSION).tar.xz: | docs + cp src/netctl{,.orig} + sed -i "s/NETCTL_VERSION=.*/NETCTL_VERSION=$(VERSION)/" src/netctl git stash save -q - git archive -o netcfg-$(VERSION).tar --prefix=netcfg-$(VERSION)/ stash + git archive -o netctl-$(VERSION).tar --prefix=netctl-$(VERSION)/ stash git stash pop -q - mv scripts/netcfg{.orig,} - tar --exclude-vcs --transform "s%^%netcfg-$(VERSION)/%" --owner=root --group=root --mtime=./netcfg-$(VERSION).tar -rf netcfg-$(VERSION).tar docs/*.[1-8] - xz netcfg-$(VERSION).tar + mv src/netctl{.orig,} + tar --exclude-vcs --transform "s%^%netctl-$(VERSION)/%" --owner=root --group=root --mtime=./netctl-$(VERSION).tar -rf netctl-$(VERSION).tar docs/*.[1-8] + xz netctl-$(VERSION).tar pkgbuild: PKGBUILD -PKGBUILD: netcfg-$(VERSION).tar.xz +PKGBUILD: netctl-$(VERSION).tar.xz sed -e "s/%pkgver%/$(VERSION)/" -e "s/%md5sum%/$(shell md5sum $< | cut -d ' ' -f 1)/" contrib/PKGBUILD > $@ -upload: netcfg-$(VERSION).tar.xz - md5sum $< > MD5SUMS.$(VERSION) - scp $< MD5SUMS.$(VERSION) gerolde.archlinux.org:/srv/ftp/other/netcfg/ - clean: $(MAKE) -C docs clean - -@rm -vf PKGBUILD *.xz MD5SUMS.* 2>/dev/null + -@rm -vf PKGBUILD *.xz 2>/dev/null @@ -1,172 +1,2 @@ -version 3.1 -- reword systemd service descriptions -- fix support for 'last' when using systemd -- fix support for 'options' in /etc/resolv.conf - -version 3.0 -- drop a version number digit -- add support for 'options' in /etc/resolv.conf -- update rfkill implementation -- fix bond connections (FS#31770) -- assorted fixes - -version 2.8.11 -- add IPv6 support for PPPoE connections -- use a workound for a unit stopping bug in systemd - -version 2.8.10 -- allow hex passphrases in wifi-menu -- ifplugd path change for net-auto-wired (FS#31340) - -version 2.8.9 -- add priority support to net-auto-wireless (FS#30737) -- fix wifi-menu key handling (FS#31057) -- add systemd net-profiles symlink for compatibility - -version 2.8.8 -- fix killing wpa_actiond (FS#30664) -- fix tuntap without an IP (FS#30638) - -version 2.8.7 -- Fixed parsing of GROUP= part of ctrl_interface for custom wifi configurations - -version 2.8.6 -- Fixed key limitation test in wifi-menu -- Improved responsiveness for wireless networking -- Revised logic for wpa_supplicant configurations with non-standard control paths -- Code cleanup - -version 2.8.5 -- Provide the ability to start the last used profile (FS#23015) -- Support weird characters in wifi-menu (FS#30342) and elsewhere -- Fix net-auto-wired.service (FS#30348) -- Introduce polling timeout logic -- Increase default carrier timeout (FS#30361) - -version 2.8.4 -- fixed wait for wifi scan results (FS#29946) -- PPPoE default to noauth (FS#30016) -- stop waiting longer than necessary when bringing an interface up - -version 2.8.3 -- Duplicate Address Detection is dealt with for IPv6 users (FS#28887) - NOTE: IPCFG is now processed after IPv6 address set-up -- additional attributes in ADDR6 and ROUTES6 entries are now allowed -- initscripts sh compatibility is restored (FS#29880) -- a bonding documentation error is fixed (FS#29918) - -version 2.8.2 -- netcfg now has a website: www.archlinux.org/netcfg/ -- replace routes in IPv6 by default (FS#29480) -- fixes: pm-utils support is back, systemd improvements, documentation, FS#28522 - -version 2.8.1 -- add compatibility for configuration in /etc/rc.conf - give users time to move to the new scheme -- fix support for the kernel command line -- give initscripts users more familiar output - -version 2.8.0 -- end support for wireless-dbus and ethernet-iproute syntax - use wireless and ethernet instead -- end support for configuration in /etc/rc.conf - use /etc/conf.d/netcfg instead -- add sample script demonstrating firewall location handling (FS#26380) -- drop implicit dependency on initscripts -- add systemd service file for profiles (netcfg@<profile>.service) -- add systemd service file for NETWORKS array in /etc/conf.d/netcfg (netcfg.service) -- assorted fixes (FS#20569, FS#28138, FS#28590, FS#28683) - -version 2.7.3 -- fix dhcpcd to not remove/re-acquire a lease unnecessarily -- fix sysctl parameters for interfaces with vlans (FS#26259) - -version 2.7.2 -- fix bash completion -- discontinue "-old" connections - -version 2.7 -- add support for tunnel interfaces -- add support for interface bonding (FS#24802) -- add support for hexadecimal ESSIDs (FS#24333) -- add support for PPPoE connections -- add support for profile backgrounding in net-profiles (FS#23934) -- add interactive wifi connection tool wifi-menu -- add netcfg option to reconnect an interface (-R) (FS#28196) -- rename the option to disconnect an interface (was: -i, now: -D) -- stop suggesting profile-scripting through /etc/network.d/hooks as it was - unused and the {PRE,POST}_{UP,DOWN} variables work just fine (FS#27496) -- assorted fixes (FS#24599, FS#26370, FS#26607, FS#28022) - -version 2.6.8 -- fix broken 802.11 in non-wireless setups (FS#25473) -- fix rfkill errors in net-auto-wireless (FS#25514) -- fix error message about non-existing net.ipv6.conf... (FS#25530) - -version 2.6.7 -- fix wrong quoting of $profile (FS#25362) -- fix wrong parsing of wpa_supplicant configuration (FS#25464) -- fix conflict with old ROUTES variable (FS#25432) - -version 2.6.6 -- fix wrong rc scripts names in suspend hook (FS#20330) -- fix wireless failure when using wpa-config and a custom - ctrl_interface path (FS#24929) -- bash-completion: add -r to option list (FS#25188) - -version 2.6.5 -- specify device name explicitly when setting gateways - -version 2.6.4 -- documentation update, new man page "netcfg-profiles" -- modify wireless workflow to avoid issues with association - -version 2.6.3 -- fix infinite symlink loop (FS#25077) - -version 2.6.2 -- fix broken WEP support (FS#24896) -- fix dhcpcd/dhclient not stopped properly (FS#23293) -- fix specifying access point by BSSID (FS#24906) - -version 2.6.1 -- fix missing mkdir for net-auto-wireless -- add basic configuration capabilities to tun/tap interfaces - -version 2.6 -- add support for IPv6 configuration (FS#18699) -- add support for static routes configuration (FS#18700) -- add support for creating tun/tap interfaces (FS#15049) -- add configuration file /etc/conf.d/netcfg for net-auto-wireless -- add support for restricting automatic startup of profiles (FS#23169) -- bridge: add support for several brctl options (FS#16625) -- wireless: add support for explicit BSSID (FS#24582) -- wireless: add support for ad-hoc connections (FS#19683) -- wireless: no longer require wireless_tools to work -- use /run instead of /var/run -- drops hard dependency on net-tools package -- drops hard dependency on wireless_tools package - -version 2.5.5 -- new connection types: openvpn (FS#21490), vlan -- new option HIDDEN (for hidden SSIDs) -- new option SKIPNOCARRIER (FS#21755) -- default WPA driver is now nl80211 -- minor fixes and improvements (FS#17190, FS#17546, - FS#20150, FS#20569, FS#21377, FS#23293) -- better zsh completion file (FS#19823) - -netcfg 2.5.4 -- new connection type: bridge -- new option NETMASK for ethernet - -netcfg 2.5.3 -- fixes to rfkill handling (FS#18391, FS#18385) -- fix for FS#18411 - -netcfg 2.5.2 -- fix for FS#17190 - -netcfg 2.5.1 -- fix for FS#17190 -- additional examples +netctl 0.1 +- forked from netcfg 3.1 and changed considerably @@ -1,26 +1,23 @@ Dependencies: -- Linux +- systemd - Bash 4.x - GNU Coreutils - iproute2 -- dialog: for interactive menu -- ifplugd: for automatic connection -- wireless_tools: for net_rename - -For DHCP support: -- dhcpcd -- dhclient (for DHCPv6) +- resolvconf -For wireless support: -- wpa_supplicant +Optional: +- dhcpcd or dhclient: for DHCP support +- wpa_supplicant: for WPA support +- dialog: for the interactive assistant +- ifplugd: for automatic connection - wpa_actiond: for automatic connection - -For bonding support -- ifenslave - -For bridge support: -- bridge-utils +- ifenslave: for bonding support +- bridge-utils: for bridge support For documentation generation: - asciidoc +Naming Conventions for Variables: +end-user variables - CamelCase +local variables - lower_case +other variables - UPPER_CASE diff --git a/config/iftab b/config/iftab deleted file mode 100644 index e016644..0000000 --- a/config/iftab +++ /dev/null @@ -1,20 +0,0 @@ -# Example iftab - -# Format: {New name} {Criteria} - -# Match on driver -#ipw0 driver ipw2100 -#eth9 driver ndiswrapper -#rl0 driver 8139too - -# Match on MAC address -#wlan0 mac 00:11:22:33:44:%5 -#eth1 mac 11:22:33:44:55:66 - -# Match on sysfs attribute -#myvpn SYSFS{address} 00:10:83:* - -# Automatically number -#eth* ipw2100 - -## More examples in 'man iftab' diff --git a/config/netcfg b/config/netcfg deleted file mode 100644 index 59ee57c..0000000 --- a/config/netcfg +++ /dev/null @@ -1,16 +0,0 @@ -# Enable these netcfg profiles at boot time. -# - prefix an entry with a '@' to background its startup -# - set to 'last' to restore the profiles running at the last shutdown -# - set to 'menu' to present a menu (requires the dialog package) -# Network profiles are found in /etc/network.d -NETWORKS=(last) - -# Specify the name of your wired interface for net-auto-wired -WIRED_INTERFACE="eth0" - -# Specify the name of your wireless interface for net-auto-wireless -WIRELESS_INTERFACE="wlan0" - -# Array of profiles that may be started by net-auto-wireless. -# When not specified, all wireless profiles are considered. -#AUTO_PROFILES=("profile1" "profile2") diff --git a/contrib/PKGBUILD b/contrib/PKGBUILD index 9ccc600..e743bfe 100644 --- a/contrib/PKGBUILD +++ b/contrib/PKGBUILD @@ -1,37 +1,32 @@ # Maintainer: Jouke Witteveen <j.witteveen@gmail.com> -pkgname=netcfg +pkgname=netctl pkgver=%pkgver% pkgrel=1 pkgdesc="Network configuration and profile scripts" -url="http://archlinux.org/netcfg/" -license=("BSD") -backup=(etc/iftab etc/conf.d/netcfg) -groups=(base) -depends=("coreutils" "dhcpcd" "iproute2") +url="http://archlinux.org/netctl/" +license=("GPL") +depends=("coreutils" "iproute2" "openresolv") #makedepends=('asciidoc') # The source tarball includes pre-built documentation. -optdepends=('dialog: for the menu based profile and wifi selectors' +optdepends=('dialog: for the menu based wifi assistant' + 'dhclient: for DHCP support (or dhcpcd)' + 'dhcpcd: for DHCP support (or dhclient)' 'wpa_supplicant: for wireless networking support' - 'ifplugd: for automatic wired connections through net-auto-wired' - 'wpa_actiond: for automatic wireless connections through net-auto-wireless' - 'wireless_tools: for interface renaming through net-rename' + 'ifplugd: for automatic wired connections through netctl-ifplugd' + 'wpa_actiond: for automatic wireless connections through netctl-auto' 'ifenslave: for bond connections' 'bridge-utils: for bridge connections' ) -source=(ftp://ftp.archlinux.org/other/netcfg/netcfg-${pkgver}.tar.xz) +conflicts=("netcfg") +source=(ftp://ftp.archlinux.org/other/netctl/netctl-${pkgver}.tar.xz) arch=(any) md5sums=('%md5sum%') package() { - cd "$srcdir/netcfg-${pkgver}" + cd "$srcdir/netctl-${pkgver}" make DESTDIR="$pkgdir" install - install -D -m644 LICENSE "$pkgdir/usr/share/licenses/netcfg/LICENSE" # Shell Completion - install -D -m644 contrib/bash-completion "$pkgdir/usr/share/bash-completion/completions/netcfg" - install -D -m644 contrib/zsh-completion "$pkgdir/usr/share/zsh/site-functions/_netcfg" - - # Compatibility - ln -s netcfg.service "$pkgdir/usr/lib/systemd/system/net-profiles.service" + install -D -m644 contrib/bash-completion "$pkgdir/usr/share/bash-completion/completions/netctl" } diff --git a/contrib/iptables.hook b/contrib/iptables.hook deleted file mode 100755 index 95546ba..0000000 --- a/contrib/iptables.hook +++ /dev/null @@ -1,17 +0,0 @@ -### Sample netcfg hook script for location based firewall rules. -### To install, make this executable and put it in /usr/lib/network/hooks - -### USAGE -## You need to have iptables installed to use this script. -## Add a location to your network profile and add firewall to your POST_UP. -## The iptables setup in /etc/iptables/$LOCATION.rules will now be loaded -## automatically when a connection is established. -## -## Sample excerpt from the profile: -## LOCATION="library" -## POST_UP="firewall" - -function firewall { - /usr/sbin/iptables-restore < "/etc/iptables/$LOCATION.rules" -} - diff --git a/contrib/logging.hook b/contrib/logging.hook deleted file mode 100755 index 82d0ed1..0000000 --- a/contrib/logging.hook +++ /dev/null @@ -1,86 +0,0 @@ -### Sample netcfg hook script for logging/debugging connections -### To install, make this executable and put it in /usr/lib/network/hooks - - -. /etc/rc.conf -. /etc/rc.d/functions - - -# if NETCFG_DEBUG is set, debugging messages go to stderr instead of syslog - -# What facility to send log messages to? if set to "", nothing will be sent to syslog -NETCFG_LOG="${NETCFG_LOG-local0}" - - - -function report_log { - if [[ -n "$NETCFG_LOG" ]]; then - local caller level="$1" - shift - case "$0" in - net-auto|netcfg-auto-*) caller=net-auto;; - net-profiles) caller=net-profiles;; - net-rename) caller=net-rename;; - *) caller=netcfg;; - esac - logger -p "${NETCFG_LOG}.$level" -t "$caller" -- "$*" - fi -} - - -function report_err { - report_log err "$*" - printhl "$*" -} - - -function report_notice { - report_log notice "$*" - # print "$*" >&2 - checkyesno "$NETCFG_DEBUG" && echo "DEBUG: $*" >&2 -} - - -function report_debug { - if checkyesno "$NETCFG_DEBUG"; then - echo "DEBUG: $*" >&2 - else - report_log debug "$*" - fi -} - - -function report_try { - report_log notice "trying $*..." - stat_busy "$*" - REPORT_TRYING=1 -} - - -function report_fail { - if [[ -n "$*" ]]; then - report_log err "$*" - if [[ -n "$REPORT_TRYING" ]]; then - stat_append "- $*" - REPORT_TRYING= - stat_fail - else - printhl "$*" - fi - elif [[ -n "$REPORT_TRYING" ]]; then - REPORT_TRYING= - stat_fail - fi -} - - -function report_success { - if [[ -n "$*" ]]; then - stat_append "- $*" - REPORT_TRYING= - fi - report_log notice "${*:-succeeded}" - stat_done -} - -# vim: ft=sh ts=4 et sw=4: diff --git a/contrib/pm-utils.handler b/contrib/pm-utils.handler deleted file mode 100755 index 378d32d..0000000 --- a/contrib/pm-utils.handler +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -. /usr/lib/pm-utils/functions - -[[ -f /usr/lib/network/network ]] || exit $NA -. /usr/lib/network/network -. /etc/conf.d/netcfg - -WIRELESS_INTERFACE=${WIRELESS_INTERFACE:-wlan0} - -auto_resume() -{ - if checkyesno ${RESTOREPROFILES:-no}; then - all_resume - sleep 2 - fi - restartservice net-auto-wireless - restartservice net-auto-wired - restartservice net-profiles -} - -daemon_suspend_all() -{ - stopservice net-auto-wireless - stopservice net-auto-wired - stopservice net-profiles -} - -case "$1" in - hibernate|suspend_hybrid|suspend) - report_notice "suspending all interfaces..." - daemon_suspend_all - if checkyesno "${RESTOREPROFILES:-no}"; then - interface_suspend all - fi - ;; - thaw|resume) - if [ -f "$STATE_DIR/interface/${WIRELESS_INTERFACE}" ]; then - report_notice "resuming all interfaces..." - auto_resume ${WIRELESS_INTERFACE} - else - report_notice "resuming all interfaces except wireless..." - all_resume ${WIRELESS_INTERFACE} - fi - ;; - radio_off) - report_notice "suspending wireless interface..." - interface_suspend ${WIRELESS_INTERFACE} no - set_iface disabled ${WIRELESS_INTERFACE} - bring_interface forcedown ${WIRELESS_INTERFACE} - ;; - radio_on) - report_notice "resuming wireless interface..." - auto_resume ${WIRELESS_INTERFACE} - if [ -x /etc/pm/power.d/??wifi ]; then - /usr/bin/on_ac_power # this is in pm-utils - case $? in - 0) # on ac - /etc/pm/power.d/??wifi false - ;; - 1) # on battery - /etc/pm/power.d/??wifi true - ;; - esac - fi - ;; - *) - ;; -esac - -exit $? - -# vim: ft=sh ts=4 et sw=4: diff --git a/contrib/zsh-completion b/contrib/zsh-completion deleted file mode 100644 index e05e183..0000000 --- a/contrib/zsh-completion +++ /dev/null @@ -1,52 +0,0 @@ -#compdef netcfg -local -a disp - -all_options() { - local _subcommands - _subcommands=('list:List all available profiles' - 'current:Report currently running profiles' - 'check-iface:Start the specified profile, only if its interface is not currently up' - 'up:Start the specified profile' - 'reconnect:Disconnect and reconnect the specified profile' - 'iface-recon:Reconnect profile active on specified interface' - 'down:Stop the specified profile' - 'iface-down:Stop the profile up on the specified interface' - 'all-down:Stop all connected profiles' - 'all-suspend:Suspend and store the name of all active profiles' - 'all-resume:Reconnect any profiles that have been suspended') - - _path_files -W "/etc/network.d" -g "*(.)" - _describe 'subcommand' _subcommands -} - -all_profiles() { - _path_files -W "/etc/network.d" -g "*(.)" -} - -up_profiles() { - _files -W "/run/network/profiles" -} - -up_ifaces() { - _files -W "/run/network/interfaces" -} - -_arguments -C \ -'(- *)-l[List all available profiles]' \ -'(- *)-c[Start the specified profile, only if its interface is not currently up]:Network profile:all_profiles' \ -'(- *)-u[Start specified profile]:Network profile:all_profiles' \ -'(- *)-r[Disconnect and reconnect the specified profile]:Active profiles:up_profiles' \ -'(- *)-R[Reconnect profile active on specified interface]:Active interface:up_ifaces' \ -'(- *)-d[Take specified profile down]:Active profile:up_profiles' \ -'(- *)-D[Take down profile active on specified interface]:Active interface:up_ifaces' \ -'(- *)-a[Take all active profiles down]' \ -'(- *)*:All options:all_options' - -if [[ ${#words} == 3 ]]; then - case $words[2] in - 'check-iface' | 'up') all_profiles;; - 'reconnect' | 'down') up_profiles;; - 'iface-recon' | 'iface-down') up_ifaces;; - esac -fi - diff --git a/docs/Makefile b/docs/Makefile index ef05303..879e5ac 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,21 +1,12 @@ -# Makefile for netcfg documentation +# Makefile for netctl documentation -MANPAGES = netcfg.8 netcfg-profiles.5 -WEBPAGES = index.html features.html $(MANPAGES:%=%.html) +MANPAGES = netctl.1 netctl.profile.5 netctl.special.7 -.PHONY: manpages website clean +.PHONY: manpages clean manpages: $(MANPAGES) -website: website.tar.xz - -$(MANPAGES): %: %.txt footer.txt +$(MANPAGES): %: %.txt a2x -d manpage -f manpage -a manversion=$(VERSION) $< -$(WEBPAGES): %.html: %.txt - asciidoc -a disable-javascript -a linkcss -a max-width=960px $< - -website.tar.xz: $(WEBPAGES) - tar --transform "s%^%netcfg/%" -cJf $@ $^ -C /etc/asciidoc/stylesheets asciidoc.css - clean: - -@rm -vf $(MANPAGES) $(WEBPAGES) website.tar.xz 2>/dev/null + -@rm -vf $(MANPAGES) 2>/dev/null diff --git a/docs/examples/openvpn b/docs/examples/openvpn deleted file mode 100644 index b6106aa..0000000 --- a/docs/examples/openvpn +++ /dev/null @@ -1,5 +0,0 @@ -CONNECTION="openvpn" -INTERFACE="ignore" -OVPN_CONFIG="/etc/openvpn/example/openvpn.conf" -OVPN_PID_FILE="/tmp/openvpn.example.pid" -OVPN_FLAGS="" diff --git a/docs/examples/ppp b/docs/examples/ppp deleted file mode 100644 index dfb6bc1..0000000 --- a/docs/examples/ppp +++ /dev/null @@ -1,4 +0,0 @@ -CONNECTION='ppp' -INTERFACE='ignore' -PEER='provider' -PPP_TIMEOUT=10 diff --git a/docs/features.txt b/docs/features.txt deleted file mode 100644 index 4cf7def..0000000 --- a/docs/features.txt +++ /dev/null @@ -1,147 +0,0 @@ -Netcfg Features ---------------- - -Network Profile management -~~~~~~~~~~~~~~~~~~~~~~~~~~ -netcfg is profile based. Each network has an individual profile. These -profiles can be individually connected/disconnected at any time. The -profile configuration varies depending on whether it's a wireless, -ethernet (wired) or other type of connection. The available options are -documented on the netcfg website and in the included examples. The -installed and available connection types can be seen at -'/usr/lib/network/connections/' - -To connect to a profile called `mynetwork' which would be located at -'/etc/network.d/mynetwork', you may run: - ----------------- -netcfg mynetwork ----------------- - -To disconnect from the same profile you could run one of: - ---------------------- -netcfg -d mynetwork -netcfg down mynetwork ---------------------- - -To reconnect: - -------------------- -netcfg -r mynetwork -------------------- - -For more options, see ''netcfg help'' - - -Start a specific list of profiles on boot -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -net-profiles allows you to start some profiles at boot time. Specify the -profiles you want netcfg to start (in the order you want them to be -started) in the +NETWORKS+ line in '/etc/conf.d/netcfg'. -Prefix a profile with a `@' to start it in the background. For example: - --------------------------------- -NETWORKS=(@adsl @mywireless lan) --------------------------------- - -Alternatively, you can have netcfg restart the profiles you had running -at the previous shutdown by specifying +NETWORKS=(last)+. - -Next, enable the `netcfg' systemd service or, on legacy systems, add -`net-profiles' to +DAEMONS+ in '/etc/rc.conf'. - - -Wireless automatic connection and roaming support -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Through the use of wpa_actiond which calls commands on a wpa_supplicant -event, netcfg now has automatic connection and roaming support. - -To use this: - -. Install core/wpa_actiond -. In '/etc/conf.d/netcfg' set +WIRELESS_INTERFACE+ to your wireless interface, eg: -+ ---------------------------- -WIRELESS_INTERFACE="wlan0" ---------------------------- -. Run `systemctl start net-auto-wireless` - -To run on boot, enable the `net-auto-wireless' systemd service. - - -Per interface configuration -~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Configuration that applies to all profiles using an interface can be set -at '/etc/network.d/interfaces/$INTERFACE'. For example: - ------------------------------- -/etc/network.d/interfaces/eth0 ------------------------------- - -This is useful for wpa_supplicant options, radio kill switch support, -pre/post up/down scripts and net-auto-wireless. It is loaded before a -profile is loaded so that any profile based options will take priority. - - -Execute commands before/after interface up/down -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If your interface requires special actions prior/after the -establishment/closure of a connection, you may use the +PRE_UP+, POST_UP, -+PRE_DOWN+, +POST_DOWN+ properties. For example, if you want to run a -script before connecting: - ------------------------- -PRE_UP="/path/to/script" ------------------------- - -Or if you want to manage resolv.conf through resolvconf, you could -remove any DNS related options and use the following, which will be run -after a successful connection: - ----------------------------------------------------------------- -POST_UP='echo "nameserver 8.8.8.8" | resolvconf -a "$INTERFACE"' ----------------------------------------------------------------- - -If the commands specified in these properties return anything other than -0 (success), netcfg aborts the current operation. If you command might -fail, create a separate bash script with an "exit 0;" at the end. -Alternatively you may add "|| true" to the end of the command that may -fail. - - -Output Hooks -~~~~~~~~~~~~ -netcfg has limited support to load hooks that handle output. By default -it loads the "arch" hook which provides the familiar output that you -see. A syslog logging hook is also included. These can be found at -'/usr/lib/network/hooks/' - - -Menu based profile selection -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You may select a profile to connect to from a menu. This requires the -'dialog' package installed. To display a menu, simply run `netcfg-menu`. -If you wish to have a menu on boot, set +NETWORKS=(menu)+ in your -'/etc/conf.d/netcfg' and ensure that `net-profiles' is in the +DAEMONS+ -array. A boot-time menu is not supported on systemd installations. - - -Menu based wireless network selection -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You can also connect to a wireless network using a menu. To display the -menu, run `wifi-menu [-o] [interface]`. The _interface_ defaults to the -+WIRELESS_INTERFACE+ from '/etc/conf.d/netcfg'. When `-o' is specified, -passwords are obscured (ie masked and saved in hexadecimal form). The -tool generates a profile file if no suitable profile was found. - - -Debugging -~~~~~~~~~ -To run netcfg with debugging output, set the NETCFG_DEBUG environment -variable to "yes", for example: - -------------------------------------- -NETCFG_DEBUG="yes" netcfg <arguments> -------------------------------------- - diff --git a/docs/footer.txt b/docs/footer.txt deleted file mode 100644 index c9efbad..0000000 --- a/docs/footer.txt +++ /dev/null @@ -1,22 +0,0 @@ -More information can be found at *<https://wiki.archlinux.org/index.php/Netcfg>*. - - -BUGS ----- -For bugtracking, *<https://bugs.archlinux.org/>* is used. - - -AUTHORS -------- -netcfg has many contributors. -For a list of contributors, use `git shortlog -s` on the netcfg.git repository. - -Current maintainer: - -* Jouke Witteveen <j.witteveen@gmail.com> - -Past maintainers: - -* Rémy Oudompheng <remy@archlinux.org> -* James Rayner <james@archlinux.org> - diff --git a/docs/index.txt b/docs/index.txt deleted file mode 100644 index 10ba380..0000000 --- a/docs/index.txt +++ /dev/null @@ -1,57 +0,0 @@ -netcfg home page ----------------- - -About -~~~~~ -netcfg is profile based network connection tool. It can connect to a -variety of connections (including wired, wireless and PPP) and is easily -extended to support other connection types. - - -Features -~~~~~~~~ - -* Easy configuration -* Wireless, wired and ppp connections -* Wireless roaming and automatic connection (using wpa_actiond/wpa_supplicant) -* Radio kill switch (rfkill) awareness -* pm-utils suspend/resume support -* Execution of commands before/after up/down -* Wired link detection (using ifplugd) -* Modern iproute and wpa_supplicant based connectivity - - -Optional dependencies -~~~~~~~~~~~~~~~~~~~~~ - -* wpa_supplicant: for wireless networking -* wpa_actiond: Wireless Roaming/autoconnect -* ifplugd: Wired link detection -* dialog: Menu support -* bridge-utils: To set up bridge connections - - -Documentation -~~~~~~~~~~~~~ - -* https://wiki.archlinux.org/index.php/Netcfg[Arch Linux Wiki page] -* link:features.html[Feature documentation] -* link:netcfg.8.html[netcfg man page] -* link:netcfg-profiles.5.html[netcfg-profiles man page] - - -Contact -~~~~~~~ - -To report bugs or issues with netcfg, please use the -https://bugs.archlinux.org[Arch Linux Bug Tracker] - -To seek help using netcfg, please post on the -https://bbs.archlinux.org[Arch Linux Forums] - - -Copyright -~~~~~~~~~ -netcfg is Copyright (C) 2011-2012, Netcfg Development Team -and Copyright (C) 2007-2010 James Rayner <james@archlinux.org> -and is licensed through the Modified BSD License. diff --git a/docs/netcfg.8.txt b/docs/netctl.1.txt index 54fbd78..54fbd78 100644 --- a/docs/netcfg.8.txt +++ b/docs/netctl.1.txt diff --git a/docs/netcfg-profiles.5.txt b/docs/netctl.profile.5.txt index f929e47..f929e47 100644 --- a/docs/netcfg-profiles.5.txt +++ b/docs/netctl.profile.5.txt diff --git a/rc.d/net-auto-wired b/rc.d/net-auto-wired deleted file mode 100755 index 807bb22..0000000 --- a/rc.d/net-auto-wired +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions -. /usr/lib/network/globals -. /etc/conf.d/netcfg - -if [[ ! -x /usr/bin/ifplugd ]]; then - exit_stderr "Please install 'ifplugd' to use net-auto-wired" -fi - -if [[ -z "${WIRED_INTERFACE}" ]]; then - exit_stderr "No interface name set. Add to /etc/conf.d/netcfg a line"$'\n' \ - " WIRED_INTERFACE='your_interface'" -fi - -CFG=/etc/ifplugd/ifplugd.conf -ACTION=/etc/ifplugd/netcfg.action -PIDFILE=/var/run/ifplugd.$WIRED_INTERFACE.pid -[[ -f $PIDFILE ]] && read PID < $PIDFILE - -# Source ifplugd configuration -[ -f $CFG ] && . $CFG - -case "$1" in - start) - if ! ck_daemon net-auto-wired; then - exit_stderr "net-auto-wired has already been started: try \"/etc/rc.d/net-auto-wired restart\"" - fi - stat_busy "Starting netcfg auto-wired mode for interface ${WIRED_INTERFACE}" - A="`eval echo \$\{ARGS_${WIRED_INTERFACE}\}`" - [[ "$A" ]] || A="$ARGS" - [[ "$PID" ]] || /usr/bin/ifplugd -i $WIRED_INTERFACE -r $ACTION $A - # ifplugd may return non-zero, but still succeed if -w is passed, as default in upstream config. - sleep 1 - if [[ -f $PIDFILE ]]; then - add_daemon net-auto-wired - stat_done - else - stat_fail - fi - ;; - stop) - if ! ck_daemon net-auto-wired; then - stat_busy "Stopping netcfg auto-wired mode for interface ${WIRED_INTERFACE}" - if [[ "$PID" ]] && /usr/bin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION; then - rm_daemon net-auto-wired - stat_done - else - stat_fail - fi - fi - ;; - restart) - "$0" stop - sleep 1 - "$0" start - ;; - *) - echo "Usage: $0 {start|stop|restart}" -esac -exit 0 diff --git a/rc.d/net-auto-wireless b/rc.d/net-auto-wireless deleted file mode 100755 index 9094232..0000000 --- a/rc.d/net-auto-wireless +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions -. /usr/lib/network/globals -. /etc/conf.d/netcfg - -if [[ ! -x /usr/sbin/wpa_actiond ]]; then - exit_stderr "Please install 'wpa_actiond' to use net-auto-wireless" -fi - -if [[ -z "${WIRELESS_INTERFACE}" ]]; then - exit_stderr "No interface name set. Add to /etc/conf.d/netcfg a line"$'\n' \ - " WIRELESS_INTERFACE='your_interface'" -fi - -case "$1" in - start) - if ! ck_daemon net-auto-wireless; then - exit_stderr "net-auto-wireless has already been started: try \"/etc/rc.d/net-auto-wireless restart\"" - fi - # Ensure any device renaming has occurred as intended - for daemon in "${DAEMONS[@]}"; do - if [[ "$daemon" = "net-rename" ]]; then - if ck_daemon net-rename; then - /etc/rc.d/net-rename start - fi - fi - done - - stat_busy "Starting netcfg auto-wireless mode for interface ${WIRELESS_INTERFACE}" - if /usr/bin/netcfg-wpa_actiond "${WIRELESS_INTERFACE}" >/dev/null; then - add_daemon net-auto-wireless - stat_done - else - stat_fail - fi - ;; - stop) - if ! ck_daemon net-auto-wireless; then - stat_busy "Stopping netcfg auto-wireless mode for interface ${WIRELESS_INTERFACE}" - if /usr/bin/netcfg-wpa_actiond stop "${WIRELESS_INTERFACE}" >/dev/null; then - rm_daemon net-auto-wireless - stat_done - else - stat_fail - fi - fi - ;; - restart) - "$0" stop - sleep 1 - "$0" start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - ;; -esac -exit 0 -# vim: ft=sh ts=4 et sw=4: diff --git a/rc.d/net-profiles b/rc.d/net-profiles deleted file mode 100755 index ae9c00e..0000000 --- a/rc.d/net-profiles +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# -# This script utilizes netcfg-daemon. - -. /etc/rc.conf -. /etc/rc.d/functions -. /usr/lib/network/globals - -case "$1" in - start) - if ! ck_daemon net-profiles; then - exit_stderr "net-profiles has already been started. Try '/etc/rc.d/net-profiles restart'" - fi - - # Ensure any device renaming has occurred as intended - for daemon in "${DAEMONS[@]}"; do - if [[ $daemon = net-rename ]]; then - if ck_daemon net-rename; then - /etc/rc.d/net-rename start - fi - fi - done - - # $NET env var is passed from the kernel boot line - if [[ -n $NET ]]; then - # Record the connected profile for net-profiles stop - if [[ $NET = menu ]]; then - /usr/bin/netcfg-menu || exit 1 - mv "$STATE_DIR"/{menu,netcfg-daemon} - else - /usr/bin/netcfg check-iface "$NET" || exit 1 - echo "$NET" > "$STATE_DIR/netcfg-daemon" - fi - elif ! /usr/bin/netcfg-daemon start; then - exit_err "No profile started." - fi - add_daemon net-profiles - ;; - stop) - if ck_daemon net-profiles; then - exit_stderr "net-profiles is not running" - fi - /usr/bin/netcfg-daemon stop - rm_daemon net-profiles - ;; - restart) - "$0" stop - sleep 1 - "$0" start - ;; - *) - exit_stderr "Usage: $0 {start|stop|restart}" -esac - -# vim: ft=sh ts=4 et sw=4: diff --git a/rc.d/net-rename b/rc.d/net-rename deleted file mode 100755 index 42dfa23..0000000 --- a/rc.d/net-rename +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions -. /usr/lib/network/globals - -case "$1" in - start) - report_try "Renaming network devices" - ifrename -p -t - report_success - - add_daemon net-rename - ;; - stop) - rm_daemon net-rename - # No stop neccesary, but add one to look nice on shutdown. - /bin/true - ;; - restart) - "$0" start - ;; - *) - exit_stderr "Usage: $0 {start|stop|restart}" - ;; -esac - -# vim: ft=sh ts=4 et sw=4: diff --git a/rc.d/net-set-variable b/rc.d/net-set-variable deleted file mode 100644 index d2d68fa..0000000 --- a/rc.d/net-set-variable +++ /dev/null @@ -1,10 +0,0 @@ -# Set the NET variable if specified on the kernel command line. - -net_set_variable() { - local re="\<NET=([^ ]+)\>" - if [[ -f /proc/cmdline && $(< /proc/cmdline) =~ $re ]]; then - export NET=${BASH_REMATCH[1]} - fi -} - -add_hook multi_start net_set_variable diff --git a/scripts/netcfg-daemon b/scripts/netcfg-daemon deleted file mode 100755 index b3111da..0000000 --- a/scripts/netcfg-daemon +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -# -# This script implements support for the NETWORKS array in /etc/conf.d/netcfg. - -. /usr/lib/network/globals -. /etc/conf.d/netcfg -STATE_FILE="$STATE_DIR/netcfg-daemon" -LAST_STATE="/var/lib/netcfg/netcfg.state" - -case "$1" in - start) - (( $(id -u) )) && exit_stderr "This script should be run as root." - [[ -e $STATE_FILE ]] && exit_err "netcfg-daemon is already started" - [[ ${NETWORKS+x} != x ]] && exit_err "NETWORKS is not set in /etc/conf.d/netcfg" - - if [[ ${#NETWORKS[@]} -eq 1 ]]; then - case $NETWORKS in - last) - if [[ ! -e $LAST_STATE ]]; then - report_err "No recorded netcfg state to restore" - # This counts as successful startup since the daemon - # should be stopped on shutdown. - exit 0 - fi - - # The order in LAST_STATE is meaningless so we can just as - # well start the profiles in parallel. - while read profile; do - if /usr/bin/netcfg up "$profile"; then - echo "$profile" >> "$STATE_FILE" - fi & - done < "$LAST_STATE" - wait - exit $? ;; - menu) - /usr/bin/netcfg-menu ${NETWORKS_MENU_TIMEOUT-5} && \ - mv "$STATE_DIR/menu" "$STATE_FILE" - exit $? ;; - esac - fi - - for profile in "${NETWORKS[@]}"; do - if [[ "$profile" = "${profile#@}" ]]; then - if /usr/bin/netcfg check-iface "$profile"; then - echo "$profile" >> "$STATE_FILE" - fi - else - # It is up to the user to make sure no backgrounded profile - # uses an interface that is used by another active profile. - if /usr/bin/netcfg up "${profile#@}"; then - echo "$profile" >> "$STATE_FILE" - fi >/dev/null & - PROFILE_BKGD=1 - fi - done - # Generate a return value. - [[ -f $STATE_FILE || -n $PROFILE_BKGD ]] - ;; - stop) - (( $(id -u) )) && exit_stderr "This script should be run as root." - - if [[ ${#NETWORKS[@]} -eq 1 && $NETWORKS = last ]]; then - mkdir -p "$(dirname "$LAST_STATE")" - /usr/bin/netcfg current > "$LAST_STATE" - /usr/bin/netcfg all-down - exit $? - fi - - [[ ! -e $STATE_FILE ]] && exit_err "netcfg-daemon was not started" - # Stop the profiles in the reverse order they were started. - tac "$STATE_FILE" | ( - while read profile; do - if [[ -e "$STATE_DIR/profiles/${profile#@}" ]]; then - if [[ "$profile" = "${profile#@}" ]]; then - /usr/bin/netcfg down "$profile" || exit $? - else - /usr/bin/netcfg down "${profile#@}" & - fi - fi - done - rm "$STATE_FILE" - # Generate a return value and make sure we are good to restart. - wait - ) - ;; - restart) - "$0" stop - sleep 1 - "$0" start - ;; - status) - if [[ -e $STATE_FILE ]]; then - report_notice "profiles started by netcfg-daemon:" - sed 's/^@//' "$STATE_FILE" - else - report_notice "netcfg-daemon was not started" - fi - ;; - *) - echo "Usage: $0 {start|stop|restart|status}" -esac - diff --git a/scripts/netcfg-menu b/scripts/netcfg-menu deleted file mode 100755 index 9a875ae..0000000 --- a/scripts/netcfg-menu +++ /dev/null @@ -1,55 +0,0 @@ -#! /bin/bash - -. /usr/lib/network/network - -if ! type dialog &> /dev/null; then - echo "Please install 'dialog' to use netcfg-menu" - exit 1 -fi - -check_make_state_dir -# JP: we'll use $STATE_DIR/menu to record what profile is being connected in this way -rm -f "$STATE_DIR/menu" - -# Set timeout -TIMEOUT=${1-0} - -# Scan all profiles -i=0 -# JP: change for prof to while read prof to avoid assumption that profile names are always single tokens (no spaces etc.) -while read prof; do - # if there is a profile called "main", Use as default - [[ "$prof" = "main" ]] && DEFAULT="main" - profiles[i++]="$prof" - profiles[i++]=$(. "$PROFILE_DIR/$prof"; echo "$DESCRIPTION") -done < <(list_profiles | sort) # JP: re-use list_profiles instead of duplicating it; avoid subshell we'd get by piping it to the while read... - -if [[ ${#profiles} -eq 0 ]]; then - exit_err "No profiles were found in $PROFILE_DIR" -fi - -[[ -n "$NETWORKS_MENU_DEFAULT" ]] && DEFAULT="$NETWORKS_MENU_DEFAULT" -# if no default yet, use the first entry -[[ -z "$DEFAULT" ]] && DEFAULT="${profiles[0]}" - -# Display Dialog -PROFILE=$(dialog --timeout "$TIMEOUT" --default-item "$DEFAULT" --stdout \ - --menu 'Select the network profile you wish to use' \ - 13 50 6 "${profiles[@]}") -ret=$? -case $ret in - 1) ;; # Cancel - do nothing - 255|0) # Timeout (use default) or user selection - [[ -z "$PROFILE" ]] && PROFILE="$DEFAULT" - profile_up "$PROFILE" - ret=$? - (( ret == 0 )) && echo "$PROFILE" > "$STATE_DIR/menu" - ;; - *) # Should not happen - exit_err "Abnormal return code from dialog: $ret" - ;; -esac - -exit $ret # JP: exit with caught $? - -# vim: ft=sh ts=4 et sw=4: diff --git a/scripts/pm-utils b/scripts/pm-utils deleted file mode 100755 index 93ee763..0000000 --- a/scripts/pm-utils +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -. /usr/lib/pm-utils/functions - -suspend_netcfg() { - netcfg all-suspend -} - -resume_netcfg() { - netcfg all-resume -} - -if type netcfg > /dev/null; then - case "$1" in - hibernate|suspend) - suspend_netcfg - ;; - thaw|resume) - resume_netcfg - ;; - *) - ;; - esac -fi - -exit $? diff --git a/systemd/net-auto-wireless.service b/services/netctl-auto@.service index 81f2369..81f2369 100644 --- a/systemd/net-auto-wireless.service +++ b/services/netctl-auto@.service diff --git a/systemd/net-auto-wired.service b/services/netctl-ifplugd@.service index 8948ac6..8948ac6 100644 --- a/systemd/net-auto-wired.service +++ b/services/netctl-ifplugd@.service diff --git a/systemd/netcfg.service b/services/netctl.service index f400be0..f400be0 100644 --- a/systemd/netcfg.service +++ b/services/netctl.service diff --git a/systemd/netcfg@.service b/services/netctl@.service index 57229f8..57229f8 100644 --- a/systemd/netcfg@.service +++ b/services/netctl@.service diff --git a/src/connections/openvpn b/src/connections/openvpn deleted file mode 100644 index 170d582..0000000 --- a/src/connections/openvpn +++ /dev/null @@ -1,52 +0,0 @@ -#! /bin/bash -# Originally contributed by Thomas Jost: https://bugs.archlinux.org/task/21490 - -. /usr/lib/network/network - -openvpn_up() { - load_profile "$1" - [[ -z "$OVPN_CONFIG" ]] && OVPN_CONFIG="/etc/openvpn/openvpn.conf" - [[ -z "$OVPN_PID_FILE" ]] && OVPN_PID_FILE="/run/openvpn-$1.pid" - [[ -z "$OVPN_FLAGS" ]] && OVPN_FLAGS="" - - OVPN_CONF_DIR="`dirname $OVPN_CONFIG`" - OVPN_CONF_FILE="`basename $OVPN_CONFIG`" - - /usr/sbin/openvpn --writepid $OVPN_PID_FILE --daemon --cd "$OVPN_CONF_DIR" --config "$OVPN_CONF_FILE" $OVPN_FLAGS - - if [[ $? -ne 0 ]]; then - report_fail "OpenVPN connection failed" - exit 1 - fi - - # Generate a new resolv.conf - if [[ -n "$DNS" ]]; then - [[ -e /etc/resolv.conf ]] && cp /etc/resolv.conf /tmp/openvpn-$1-resolv.conf - : >/etc/resolv.conf - [[ -n "$DOMAIN" ]] && echo "domain $DOMAIN" >>/etc/resolv.conf - [[ -n "$SEARCH" ]] && echo "search $SEARCH" >>/etc/resolv.conf - for dns in "${DNS[@]}"; do - echo "nameserver $dns" >>/etc/resolv.conf - done - for dnsoption in "${DNS_OPTIONS[@]}"; do - echo "options $dnsoption" >>/etc/resolv.conf - done - fi -} - -openvpn_down() { - load_profile "$1" - [[ -z "$OVPN_PID_FILE" ]] && OVPN_PID_FILE="/run/openvpn-$1.pid" - - kill $(head -1 $OVPN_PID_FILE) - rm $OVPN_PID_FILE - - # Restore an old resolv.conf - if [[ -e /tmp/openvpn-$1-resolv.conf ]]; then - mv -f /tmp/openvpn-$1-resolv.conf /etc/resolv.conf - fi -} - -openvpn_$1 "$2" -exit $? -# vim: ft=sh ts=4 et sw=4: diff --git a/src/connections/ppp b/src/connections/ppp deleted file mode 100644 index da0fd6f..0000000 --- a/src/connections/ppp +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/bash -. /usr/lib/network/network - - -ppp_up() { - load_profile "$1" - [[ -z "$PEER" ]] && PEER="provider" - [[ -z "$PPP_TIMEOUT" ]] && PPP_TIMEOUT=30 - - /usr/sbin/pppd call "$PEER" updetach child-timeout "$PPP_TIMEOUT" linkname "$PEER" - - if [[ $? -ne 0 ]]; then - report_fail "Couldn't make pppd connection." - return 1 - fi -} - -ppp_down() { - load_profile "$1" - PIDFILE="/var/run/ppp-$(basename $PEER).pid" - - if [[ -e $PIDFILE ]]; then - PID=$(head -1 $PIDFILE) - [[ -n "$PID" ]] && kill "$PID" - fi -} - -ppp_$1 "$2" -exit $? - -# vim: ft=sh ts=4 et sw=4: diff --git a/src/hooks/fancy b/src/hooks/fancy deleted file mode 100755 index a64514e..0000000 --- a/src/hooks/fancy +++ /dev/null @@ -1,90 +0,0 @@ -# Fancy output is for terminal output only. -[[ -t 1 ]] || return - - -### Fancy Logging/Error reporting - -function report_err { - print_prefixed "${FANCY_OTHER}" "${FANCY_HIGHLIGHT}$*" -} - -function report_notice { - print_prefixed "${FANCY_OTHER}" "$*" -} - -function report_try { - printf "${FANCY_OTHER}${PREFIX_BUSY}${FANCY_NORMAL} %s " "$*" - report_busy - REPORT_TRYING=1 -} - -function report_fail { - if [[ -n "$*" ]]; then - if [[ -n "$REPORT_TRYING" ]]; then - report_append "$*" - report_failed - REPORT_TRYING= - else - print_prefixed "${FANCY_FAILED}" "${FANCY_HIGHLIGHT}$*" - fi - elif [[ -n "$REPORT_TRYING" ]]; then - report_failed - REPORT_TRYING= - fi -} - -function report_success { - if [[ -n "$*" ]]; then - if [[ -n "$REPORT_TRYING" ]]; then - report_append "$*" - report_done - REPORT_TRYING= - else - print_prefixed "${FANCY_DONE}" "$*" - fi - elif [[ -n "$REPORT_TRYING" ]]; then - report_done - REPORT_TRYING= - fi -} - -function report_append { - printf -- "${RESTORE_POSITION}${FANCY_OTHER}-${FANCY_NORMAL} %s " "$*" -} - -function report_busy { - printf "${CURSOR_STATUS} [${FANCY_BUSY} BUSY ${FANCY_NORMAL}] " -} - -function report_failed { - printf "${CURSOR_STATUS} [${FANCY_FAILED}FAILED${FANCY_NORMAL}]\n" -} - -function report_done { - printf "${CURSOR_STATUS} [${FANCY_DONE} DONE ${FANCY_NORMAL}]\n" -} - -function print_prefixed { - local c_prefix=$1 - shift - printf "${c_prefix}${PREFIX_ATTENTION}${FANCY_NORMAL} %s${FANCY_NORMAL}\n" "$*" -} - - -SAVE_POSITION=$(tput sc) -RESTORE_POSITION=$(tput rc) -COLUMNS=$(tput cols) -(( COLUMNS == 0 )) && COLUMNS=80 -CURSOR_STATUS=${SAVE_POSITION}$(tput hpa $(( COLUMNS - 10 )) ) - -FANCY_NORMAL=$(tput sgr0) -FANCY_HIGHLIGHT=${FANCY_NORMAL}$(tput bold) -FANCY_BUSY=${FANCY_NORMAL}$(tput setaf 6) # cyan -FANCY_FAILED=${FANCY_HIGHLIGHT}$(tput setaf 1) # red -FANCY_DONE=${FANCY_HIGHLIGHT}$(tput setaf 2) # green -FANCY_OTHER=${FANCY_HIGHLIGHT}$(tput setaf 4) # blue - -PREFIX_BUSY="::" -PREFIX_ATTENTION=" >" - -# vim: ft=sh ts=4 et sw=4: diff --git a/src/hooks/initscripts b/src/hooks/initscripts deleted file mode 100755 index 07003c8..0000000 --- a/src/hooks/initscripts +++ /dev/null @@ -1,35 +0,0 @@ -# Use initscripts output formatting. -# This hook must be loaded after 'fancy'. - -[[ ${FANCY_NORMAL+x} = x && -f /etc/rc.d/functions ]] || return -. /etc/rc.conf -. /etc/rc.d/functions - - -function report_try { - stat_busy "$*" - REPORT_TRYING=1 -} - -function report_append { - stat_append "- $*" -} - -function report_failed { - stat_fail -} - -function report_done { - stat_done -} - - -FANCY_NORMAL=$C_CLEAR -FANCY_HIGHLIGHT=$C_H1 -FANCY_FAILED=$C_FAIL -FANCY_DONE=$C_DONE -FANCY_OTHER=$C_OTHER - -PREFIX_ATTENTION=$PREFIX_HL - -# vim: ft=sh ts=4 et sw=4: diff --git a/scripts/ifplugd.action b/src/ifplugd.action index ea3a16c..ea3a16c 100755 --- a/scripts/ifplugd.action +++ b/src/ifplugd.action diff --git a/src/8021x b/src/lib/8021x index d2ddfe4..d2ddfe4 100644 --- a/src/8021x +++ b/src/lib/8021x diff --git a/scripts/netcfg-wpa_actiond-action b/src/lib/auto.action index 1f29364..1f29364 100755 --- a/scripts/netcfg-wpa_actiond-action +++ b/src/lib/auto.action diff --git a/src/lib/connections/README b/src/lib/connections/README new file mode 100644 index 0000000..38ef11a --- /dev/null +++ b/src/lib/connections/README @@ -0,0 +1,28 @@ +Support for connection types is implemented by connection files in + + /usr/lib/network/connections/ + +The file name determines the name of the connection type, so support +for the aviancarrier connection type will be provided by the file: + + /usr/lib/network/connections/aviancarrier + +Files that implement support for a connection type should NOT be +executable. Such files should contain valid Bash code, among which two +functions, namely <connection_type>_up and <connection_type>_down. For +the aviancarrier file this would be: + + aviancarrier_up + aviancarrier_down + +These functions are responsible for bringing the network up and down, +respectively. When the functions are called, three bash files are +already sourced, so all functions and variables in those files are +available. The readily sourced files are: + + /usr/lib/network/network + /usr/lib/network/globals + /etc/network.d/<profile> + +Here, <profile> is the profile file specifying the desired network +configuration. diff --git a/src/connections/bond b/src/lib/connections/bond index bc5aa95..bc5aa95 100644 --- a/src/connections/bond +++ b/src/lib/connections/bond diff --git a/src/connections/bridge b/src/lib/connections/bridge index 6b3ab67..6b3ab67 100644 --- a/src/connections/bridge +++ b/src/lib/connections/bridge diff --git a/src/connections/ethernet b/src/lib/connections/ethernet index 487adf8..487adf8 100644 --- a/src/connections/ethernet +++ b/src/lib/connections/ethernet diff --git a/src/connections/pppoe b/src/lib/connections/pppoe index 17fe42d..17fe42d 100644 --- a/src/connections/pppoe +++ b/src/lib/connections/pppoe diff --git a/src/connections/tunnel b/src/lib/connections/tunnel index 6cefc5c..6cefc5c 100644 --- a/src/connections/tunnel +++ b/src/lib/connections/tunnel diff --git a/src/connections/tuntap b/src/lib/connections/tuntap index 6985c8c..6985c8c 100644 --- a/src/connections/tuntap +++ b/src/lib/connections/tuntap diff --git a/src/connections/vlan b/src/lib/connections/vlan index 75c7fa9..75c7fa9 100644 --- a/src/connections/vlan +++ b/src/lib/connections/vlan diff --git a/src/connections/wireless b/src/lib/connections/wireless index 135bec7..135bec7 100644 --- a/src/connections/wireless +++ b/src/lib/connections/wireless diff --git a/src/globals b/src/lib/globals index 491f9d6..491f9d6 100644 --- a/src/globals +++ b/src/lib/globals diff --git a/src/network b/src/lib/network index 1aa384c..1aa384c 100644 --- a/src/network +++ b/src/lib/network diff --git a/src/rfkill b/src/lib/rfkill index 1832dc1..1832dc1 100644 --- a/src/rfkill +++ b/src/lib/rfkill diff --git a/scripts/netcfg b/src/netctl index f1d79e8..f1d79e8 100755 --- a/scripts/netcfg +++ b/src/netctl diff --git a/scripts/netcfg-wpa_actiond b/src/netctl-auto index c6aaf67..c6aaf67 100755 --- a/scripts/netcfg-wpa_actiond +++ b/src/netctl-auto diff --git a/scripts/wifi-menu b/src/wifi-menu index f46db0d..f46db0d 100755 --- a/scripts/wifi-menu +++ b/src/wifi-menu |