distribution/packages/jelos/sources/scripts/factoryreset
fewtarius a69c7708fa
* New Danger Zone options - Overlay and Full Retroarch Reset.
* Overlay reset deletes overlays from /storage and reboots.  Useful for cleaning up broken joypad configurations or scenarios where users use the retroarch update tool.
  * Full retroarch reset deletes the entire retroarch directory and all overlay directories and reboots.  Useful for cleaning up when other resets don't resolve issues.
2024-01-09 12:05:50 +00:00

32 lines
979 B
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2020-present Shanti Gilbert (https://github.com/shantigilbert)
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
case "${1}" in
"retroarch")
rm -f /storage/.config/retroarch/retroarch.cfg
cp -rf /usr/config/retroarch/retroarch.cfg /storage/.config/retroarch/retroarch.cfg
;;
"retroarch-full")
rm -rf /storage/.config/retroarch
cp -rf /usr/config/retroarch /storage/.config/
;;
"mednafen")
rm -f /storage/.config/mednafen/mednafen.cfg
;;
"overlays")
rm -rf $(cat /usr/lib/systemd/system/tmp-*.mount | grep -Eo 'upperdir=.*,' | sed -e 's~upperdir=~~g; s~,~~g')
sync
systemctl reboot
;;
"ALL")
systemctl stop ${UI_SERVICE}
cd /
find /storage -mindepth 1 \( ! -regex '^/storage/.update.*' -a ! -regex '^/storage/roms.*' -a ! -regex '^/storage/games-*' \) -delete
mkdir /storage/.config/
sync
systemctl reboot
;;
esac