Files
proton-drive-linux/packaging/proton-drive.install
nvrl e0442c56b9 fix(packaging): stop the service before the package is removed
Removing the package left the user service running from the deleted
binary, with ~/ProtonDrive still mounted. A user who then deleted the
folder to clean up had every file in it moved to the Proton Drive trash,
as any delete through the mount is.

The .deb (prerm on remove), the .rpm (%preun on erase) and the Arch
packages (pre_remove) now stop proton-drive.service for every user with
a running user manager, through runuser with that user's
XDG_RUNTIME_DIR, so no systemd-machined is needed. Upgrades are left
alone. Queued writes stay in the state directory for a later install.

The pacman install script lives once in packaging/ and the AUR
directories link it; push.sh copies its content into each AUR
repository. The uninstall guide now warns not to delete the mount point
while the service runs.

Reported on Reddit by a user who restored the files from the trash.
2026-10-12 00:07:07 +02:00

20 lines
978 B
Plaintext

# pacman install script, shared by packaging/PKGBUILD and the three AUR packages
# (each links it). The same loop is in packaging/deb/prerm and the RPM %preun.
# Removing the package does not stop a running daemon: it keeps serving the
# mount from the deleted binary, so files deleted under the mount afterwards,
# `rm -rf ~/ProtonDrive` included, are still deleted on Proton Drive. Stop every
# logged-in user's service first; anything still queued stays on disk for the
# next install. Upgrades call pre_upgrade, not this.
pre_remove() {
for dir in /run/user/*; do
user=$(id -nu "${dir##*/}" 2>/dev/null) || continue
if runuser -u "$user" -- env XDG_RUNTIME_DIR="$dir" \
systemctl --user --quiet is-active proton-drive.service 2>/dev/null; then
echo "Stopping Proton Drive for $user, which unmounts its drive."
runuser -u "$user" -- env XDG_RUNTIME_DIR="$dir" \
systemctl --user stop proton-drive.service 2>/dev/null || :
fi
done
}