diff options
author | felics@felics-tablet | 2016-02-28 17:51:37 +0100 |
---|---|---|
committer | felics@felics-tablet | 2016-02-28 17:51:37 +0100 |
commit | 15a89e92f2a67d936bfe2906dcbc0aa2f4c8ac61 (patch) | |
tree | ab07b3215a513b8b3569a21acb73285c03540d73 | |
download | aur-15a89e92f2a67d936bfe2906dcbc0aa2f4c8ac61.tar.gz |
Initial commit.
-rw-r--r-- | .SRCINFO | 57 | ||||
-rw-r--r-- | Makefile.deduplicate-examples.patch | 43 | ||||
-rw-r--r-- | PKGBUILD | 179 | ||||
-rw-r--r-- | netcfg.bash-completion_extended | 49 | ||||
-rw-r--r-- | netcfg.conf | 18 | ||||
-rw-r--r-- | netcfg.install | 41 | ||||
-rwxr-xr-x | netcfg.openrc | 33 | ||||
-rw-r--r-- | netcfg.zsh-completion_extended | 52 | ||||
-rw-r--r-- | newer-wpasupplicant.patch | 6 |
9 files changed, 478 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..7b7a2abc7c2c --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,57 @@ +# Generated by mksrcinfo v8 +# Sun Feb 28 16:51:22 UTC 2016 +pkgbase = netcfg-git + pkgdesc = Network configuration and profile scripts (install only if you really know that you want this instead of netctl). Includes patch to make wifi-menu work, OpenRC and systemd initscripts. + pkgver = 4.0.rg54f4656 + pkgrel = 1 + url = https://github.com/GNU-Pony/netcfg/ + install = netcfg.install + arch = any + groups = base + license = BSD + makedepends = auto-auto-complete + makedepends = gzip + makedepends = texinfo + makedepends = texman + depends = bash>=4.0 + depends = coreutils + depends = dhcpcd + depends = findutils + depends = grep + depends = iproute2 + depends = sed + optdepends = bridge-utils: for bridge connections. + optdepends = dialog: for the menu based profile and wifi selectors. + optdepends = dhclient: for DHCPv6. + optdepends = ifenslave: for bond connections. + optdepends = ifplugd: for automatic wired connections through net-auto-wired. + optdepends = wireless_tools: for interface renaming through net-rename. + optdepends = wpa_actiond: for automatic wireless connections through net-auto-wireless. + optdepends = wpa_supplicant: for wireless networking support. + provides = netcfg=4.0.rg54f4656 + provides = netcfg-openrc=4.0.rg54f4656 + provides = netcfg-systemd=4.0.rg54f4656 + conflicts = netctl + conflicts = netcfg + replaces = netcfg<=4.0.rg54f4656 + backup = etc/iftab + backup = etc/conf.d/netcfg + source = netcfg-master.zip::https://github.com/GNU-Pony/netcfg/archive/master.zip + source = netcfg.openrc + source = netcfg.conf + source = netcfg.bash-completion_extended + source = netcfg.zsh-completion_extended + source = newer-wpasupplicant.patch + source = Makefile.deduplicate-examples.patch + source = netcfg.install + sha256sums = 0ac7179314e73596fcd371de402af61291113fec66f2de2f25ed93d98803bfa7 + sha256sums = 4a21fb2a8eed541ff23ef93e8150607074d40f248fa923fcede27102ed2944da + sha256sums = 0525757fb59b9174f2c3bbc9828bb4590f89144f0506cadf13dafa0b76ec3e14 + sha256sums = a353438378891f711902f13d4df5e19dfcde756b453bb865c0f6660e3c1bc68f + sha256sums = 11573dbda8cc38968b2f4a7a58ebf71dc2094d2b925dca3026a8c33614643a9c + sha256sums = 14ed9b1d7072b6fee27094a4b35c6d35ad793766a432febfb613451f4af2214c + sha256sums = 1d10981f419c580f7a47150502acccf61139477e3abeae7bfcc3eec384787222 + sha256sums = 07c16d4de52acc97abe2633b5a3cf077bac6924159b47474c93d936816846468 + +pkgname = netcfg-git + diff --git a/Makefile.deduplicate-examples.patch b/Makefile.deduplicate-examples.patch new file mode 100644 index 000000000000..a4d93e26b84d --- /dev/null +++ b/Makefile.deduplicate-examples.patch @@ -0,0 +1,43 @@ +diff -U5 old/Makefile new/Makefile +--- old/Makefile 2016-02-28 16:25:03.000000000 +0100 ++++ new/Makefile 2016-02-28 16:25:15.000000000 +0100 +@@ -42,31 +42,28 @@ + EXTRAS = extra/iptables.hook \ + extra/logging.hook \ + extra/pm-utils.handler + + EXAMPLES = extra/examples/bonding \ ++ extra/examples/bridge \ + extra/examples/ethernet-dhcp \ +- extra/examples/ethernet-static \ + extra/examples/ethernet-iproute \ ++ extra/examples/ethernet-static \ ++ extra/examples/openvpn \ + extra/examples/ppp \ + extra/examples/pppoe \ +- extra/examples/wireless-open \ +- extra/examples/wireless-wep \ +- extra/examples/wireless-wpa \ +- extra/examples/wireless-wpa-static \ +- extra/examples/wireless-wpa-configsection \ +- extra/examples/wireless-wpa-config \ + extra/examples/tunnel-he-ipv6 \ ++ extra/examples/tuntap \ + extra/examples/vlan-dhcp \ + extra/examples/vlan-static \ +- extra/examples/bridge \ +- extra/examples/openvpn \ +- extra/examples/tuntap \ + extra/examples/wireless-open \ + extra/examples/wireless-wep \ + extra/examples/wireless-wep-string-key \ +- extra/examples/wireless-wpa-config ++ extra/examples/wireless-wpa \ ++ extra/examples/wireless-wpa-config \ ++ extra/examples/wireless-wpa-configsection \ ++ extra/examples/wireless-wpa-static + + RCD = rc.d/net-profiles \ + rc.d/net-rename \ + rc.d/net-auto-wired \ + rc.d/net-auto-wireless diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..66cd351fcf1d --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,179 @@ +# Maintainer: dreieck +# Previous maintainer: Mattias Andrée <`base64 -d`(bWFhbmRyZWUK)@member.fsf.org> +# Previous maintainer: Jouke Witteveen <j.witteveen@gmail.com> + +_pkgname='netcfg' +pkgname='netcfg-git' +pkgver=4.0.rg54f4656 +pkgrel=1 +pkgdesc="Network configuration and profile scripts (install only if you really know that you want this instead of netctl). Includes patch to make wifi-menu work, OpenRC and systemd initscripts." +url='https://github.com/GNU-Pony/netcfg/' +arch=(any) +license=(BSD) + +install='netcfg.install' + +backup=( + 'etc/iftab' + 'etc/conf.d/netcfg' +) + +groups=("base") + +depends=( + "bash>=4.0" + 'coreutils' + 'dhcpcd' + 'findutils' + 'grep' + 'iproute2' + 'sed' +) + +makedepends=( + "auto-auto-complete" # For generating shell auto-completion. + "gzip" # For compressing manpages. + "texinfo" # For generating info manual. + "texman" # For generating manpages. +) + +optdepends=( + 'bridge-utils: for bridge connections.' + 'dialog: for the menu based profile and wifi selectors.' + 'dhclient: for DHCPv6.' + 'ifenslave: for bond connections.' + 'ifplugd: for automatic wired connections through net-auto-wired.' + 'wireless_tools: for interface renaming through net-rename.' + 'wpa_actiond: for automatic wireless connections through net-auto-wireless.' + 'wpa_supplicant: for wireless networking support.' +) + +provides=( + "${_pkgname}=${pkgver}" + "${_pkgname}-openrc=${pkgver}" + "${_pkgname}-systemd=${pkgver}" +) + +replaces=( + "${_pkgname}<=${pkgver}" +) + +conflicts=( + "netctl" + "${_pkgname}" +) + +_source_base="https://github.com/GNU-Pony/${_pkgname}" + +source=( + "${_pkgname}-master.zip::${_source_base}/archive/master.zip" # NOTE: We download as a .zip-file such that we can have a checksum. We do it here for security, knowing that we don't download a fixed version and that we need to update the sha256sum when a new commit has been done. Although, this project does not seem to update often. + "netcfg.openrc" + "netcfg.conf" + "netcfg.bash-completion_extended" + "netcfg.zsh-completion_extended" + "newer-wpasupplicant.patch" + "Makefile.deduplicate-examples.patch" + "${install}" +) + +sha256sums=( + "0ac7179314e73596fcd371de402af61291113fec66f2de2f25ed93d98803bfa7" + "4a21fb2a8eed541ff23ef93e8150607074d40f248fa923fcede27102ed2944da" + "0525757fb59b9174f2c3bbc9828bb4590f89144f0506cadf13dafa0b76ec3e14" + "a353438378891f711902f13d4df5e19dfcde756b453bb865c0f6660e3c1bc68f" + "11573dbda8cc38968b2f4a7a58ebf71dc2094d2b925dca3026a8c33614643a9c" + "14ed9b1d7072b6fee27094a4b35c6d35ad793766a432febfb613451f4af2214c" + "1d10981f419c580f7a47150502acccf61139477e3abeae7bfcc3eec384787222" + "07c16d4de52acc97abe2633b5a3cf077bac6924159b47474c93d936816846468" +) + +_upk_base="${_pkgname}-master" + +pkgver() { + _unpackeddir="${srcdir}/${_upk_base}" + cd "${_unpackeddir}" + + _ver="$(cat CHANGELOG | grep -Ei 'version[[:space:]]+[0-9\.]*' | head -n 1 | grep '' | awk '{print $2}')" + + _rev="$(git ls-remote --exit-code "${_source_base}.git" "refs/heads/master" | head -c 7)" + + if [ -z "${_ver}" ]; then + echo "$0: Error: Could not determine version." > /dev/stderr + false + return 1 + fi + + if [ -z "${_rev}" ]; then + echo "$0: Error: Could not determine SVN revision." > /dev/stderr + false + return 1 + else + _rev="g${_rev}" + fi + + echo "${_ver}.r${_rev}" +} + +prepare() { + _unpackeddir="${srcdir}/${_upk_base}" + cd "${_unpackeddir}" + + for _patch in "${srcdir}"/*.patch; do + msg "Applying patch '${_patch}' ..." + patch -p1 < "${_patch}" + done +} + +build() { + _unpackeddir="${srcdir}/${_upk_base}" + cd "${_unpackeddir}" + + make +} + +package() { + _unpackeddir="${srcdir}/${_upk_base}" + cd "${_unpackeddir}" + + ### Core, manpages, info pages. We don't do 'install-daemon', which would be the sysvinit initscripts, since sysvinit is not really supported. + make DESTDIR="${pkgdir}" install-conf install-lib install-hook install-script install-doc + + ### systemd. + make DESTDIR="${pkgdir}" install-systemd + # Compatibility. + ln -s "${_pkgname}.service" "${pkgdir}/usr/lib/systemd/system/net-profiles.service" + + ### Remove /usr/lib/network/hooks/initscripts, since it would source files which are not available, resulting in error. + rm -f "${pkgdir}/usr/lib/network/hooks/initscripts" || true + + ### Install own version of conf.d (overwrite installed by Makefile). + install -D -m644 "${srcdir}/netcfg.conf" "${pkgdir}/etc/conf.d/netcfg" + + ### OpenRC initscript. + install -D -m755 "${srcdir}/netcfg.openrc" "${pkgdir}/etc/init.d/netcfg" + + ### License. + install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + + ### /usr/share/doc/-Documentation. + _docdir="${pkgdir}/usr/share/doc/${_pkgname}" + mkdir -p "${_docdir}" + chmod 644 "${_docdir}" + install -m 644 AUTHORS CHANGELOG CONTRIBUTING "${_docdir}" + install -m 644 README "${_docdir}/README.make" + + ### Shell Completion. + #install -D -m644 netcfg.bash-completion "$pkgdir/usr/share/bash-completion/completions/netcfg" + #install -D -m644 netcfg.zsh-completion "$pkgdir/usr/share/zsh/site-functions/_netcfg" # Yes!, the '_' in front is intended. + install -D -m644 "${srcdir}/netcfg.bash-completion_extended" "$pkgdir/usr/share/bash-completion/completions/netcfg" + install -D -m644 "${srcdir}/netcfg.zsh-completion_extended" "$pkgdir/usr/share/zsh/site-functions/_netcfg" # Yes!, the '_' in front is intended. +} + + +# _list_examples() { +# ### Helper-function help to manually generate the 'EXAMPLES'-variable in the Makefile. +# _unpackeddir="${srcdir}/${_upk_base}" +# cd "${_unpackeddir}" +# +# ls -1 extra/examples/* | sort -n | while read line; do echo " ${line} \\"; done +# } diff --git a/netcfg.bash-completion_extended b/netcfg.bash-completion_extended new file mode 100644 index 000000000000..dab52eab1478 --- /dev/null +++ b/netcfg.bash-completion_extended @@ -0,0 +1,49 @@ +# netcfg completion + +_netcfg () +{ + local cur prev opts lopts cmds prfls + + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + opts="-l -c -u -r -R -d -D -a -v -h" + lopts="--help --version" + cmds="list current check-iface up reconnect iface-recon down iface-down all-down all-suspend" + prfls="$(find -L /etc/network.d/ -maxdepth 1 -type f -not -name '*~' -not -name '*.conf' -not -name '.*' -printf '%f\n')" + + case "${prev}" in + -R|iface-recon|-D|iface-down) + COMPREPLY=( $( compgen -W "$(ls /run/network/interfaces/)" -- $cur ) ) + return 0 + ;; + -r|reconnect|-d|down) + COMPREPLY=( $( compgen -W "$(ls /run/network/profiles/)" -- $cur ) ) + return 0 + ;; + -c|check-iface|-u|up) + COMPREPLY=( $( compgen -W "${prfls}" -- $cur ) ) + return 0 + ;; + esac + + case "${cur}" in + --*) + COMPREPLY=( $( compgen -W "${lopts}" -- $cur ) ) + return 0 + ;; + -*) + COMPREPLY=( $( compgen -W "${opts} ${lopts}" -- $cur ) ) + return 0 + ;; + *) + ((COMP_CWORD == 1)) && \ + COMPREPLY=( $( compgen -W "${opts} ${lopts} ${cmds} ${prfls}" -- $cur ) ) + ;; + esac + + return 0 +} + +complete -F _netcfg netcfg diff --git a/netcfg.conf b/netcfg.conf new file mode 100644 index 000000000000..c016f8fd0844 --- /dev/null +++ b/netcfg.conf @@ -0,0 +1,18 @@ +# 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=() + +# 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 +# and wifi-menu +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") +AUTO_PROFILES=() diff --git a/netcfg.install b/netcfg.install new file mode 100644 index 000000000000..1c0fc7231d8c --- /dev/null +++ b/netcfg.install @@ -0,0 +1,41 @@ +## arg 1: the new package version +pre_install() { + true +} + +## arg 1: the new package version +post_install() { + echo "" + echo "If you use OpenRC and want to enable the service at boot, execute:" + echo " rc-update add netcfg default" + echo "" +} + +## arg 1: the new package version +## arg 2: the old package version +pre_upgrade() { + true +} + +## arg 1: the new package version +## arg 2: the old package version +post_upgrade() { + true +} + +## arg 1: the old package version +pre_remove() { + true +} + +## arg 1: the old package version +post_remove() { + echo "" + echo "If you use OpenRC, remember to remove the service from the system startup with:" + echo " rc-update -a delete netcfg" + echo "" + # if command -v rc-update > /dev/null; then + # echo "Removing netcfg from OpenRC-startup ..." + # rc-update -a delete netcfg || true + # fi +} diff --git a/netcfg.openrc b/netcfg.openrc new file mode 100755 index 000000000000..b46e5fe8e1f4 --- /dev/null +++ b/netcfg.openrc @@ -0,0 +1,33 @@ +#!/usr/bin/openrc-run +# OpenRC init script to configure the network via netcfg + +## 'netcfg-daemon' configures netcfg profiles as specified in /etc/conf.d/netcfg + +_EXECUTABLE="/usr/bin/netcfg-daemon" + +depend() { + need localmount + after net.lo net.lo0 bootmisc + provide net + keyword -jail -prefix -vserver +} + +start() { + ebegin "Setting up netcfg network profiles" + + "${_EXECUTABLE}" start + + eend "$?" +} + +stop() { + ebegin "Deconfiguring netcfg network profiles" + + if netcfg-daemon status | grep -qvE '^netcfg\-daemon was not started'; then + "${_EXECUTABLE}" stop + else + echo "netcfg-daemon was not started." + fi + + eend "$?" +} diff --git a/netcfg.zsh-completion_extended b/netcfg.zsh-completion_extended new file mode 100644 index 000000000000..e05e18303eca --- /dev/null +++ b/netcfg.zsh-completion_extended @@ -0,0 +1,52 @@ +#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/newer-wpasupplicant.patch b/newer-wpasupplicant.patch new file mode 100644 index 000000000000..c778002a5acc --- /dev/null +++ b/newer-wpasupplicant.patch @@ -0,0 +1,6 @@ +diff -rU0 netcfg-master.old/src/8021x netcfg-master.new/src/8021x +--- netcfg-master.old/src/8021x 2013-08-08 02:34:14.000000000 +0200 ++++ netcfg-master.new/src/8021x 2016-02-28 17:25:30.000000000 +0100 +@@ -65 +65 @@ +- wpa_supplicant -B -P "$PIDFILE" -i "$INTERFACE" -D "$WPA_DRIVER" "$WPA_CONF" $WPA_OPTS ++ wpa_supplicant -B -P "$PIDFILE" -i "$INTERFACE" -D "$WPA_DRIVER" "$WPA_CONF" $WPA_OPTS > /dev/stderr |