summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2009-11-14 01:29:11 +0100
committerJames Rayner <james@archlinux.org>2009-11-14 01:29:11 +0100
commitaf082228395c4c30bc4ae1159cfc6786502bcb3f (patch)
tree05d0684e90c901307e33beffbb69e8c7ca0bee76
parentecd51d8dc54e1a5c81f2c7d229b60ad089fa9de0 (diff)
downloadnetctl-af082228395c4c30bc4ae1159cfc6786502bcb3f.tar.gz
netctl-af082228395c4c30bc4ae1159cfc6786502bcb3f.tar.xz
finish net-auto-wired, tested and added to Makefile
-rw-r--r--Makefile17
-rwxr-xr-xifplugd/net-auto-wired9
-rw-r--r--src/netcfg2
3 files changed, 16 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index b41c068..a0382c3 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ install:
$(DESTDIR)/var/run/network/{interfaces,profiles} \
$(DESTDIR)/usr/bin/ $(DESTDIR)/etc/rc.d/ \
$(DESTDIR)/usr/share/man/{man5,man8} \
+ $(DESTDIR)/etc/ifplugd
# Documentation
install -m644 examples/* $(DESTDIR)/etc/network.d/examples/
@@ -19,12 +20,13 @@ install:
ln -s ethernet $(DESTDIR)/usr/lib/network/connections/ethernet-iproute
# Hooks
install -m755 src/hooks/* ${DESTDIR}/usr/lib/network/hooks/
- # 'Binaries'
+ # Scripts
install -m755 src/netcfg $(DESTDIR)/usr/bin/netcfg2
install -m755 src/netcfg-menu $(DESTDIR)/usr/bin/netcfg-menu
- install -m755 wpa_actiond/netcfg-wpa_actiond{,-action} $(DESTDIR)/usr/bin
+ install -m755 wpa_actiond/netcfg-wpa_actiond{,-action} ifplugd/net-auto-wired $(DESTDIR)/usr/bin
+ install -m755 ifplugd/netcfg.action $(DESTDIR)/etc/ifplugd/
# Daemons
- install -m755 src/net-profiles src/net-rename wpa_actiond/net-auto-wireless $(DESTDIR)/etc/rc.d
+ install -m755 src/net-profiles src/net-rename wpa_actiond/net-auto-wireless ifplugd/net-auto-wired $(DESTDIR)/etc/rc.d
install-wireless:
install -d $(DESTDIR)/usr/lib/network/connections $(DESTDIR)/usr/bin \
@@ -42,10 +44,10 @@ docs:
cd docs; \
./make.sh
-tarball:
+tarball: docs
sed -i "s/NETCFG_VER=.*/NETCFG_VER=$(VERSION)/g" src/netcfg
mkdir -p netcfg-$(VERSION)
- cp -r src src-wireless wpa_actiond examples contrib man Makefile LICENSE README netcfg-$(VERSION)
+ cp -r src src-wireless ifplugd wpa_actiond examples contrib man Makefile LICENSE README netcfg-$(VERSION)
tar -zcvf netcfg-$(VERSION).tar.gz netcfg-$(VERSION)
rm -rf netcfg-$(VERSION)
@@ -54,10 +56,9 @@ upload:
md5sum netcfg-$(VERSION)*gz > MD5SUMS.$(VERSION)
scp netcfg-$(VERSION)*gz MD5SUMS.$(VERSION) archlinux.org:/srv/ftp/other/netcfg/
-clean:
- rm doc/*html
+clean:
rm *gz
rm -rf netcfg-*$(VERSION)
rm -rf pkg
rm MD5SUMS*
-
+ rm docs/*html
diff --git a/ifplugd/net-auto-wired b/ifplugd/net-auto-wired
index 79e5beb..12d1201 100755
--- a/ifplugd/net-auto-wired
+++ b/ifplugd/net-auto-wired
@@ -5,7 +5,8 @@
CFG=/etc/ifplugd/ifplugd.conf
ACTION=/etc/ifplugd/netcfg.action
-PID=$(cat /var/run/ifplugd.$WIRED_INTERFACE)
+PIDFILE=/var/run/ifplugd.$WIRED_INTERFACE.pid
+[[ -f $PIDFILE ]] && PID=$(cat $PIDFILE)
# Source ifplugd configuration
[ -f $CFG ] && . $CFG
@@ -16,7 +17,9 @@ case "$1" in
A="`eval echo \$\{ARGS_${WIRED_INTERFACE}\}`"
[ -z "$A" ] && A="$ARGS"
[ -z "$PID" ] && /usr/sbin/ifplugd -i $WIRED_INTERFACE -r $ACTION $A
- if [ $? -gt 0 ]; then
+ # ifplugd may return non-zero, but still succeed if -w is passed, as default in upstream config.
+ sleep 1
+ if [[ ! -f $PIDFILE ]]; then
stat_fail
else
add_daemon net-auto-wired
@@ -25,7 +28,7 @@ case "$1" in
;;
stop)
stat_busy "Stopping netcfg auto-wired mode for interface ${WIRED_INTERFACE}"
- [ ! -z "$PID" ] && /usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION
+ [ -n "$PID" ] && /usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION
if [ $? -gt 0 ]; then
stat_fail
else
diff --git a/src/netcfg b/src/netcfg
index b9011af..51682cd 100644
--- a/src/netcfg
+++ b/src/netcfg
@@ -44,7 +44,7 @@ case "$1" in
echo "------------------"
list_profiles
exit 0;;
- current)
+ current|-s|status)
if [[ -d "$STATE_DIR/profiles/" ]]; then
ls "$STATE_DIR/profiles/"
exit 0