-AC_INIT([rc-scripts], [0.5.2], [tld-devel@lists.tld-linux.org], [rc-scripts])
+AC_INIT([rc-scripts], [0.5.3], [tld-devel@lists.tld-linux.org], [rc-scripts])
dnl Do not require AUTHORS, ChangeLog, NEWS, and README to exist
AM_INIT_AUTOMAKE([foreign])
# set handling for bridge
case "$DEVICETYPE" in
- br|atm|lec|irda|vlan)
+ bond|br|atm|lec|irda|vlan)
HANDLING=1
;;
esac
setup_ip_param
# forget all addresses
-LC_ALL=C ip addr flush dev ${DEVICE} 2>&1 | grep -v "Nothing to flush"
+LC_ALL=C ip addr flush dev "${DEVICE}" 2>&1 | grep -v "Nothing to flush"
# release slave devices
for SLAVE_DEV in $(cat /sys/class/net/${DEVICE}/bonding/slaves 2>/dev/null); do
- echo "-${SLAVE_DEV}" > /sys/class/net/${DEVICE}/bonding/slaves
+ ip link set "${SLAVE_DEV}" nomaster
done
# bring bonding master down
-ip link set ${DEVICE} down
+ip link set "${DEVICE}" down
# remove bonding master
-if grep -wq "${DEVICE}" /sys/class/net/bonding_masters; then
- echo "-${DEVICE}" > /sys/class/net/bonding_masters
+if [ -d "/sys/class/net/${DEVICE}" ]; then
+ ip link del "${DEVICE}" type bond
if [ $? -ne 0 ]; then
exit 1
fi
fi
if is_yes "$SLAVE" && [ -n "$MASTER" ] ; then
- if ! grep -wq "${DEVICE}" /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null; then
- nls "Enslaving %s to %s" "$DEVICE" "$MASTER"
- ip link set dev ${DEVICE} down
- echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
- fi
+ # create master if it doesn't exist yet
+ [ ! -d "/sys/class/net/${MASTER}" ] && ip link add "${MASTER}" type bond
+
+ nls "Enslaving %s to %s" "${DEVICE}" "${MASTER}"
+ ip link set "${DEVICE}" master "${MASTER}"
+ ip link set "${DEVICE}" up
+
exit 0
fi
if [ ! -f /sys/class/net/bonding_masters ]; then
modprobe -s bonding || exit 1
# delete default bond0
- echo "-bond0" > /sys/class/net/bonding_masters
+ ip link del bond0 type bond
fi
# set all major variables
setup_ip_param
# create bonding master
-if ! grep -wq "${DEVICE}" /sys/class/net/bonding_masters; then
- echo "+${DEVICE}" > /sys/class/net/bonding_masters
- if [ $? -eq 0 ]; then
- ip link set dev ${DEVICE} multicast ${MULTICAST} ${ARP}
- else
- exit 1
- fi
+if [ ! -d "/sys/class/net/${DEVICE}" ]; then
+ ip link add "${DEVICE}" type bond
fi
# add the bits to setup driver parameters here
continue
fi
- if /sbin/cryptsetup isLuks "$src" 2>/dev/null; then
+ if /sbin/cryptsetup --disable-locks isLuks "$src" 2>/dev/null; then
if key_is_random "$key"; then
nls "%s: LUKS requires non-random key, skipping" "$dst"
ret=1
if [ -n "$params" ]; then
nls "%s: options are invalid for LUKS partitions, ignoring them" "$dst"
fi
- /sbin/cryptsetup ${key:+-d $key} luksOpen "$src" "$dst" <&1
+ /sbin/cryptsetup --disable-locks ${key:+-d $key} luksOpen "$src" "$dst" <&1
fi
rc=$?
if [ $rc -ne 0 ]; then
[ -z "$dst" -o "${dst#\#}" != "$dst" ] && continue
if [ -b "/dev/mapper/$dst" ]; then
if LC_ALL=C /sbin/dmsetup info "$dst" | grep -q '^Open count: *0$'; then
- /sbin/cryptsetup remove "$dst"
+ /sbin/cryptsetup --disable-locks remove "$dst"
else
fnval=1
fi