aboutsummaryrefslogtreecommitdiff
path: root/src/usr/libexec
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-09-29 22:47:28 -0400
committerB Stack <bgstack15@gmail.com>2020-09-29 22:47:28 -0400
commit0d5f8b7657527eab8380f5aa81ecd072714cf13c (patch)
tree80de0f0ea39fd4690d07f85856ab6511175bff8f /src/usr/libexec
parentadd sudo rule (diff)
downloadmyautomount-0d5f8b7657527eab8380f5aa81ecd072714cf13c.tar.gz
myautomount-0d5f8b7657527eab8380f5aa81ecd072714cf13c.tar.bz2
myautomount-0d5f8b7657527eab8380f5aa81ecd072714cf13c.zip
add sudo, fix initialization
Diffstat (limited to 'src/usr/libexec')
-rw-r--r--src/usr/libexec/myautomount/myautomount-initialize.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/usr/libexec/myautomount/myautomount-initialize.sh b/src/usr/libexec/myautomount/myautomount-initialize.sh
index 67fe2f3..1f7a42b 100644
--- a/src/usr/libexec/myautomount/myautomount-initialize.sh
+++ b/src/usr/libexec/myautomount/myautomount-initialize.sh
@@ -11,17 +11,18 @@ fail() {
setupSystem() {
_needrestart=0
mkdir -m0755 -p "${MYA_PREFIX}${AUTOMOUNT_DIR}" || fail "Could not setup autofs rules! Check if this is being run as root?"
- ! test -f "${MYA_PREFIX}${AUTOMOUNT_FILE}" && {
- { touch "${MYA_PREFIX}${AUTOMOUNT_FILE}" && echo "* -fstype=auto,rw,nosuid,uid=${USER},gid=users :/dev/& " > "${MYA_PREFIX}${AUTOMOUNT_FILE}" ; } || fail "Could not setup autofs rules! Check if this is being run as root?"
+ ! grep -q -e "uid=${AUTOMOUNT_USER}," "${MYA_PREFIX}${AUTOMOUNT_FILE}" 2>/dev/null && {
+ { touch "${MYA_PREFIX}${AUTOMOUNT_FILE}" && echo "* -fstype=auto,rw,nosuid,uid=${AUTOMOUNT_USER},gid=users :/dev/& " > "${MYA_PREFIX}${AUTOMOUNT_FILE}" ; } || fail "Could not setup autofs rules! Check if this is being run as root?"
_needrestart=1
}
- ! test -f "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" && {
+ ! grep -q -e "${AUTOMOUNT_BROWSEDIR}" "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" 2>/dev/null && {
{ touch "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" && echo "${AUTOMOUNT_BROWSEDIR} ${AUTOMOUNT_FILE} --timeout=5 " > "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" ; } || fail "Could not setup autofs rules! Check if this is being run as root?"
_needrestart=1
}
test ${_needrestart} -eq 1 && test -z "${MYA_SKIP_RESTART}" && eval "service autofs restart"
}
+export AUTOMOUNT_DAEMON=1 # to suppress the useless error about mktemp: failed to create file
. ${MYA_PREFIX}/etc/myautomount.conf
setupSystem
# must enforce exit 0 because otherwise an already-initialized system will end with test ${_needrestart} -eq 1 as false which will break `make`.
bgstack15