2023-10-21 14:13:07 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
LIST="$(doas sysclean -a)"
|
|
|
|
|
|
|
|
FILES="$(echo "$LIST" | grep -v ^@)"
|
2023-10-23 15:31:20 +02:00
|
|
|
USERS="$(echo "$LIST" | grep ^@user | cut -d" " -f2 | cut -d":" -f1)"
|
|
|
|
GROUPS="$(echo "$LIST" | grep ^@group | cut -d" " -f2 | cut -d":" -f1)"
|
2023-10-21 14:13:07 +02:00
|
|
|
|
|
|
|
if [ ! -z "$FILES" ]
|
|
|
|
then
|
|
|
|
echo "$FILES"
|
|
|
|
echo -n "Delete these? [y/N] "
|
|
|
|
read
|
|
|
|
case $REPLY in
|
|
|
|
[yY]) echo "$FILES" | xargs doas rm -rf; ;;
|
|
|
|
esac
|
|
|
|
fi
|
2023-10-23 15:31:20 +02:00
|
|
|
|
|
|
|
if [ ! -z "$USERS" ]
|
|
|
|
then
|
|
|
|
echo "$USERS"
|
|
|
|
echo -n "Delete these users? [y/N] "
|
|
|
|
read
|
|
|
|
case $REPLY in
|
|
|
|
[yY]) echo "$USERS" | xargs -n1 doas userdel; ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z "$GROUPS" ]
|
|
|
|
then
|
|
|
|
echo "$GROUPS"
|
|
|
|
echo -n "Delete these groups? [y/N] "
|
|
|
|
read
|
|
|
|
case $REPLY in
|
|
|
|
[yY]) echo "$GROUPS" | xargs -n1 doas groupdel; ;;
|
|
|
|
esac
|
|
|
|
fi
|