diff --git a/package/display/package b/package/display/package index 4e2937383..affb56eee 100644 --- a/package/display/package +++ b/package/display/package @@ -8,7 +8,7 @@ timestamp=2023-08-27T02:39:10Z maintainer="raisjn " license=MIT url="https://github.com/ddvk/remarkable2-framebuffer" -pkgver=1:0.0.32-1 +pkgver=1:0.0.32-2 _release="${pkgver%-*}" _release="v${_release#*:}" _libver=1.0.1 @@ -66,13 +66,13 @@ display() { systemctl daemon-reload if systemctl enable rm2fb --now; then # Restart xochitl if it's running - if systemctl --quiet is-active xochitl; then + if is-active xochitl; then # Reset the crash count so we don't trigger remarkable-fail echo "0" > /tmp/crashnum systemctl restart xochitl fi else - systemctl disable rm2fb --now + disable-unit rm2fb.service echo "Failed to start rm2fb. Keeping it disabled for now." echo "Please check the logs and open an issue:" echo " https://github.com/toltec-dev/toltec/issues/new" @@ -83,9 +83,7 @@ display() { preremove() { if [[ $arch = rm2 ]]; then - if systemctl list-units --full -all | grep -Fq 'rm2fb.service'; then - systemctl disable rm2fb --now - fi + disable-unit rm2fb.service echo -n "make sure " if ! is-enabled xochitl.service; then echo "to re-enable xochitl with 'systemctl enable xochitl --now'" diff --git a/package/draft/package b/package/draft/package index 2234c85f0..aac94f8e6 100644 --- a/package/draft/package +++ b/package/draft/package @@ -5,7 +5,7 @@ pkgnames=(draft) pkgdesc="Launcher which wraps around the standard interface" url=https://github.com/dixonary/draft-reMarkable -pkgver=0.2.0-21 +pkgver=0.2.0-22 timestamp=2020-07-20T10:23Z section="launchers" maintainer="Mattéo Delabre " @@ -60,10 +60,7 @@ configure() { } preremove() { - if systemctl list-units --full -all | grep -Fq "$pkgname.service"; then - echo "Disabling $pkgname" - systemctl disable --now "$pkgname" - fi + disable-unit "$pkgname.service" } postremove() { diff --git a/package/koreader/package b/package/koreader/package index fa3ffd56c..3568eb43a 100644 --- a/package/koreader/package +++ b/package/koreader/package @@ -5,7 +5,7 @@ pkgnames=(koreader) pkgdesc="Ebook reader supporting PDF, DjVu, EPUB, FB2 and many more formats" url=https://github.com/koreader/koreader -pkgver=2023.10-1 +pkgver=2023.10-2 timestamp=2023-10-30T17:19:28Z section="readers" maintainer="raisjn " @@ -62,15 +62,7 @@ MSG } preremove() { - if is-active "$pkgname"; then - echo "Stopping $pkgname" - systemctl stop "$pkgname" - fi - - if is-enabled "$pkgname"; then - echo "Disabling $pkgname" - systemctl disable "$pkgname" - fi + disable-unit "$pkgname.service" } postremove() { diff --git a/package/oxide/package b/package/oxide/package index 993d16996..8c2c32049 100644 --- a/package/oxide/package +++ b/package/oxide/package @@ -4,7 +4,7 @@ pkgnames=(erode fret oxide rot tarnish decay corrupt anxiety oxide-utils inject_evdev liboxide libsentry) _oxidever=2.6 -pkgver=$_oxidever-2 +pkgver=$_oxidever-3 _sentryver=0.5.0 timestamp=2023-06-05T23:27:53Z maintainer="Eeems " @@ -98,14 +98,7 @@ tarnish() { fi } preremove() { - if is-active tarnish; then - echo "Stopping tarnish" - systemctl stop tarnish - fi - if is-enabled tarnish; then - echo "Disabling tarnish" - systemctl disable tarnish - fi + disable-unit tarnish.service } postremove() { systemctl daemon-reload diff --git a/package/reboot-guard/package b/package/reboot-guard/package index ef9ceb257..965c8a59b 100644 --- a/package/reboot-guard/package +++ b/package/reboot-guard/package @@ -5,7 +5,7 @@ pkgnames=(reboot-guard) pkgdesc="Block systemd-initiated poweroff/reboot/halt until configurable condition checks pass" url=https://github.com/stephanritscher/reboot-guard -pkgver=1.0.1-7 +pkgver=1.0.1-8 timestamp=2020-05-04T06:16Z section="devel" maintainer="Eeems " @@ -34,14 +34,7 @@ configure() { } preremove() { - if is-active rguard.service; then - echo "Stopping rguard.service" - systemctl stop rguard.service - fi - if is-enabled rguard.service; then - echo "Disabling rguard.service" - systemctl disable rguard.service - fi + disable-unit rguard.service } postremove() { diff --git a/package/rmfakecloud-proxy/package b/package/rmfakecloud-proxy/package index 25b90d9b0..b9f247d55 100644 --- a/package/rmfakecloud-proxy/package +++ b/package/rmfakecloud-proxy/package @@ -7,7 +7,7 @@ pkgdesc="Connect Xochitl to a rmfakecloud server" _url=https://github.com/ddvk/rmfakecloud-proxy url="$_url" _upver=0.0.3 -pkgver="$_upver-3" +pkgver="$_upver-4" timestamp=2022-02-26T22:59Z section="utils" maintainer="Mattéo Delabre " @@ -55,7 +55,7 @@ configure() { install-hosts else uninstall-certificates - systemctl disable --now rmfakecloud-proxy + disable-unit rmfakecloud-proxy.service uninstall-hosts fi diff --git a/package/rmkit/package b/package/rmkit/package index be1585793..f8930555b 100644 --- a/package/rmkit/package +++ b/package/rmkit/package @@ -52,7 +52,7 @@ dumbskull() { genie() { pkgdesc="Gesture engine that connects commands to gestures" url="https://rmkit.dev/apps/genie" - pkgver=0.1.6-2 + pkgver=0.1.6-3 section="utils" package() { @@ -67,8 +67,7 @@ genie() { } preremove() { - echo "Disabling $pkgname" - systemctl disable --now "$pkgname" + disable-unit "$pkgname.service" } postremove() { @@ -146,7 +145,7 @@ nao() { remux() { pkgdesc="Launcher that supports multi-tasking applications" url="https://rmkit.dev/apps/remux" - pkgver=0.2.4-1 + pkgver=0.2.4-2 section="launchers" package() { @@ -166,8 +165,7 @@ remux() { } preremove() { - echo "Disabling $pkgname" - systemctl disable --now "$pkgname" + disable-unit "$pkgname.service" } postremove() { diff --git a/package/tailscale-systemd/package b/package/tailscale-systemd/package index 4e7fe832a..e8a7836f4 100644 --- a/package/tailscale-systemd/package +++ b/package/tailscale-systemd/package @@ -5,7 +5,7 @@ pkgnames=(tailscale-systemd) pkgdesc="SystemD configuration for tailscale" url=https://tailscale.com -pkgver=0.0.0-1 +pkgver=0.0.0-2 section="utils" timestamp=2023-07-12T00:00Z maintainer="Kai " @@ -30,15 +30,7 @@ configure() { } preremove() { - if is-active tailscaled; then - echo "Stopping tailscaled" - systemctl stop tailscaled - fi - - if is-enabled tailscaled; then - echo "Disabling tailscaled" - systemctl disable tailscaled - fi + disable-unit "tailscaled.service" } postremove() { diff --git a/package/toltec-base/package b/package/toltec-base/package index 87dd4aa26..b333afb84 100644 --- a/package/toltec-base/package +++ b/package/toltec-base/package @@ -6,7 +6,7 @@ archs=(rm1 rm2) pkgnames=(toltec-base) pkgdesc="Metapackage defining the base set of packages in a Toltec install" url=https://toltec-dev.org/ -pkgver=1.2-2 +pkgver=1.2-3 timestamp=2023-05-08T19:31Z section="utils" maintainer="Eeems " @@ -29,10 +29,8 @@ configure() { sed -i \ -e 's|^export TERM=xterm|if \[ -z "$TERM" \];then export TERM=xterm;fi|' \ /opt/etc/profile - if is-enabled "update-engine.service"; then - echo "Disabling automatic update" - systemctl disable --now update-engine - fi + echo "Disabling automatic update" + disable-unit update-engine.service if [[ "$arch" == "rm1" ]] && ! is-masked sys-subsystem-net-devices-usb1.device; then echo "Disabling usb1 network device to avoid long boots" systemctl mask sys-subsystem-net-devices-usb1.device diff --git a/package/webinterface-onboot/package b/package/webinterface-onboot/package index 899eea096..1d0613caa 100644 --- a/package/webinterface-onboot/package +++ b/package/webinterface-onboot/package @@ -6,7 +6,7 @@ _pkgname='webinterface-onboot' pkgnames=("$_pkgname") pkgdesc="Start the web interface without the cable, on boot." url="https://github.com/rM-self-serve/$_pkgname" -pkgver=1.2.2-1 +pkgver=1.2.2-2 timestamp=2023-12-03T11:43:00Z section="utils" maintainer="rM-self-serve <122753594+rM-self-serve@users.noreply.github.com>" @@ -73,14 +73,7 @@ _restore() { } preremove() { - if is-active "$pkgname"; then - echo "Stopping $pkgname" - systemctl stop "$pkgname" - fi - if is-enabled "$pkgname"; then - echo "Disabling $pkgname" - systemctl disable "$pkgname" - fi + disable-unit "$pkgname.service" _restore } diff --git a/package/webinterface-wifi/package b/package/webinterface-wifi/package index 196a859eb..655beab42 100644 --- a/package/webinterface-wifi/package +++ b/package/webinterface-wifi/package @@ -6,7 +6,7 @@ _pkgname="webinterface-wifi" pkgnames=("$_pkgname") pkgdesc="View the web interface if running, over wifi" url="https://github.com/rM-self-serve/$_pkgname" -pkgver=2.0.0-1 +pkgver=2.0.0-2 timestamp=2023-11-26T00:02:11Z section="utils" maintainer="rM-self-serve <122753594+rM-self-serve@users.noreply.github.com>" @@ -72,14 +72,7 @@ configure() { } preremove() { - if is-active "$pkgname"; then - echo "Stopping $pkgname" - systemctl stop "$pkgname" - fi - if is-enabled "$pkgname"; then - echo "Disabling $pkgname" - systemctl disable "$pkgname" - fi + disable-unit "$pkgname.service" } postremove() { diff --git a/package/xochitl/package b/package/xochitl/package index 1841988bf..07fa0a042 100644 --- a/package/xochitl/package +++ b/package/xochitl/package @@ -5,7 +5,7 @@ pkgnames=(xochitl) pkgdesc="Read documents and take notes" url=https://remarkable.com -pkgver=0.0.0-16 +pkgver=0.0.0-17 timestamp=2022-11-07T20:19:57Z section="readers" maintainer="Mattéo Delabre " @@ -83,9 +83,7 @@ configure() { } preremove() { - if is-active manual-sync.service; then - systemctl disable --now manual-sync.service - fi + disable-unit manual-sync.service } postremove() { diff --git a/scripts/install-lib b/scripts/install-lib index 59c35e2bb..e5e9f22a4 100644 --- a/scripts/install-lib +++ b/scripts/install-lib @@ -182,3 +182,31 @@ remove-bind-mount() { rm "$unit_path" systemctl daemon-reload } + +# Check to see if a systemd unit exists +# +# Arguments: +# +# $1 - Full name of the systemd unit, e.g. "draft.service" +unit-exists() { + [ "$(systemctl --quiet list-unit-files "${1}" | grep -c "${1}")" -eq 1 ] +} + +# Stops and disabled a unit +# +# Arguments: +# +# $1 - Full name of the systemd unit, e.g. "draft.service" +disable-unit() { + if ! unit-exists "${1}"; then + return + fi + if is-active "$1"; then + echo "Stopping ${1}" + systemctl stop "${1}" + fi + if is-enabled "${1}"; then + echo "Disabling ${1}" + systemctl disable "${1}" + fi +}