blob: 0fbd03c1eab6f088b50ff22c14e0700cb9c048b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/bash
# This script is intended to be run by flatpak-sideload-usb-repo.service
shopt -s nullglob
if ! test $# -eq 1 || ! test -d "$1"; then
echo "Error: first argument must be a directory"
exit 1
fi
# Add a link to any newly inserted drives which might have been copied to with
# "flatpak create-usb". If we were to check for a repo on the drive that would
# break the case of using it for sideloading directly after copying to it (e.g.
# for testing).
for f in "$1"/*; do
if ! test -d "$f"; then
continue
fi
unique_name=automount$(systemd-escape "$f")
if test -e "/run/flatpak/sideload-repos/$unique_name"; then
continue
fi
ln -s "$f" "/run/flatpak/sideload-repos/$unique_name"
done
# Remove any broken symlinks e.g. from drives that were removed
for f in /run/flatpak/sideload-repos/automount*; do
if ! test -e "$f"; then
rm "$f"
fi
done
|