mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-06 23:23:51 +02:00
parent
311b9209f4
commit
dd9c6c8b22
4 changed files with 64 additions and 0 deletions
11
srcpkgs/sv-netmount/files/netmount/conf
Normal file
11
srcpkgs/sv-netmount/files/netmount/conf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Configuration for netmount service
|
||||||
|
|
||||||
|
# List of network filesystems
|
||||||
|
NETWORK_FS="nfs,nfs4,cifs,ceph,glusterfs,fuse.sshfs,davfs"
|
||||||
|
|
||||||
|
# Put here the network manager service name you use
|
||||||
|
# If you set static ip from rc.local leave commented or empty
|
||||||
|
#NETWORK_MANAGER=connmand
|
||||||
|
|
||||||
|
# You can specify your gateway or let it be detected
|
||||||
|
#GATEWAY=192.168.1.1
|
15
srcpkgs/sv-netmount/files/netmount/finish
Executable file
15
srcpkgs/sv-netmount/files/netmount/finish
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Load user defined variables
|
||||||
|
[ -r conf ] && . ./conf
|
||||||
|
|
||||||
|
# Don't do anything if ./run didn't exit properly
|
||||||
|
[ "$1" -eq 1 ] && exit 0
|
||||||
|
|
||||||
|
# Simply umount network filesystems
|
||||||
|
umount -a -f -t $NETWORK_FS > /dev/null 2>&1
|
||||||
|
ret=$?
|
||||||
|
[ $ret -ne 0 ] && umount -a -f -l -t $NETWORK_FS > /dev/null 2>&1
|
||||||
|
|
||||||
|
umount -a -f -O _netdev > /dev/null 2>&1
|
||||||
|
ret=$?
|
||||||
|
[ $ret -ne 0 ] && umount -a -f -l -O _netdev > /dev/null 2>&1
|
22
srcpkgs/sv-netmount/files/netmount/run
Executable file
22
srcpkgs/sv-netmount/files/netmount/run
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Load user defined variables
|
||||||
|
[ -r conf ] && . ./conf
|
||||||
|
|
||||||
|
# Ensure the network manager is running
|
||||||
|
[ -z "$NETWORK_MANAGER" ] || sv check "$NETWORK_MANAGER" 2> /dev/null || 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
|
||||||
|
|
16
srcpkgs/sv-netmount/template
Normal file
16
srcpkgs/sv-netmount/template
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Template file for 'sv-netmount'
|
||||||
|
pkgname=sv-netmount
|
||||||
|
version=0.1
|
||||||
|
revision=1
|
||||||
|
short_desc="Service to mount/umount network filesystems from fstab"
|
||||||
|
homepage="http://www.voidlinux.eu/"
|
||||||
|
maintainer="Olivier Mauras <olivier@mauras.ch>"
|
||||||
|
license="GPL-2"
|
||||||
|
build_style="meta"
|
||||||
|
|
||||||
|
depends="runit"
|
||||||
|
|
||||||
|
post_install() {
|
||||||
|
# runit services
|
||||||
|
vsv netmount
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue