feat: flatpaksync submodule (#62)
This commit is contained in:
commit
a21e245279
6 changed files with 96 additions and 0 deletions
29
files/usr/bin/flatpaksync/flatpakcheckout
Executable file
29
files/usr/bin/flatpaksync/flatpakcheckout
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source $HOME/.config/flatpaksync/env
|
||||
|
||||
CHECKOUT_DIR=/tmp/sync
|
||||
|
||||
rm -rf $CHECKOUT_DIR
|
||||
|
||||
if [[ -n "${GIT_REPO}" ]]; then
|
||||
|
||||
git clone "$GIT_REPO" $CHECKOUT_DIR || exit 0
|
||||
|
||||
while IFS=$'\n' read -r app; do
|
||||
|
||||
flatpak install --user --noninteractive "$app" -y || HAS_FAILED="yes"
|
||||
|
||||
done <$CHECKOUT_DIR/flatpak.list
|
||||
|
||||
if [[ -z "${HAS_FAILED}" ]]; then
|
||||
|
||||
touch "$HOME"/.config/flatpaks.user.installed
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
echo "Repository not specified. Please enter it in $HOME/.config/flatpaksync/env in the POSIX pattern: GIT_REPO=<YOUR_REPO>"
|
||||
|
||||
fi
|
||||
13
files/usr/bin/flatpaksync/flatpaksync
Executable file
13
files/usr/bin/flatpaksync/flatpaksync
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CHECKOUT_DIR=/tmp/sync
|
||||
|
||||
rm -rf $CHECKOUT_DIR
|
||||
|
||||
git clone "$GIT_REPO" $CHECKOUT_DIR || exit 0
|
||||
|
||||
flatpak list --app --columns=app --user > $CHECKOUT_DIR/flatpak.list
|
||||
|
||||
cd $CHECKOUT_DIR || exit 0
|
||||
|
||||
git add . && git commit -m "." && git push
|
||||
10
files/usr/lib/systemd/user/flatpaksync/flatpaksync.path
Normal file
10
files/usr/lib/systemd/user/flatpaksync/flatpaksync.path
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Service monitoring the ~/.var/app directory
|
||||
|
||||
[Path]
|
||||
PathChanged=%h/.var/app
|
||||
PathChanged=%h/.config/flatpaks.user.installed
|
||||
Unit=flatpaksync.service
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
12
files/usr/lib/systemd/user/flatpaksync/flatpaksync.service
Normal file
12
files/usr/lib/systemd/user/flatpaksync/flatpaksync.service
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Flatpak synchronization service
|
||||
ConditionPathExists=%h/.config/flatpaksync/env
|
||||
ConditionPathExists=%h/.config/flatpaks.user.installed
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=%h/.config/flatpaksync/env
|
||||
ExecStart=/usr/bin/flatpaksync
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
Loading…
Add table
Add a link
Reference in a new issue