Created
June 2, 2021 19:31
-
-
Save pmnlla/60d6414be21750463a24ebd401f9559d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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