Skip to content

Instantly share code, notes, and snippets.

@pmnlla
Created June 2, 2021 19:31
Show Gist options
  • Save pmnlla/60d6414be21750463a24ebd401f9559d to your computer and use it in GitHub Desktop.
Save pmnlla/60d6414be21750463a24ebd401f9559d to your computer and use it in GitHub Desktop.
CODE: SELECT ALL
#!/bin/bash
# First parameter should be start or stop
# Second parameter will be the name of a unit file
if [ $# -lt 2 ]
then
echo "usage: $0 start unit-file"
exit 0
fi
if [ $1 == "start" ]
then
what=$(grep What /etc/systemd/system/"$2" | cut -f 2 -d '=')
where=$(grep Where /etc/systemd/system/"$2" | cut -f 2 -d '=')
mkdir -p "$where"
mount $what $where
exit 0
fi
if [ $1 == "stop" ]
then
where=$(grep Where /etc/systemd/system/"$2" | cut -f 2 -d '=')
umount $where
exit 0
fi
## source: https://forum.mxlinux.org/viewtopic.php?f=94&t=44060&p=435179&hilit=snapd#p435179
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment