summarylogtreecommitdiffstats
path: root/netmount.run
blob: 9b0f4d72f9b4c84fd54aab969e7196923b955833 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# Load user defined variables
[ -r conf ] && . ./conf

# Ensure the network manager is running
[ -z "$NETWORK_MANAGER" ] || sv check "$NETWORK_MANAGER" > /dev/null 2>&1 || exit 1

# If it's running or not in used - rc.local - discover default gateway
if [ -z "$GATEWAY" ]; then
    set -- $(ip route show | grep default)
    GATEWAY="$3"
fi

ping -W 1 -c 1 $GATEWAY > /dev/null 2>&1 || exit 1

# Network is up and running so now mount network filesystems from fstab
mount -a -t "$NETWORK_FS" || exit 1
mount -a -O _netdev || exit 1

# Then wait to behave like the service is up
exec chpst -b netmount pause