SHA256
Initial commit
This commit is contained in:
commit
2212875018
9 files changed
+154
No files matched your search
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
|
||||
PREFIX="$(dirname $(realpath $0))/.."
|
||||
source "${PREFIX}/share/config.sh"
|
||||
|
||||
usage() {
|
||||
echo "usage: airup-mount [-t type] [-o options] [-n name] [-d dependencies] [from] [to]"
|
||||
echo
|
||||
echo "Create Airup service that mounts given filesystem."
|
||||
echo
|
||||
echo "options:"
|
||||
echo " -t limit the set of filesystem types"
|
||||
echo " -o comma-separated list of mount options"
|
||||
echo " -n name of the mount service"
|
||||
echo " -d dependencies of the mount service"
|
||||
exit 1
|
||||
}
|
||||
|
||||
deps_to_array() {
|
||||
[ -z "$1" ] && { printf '[]'; return; }
|
||||
|
||||
printf '%s' "$1" \
|
||||
| sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' \
|
||||
-e 's/[[:space:]]*,[[:space:]]*/", "/g' \
|
||||
-e 's/^/["/' -e 's/$/"]/'
|
||||
}
|
||||
|
||||
generate() {
|
||||
echo "[service]"
|
||||
echo "display-name = \"Filesystem ${dst}\""
|
||||
echo "description = \"This service mounts from ${src} to ${dst}.\""
|
||||
echo "kind = \"oneshot\""
|
||||
echo "dependencies = $(deps_to_array ${dependencies})"
|
||||
echo
|
||||
echo "[exec]"
|
||||
echo "start = \"mount -o '${options}' -t '${type}' '${src}' '${dst}'\""
|
||||
echo "stop = \"umount '${dst}'\""
|
||||
}
|
||||
|
||||
type="auto"
|
||||
options="defaults"
|
||||
|
||||
while getopts ":t:o:d:n:rh" opt; do
|
||||
case "$opt" in
|
||||
t) type="$OPTARG" ;;
|
||||
o) options="$OPTARG" ;;
|
||||
d) dependencies="$OPTARG" ;;
|
||||
n) name="$OPTARG" ;;
|
||||
r) raw=1 ;;
|
||||
:) usage ;;
|
||||
\?) usage ;;
|
||||
h) usage ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
src="$1"
|
||||
dst="$2"
|
||||
|
||||
[ -z "$name" ] && name=mount-$(echo "${dst#/}" | tr "/" "-")
|
||||
|
||||
if [ "$raw" = "1" ]; then
|
||||
generate
|
||||
else
|
||||
mkdir -p "${SERVICEDIR}" || exit 1
|
||||
generate >> "${SERVICEDIR}/${name}.airs"
|
||||
fi
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
echo "usage: airup-select-default-milestone [NAME]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ -z "$1" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -e "/share/milestones/$1.airm" ]; then
|
||||
ln -sf "/share/milestones/$1.airm" "/share/milestones/default.airm"
|
||||
else
|
||||
echo "error: milestone '$1' not found"
|
||||
exit 1
|
||||
fi
|
||||
Reference in new issue
Block a user