Skip to content

Commit

Permalink
🔨 write a postrm script
Browse files Browse the repository at this point in the history
  • Loading branch information
ad2ien committed Feb 24, 2024
1 parent bdc9ef1 commit cca25ab
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ Only tried on Pop!_OS 22.04 LTS. Should work on any Debian based distri with X11
- [ ] man page
- [ ] commands : help, edit configuration...
- [ ] dockerize build
- [ ] logs
10 changes: 6 additions & 4 deletions debian/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
set -e

echo "Post install script of capslock-auto-switch"
echo "Enabling and starting service for "$SUDO_USER
deb-systemd-invoke --machine=$SUDO_USER@ --user daemon-reload
deb-systemd-invoke --machine=$SUDO_USER@ --user enable capslock-auto-switch
deb-systemd-invoke --machine=$SUDO_USER@ --user start capslock-auto-switch
echo " Enabling and starting service for $SUDO_USER"

systemctl --machine="$SUDO_USER@.host" --user daemon-reload
systemctl --machine="$SUDO_USER@.host" --user enable capslock-auto-switch
systemctl --machine="$SUDO_USER@.host" --user start capslock-auto-switch
10 changes: 10 additions & 0 deletions debian/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set +e

echo "Post remove script of capslock-auto-switch: $1"
systemctl --machine="$SUDO_USER@.host" --user stop capslock-auto-switch
systemctl --machine="$SUDO_USER@.host" --user disable capslock-auto-switch
systemctl --machine="$SUDO_USER@.host" --user daemon-reload

rm -f /etc/xdg/systemd/user/capslock-auto-switch.service
rm -f /etc/systemd/user/capslock-auto-switch.service

0 comments on commit cca25ab

Please sign in to comment.