Wren Linux

wren-linux / extras / udiskie.sh

#!/bin/bash
# retired: A stranger's stick mounted the moment it is plugged in is read by the kernel before you have decided to trust it. The usb command, in the base, mounts one as you when you ask: usb mount, usb unmount (an encrypted one asks for its passphrase). Its --remove leaves udisks2, which usb needs.
# What is left of this extra is its --remove, for whoever still has it set up: update.sh offers it,
# and so does wrenctl remove udiskie. It can't be installed any more; the rest of it was deleted.
# Usage: bash udiskie.sh --remove
# summary: USB drives mount by themselves (noexec), LUKS too
# security: some
# category: files
# status: apt:udiskie
. "$(dirname -- "${BASH_SOURCE[0]}")/../lib.sh"
if [ "${1:-}" = --manual ]; then echo "Retired: only --remove is left (bash extras/udiskie.sh --remove)."; exit; fi
need_user

UCONF="$HOME/.config/udiskie/config.yml"
UMARK="# Written by Wren Linux extras/udiskie.sh"
# what earlier versions wrote, still recognised as Wren Linux's
OLD_UMARK="# Written by Wren Linux parts/udiskie.sh"

[ "${1:-}" = --remove ] || die "udiskie was retired; only --remove is left. Mount a stick with: usb mount"

remove_snippet automount
pkill -x udiskie || true
remove_bin luks-askpass
if grep -qxF -e "$UMARK" -e "$OLD_UMARK" "$UCONF" 2>/dev/null; then rm -f "$UCONF"; fi
# cryptsetup stays: an encrypted system disk needs it to boot
sudo apt-mark manual cryptsetup >/dev/null
apt_purge udiskie udisks2 gir1.2-notify-0.7