38 lines
761 B
Bash
Executable File
38 lines
761 B
Bash
Executable File
#!/bin/sh
|
|
|
|
LIST="$(doas sysclean -a)"
|
|
|
|
FILES="$(echo "$LIST" | grep -v ^@)"
|
|
USERS="$(echo "$LIST" | grep ^@user | cut -d" " -f2 | cut -d":" -f1)"
|
|
GROUPS="$(echo "$LIST" | grep ^@group | cut -d" " -f2 | cut -d":" -f1)"
|
|
|
|
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
|
|
|
|
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
|