From 433370e730866c8d511529cd9f7ec0b3de64acd3 Mon Sep 17 00:00:00 2001 From: pvincent Date: Fri, 7 Aug 2026 22:33:34 +0400 Subject: [PATCH] uninstall --- bin/miaou-bash | 4 ++-- lib/uninstall.bash | 13 +++++++++++++ uninstall.sh | 19 ------------------- 3 files changed, 15 insertions(+), 21 deletions(-) create mode 100644 lib/uninstall.bash delete mode 100755 uninstall.sh diff --git a/bin/miaou-bash b/bin/miaou-bash index 9c414c2..a626731 100755 --- a/bin/miaou-bash +++ b/bin/miaou-bash @@ -265,11 +265,11 @@ function on_error { } function self_upgrade { - sudo -E "$MIAOU_BASH_DIR/lib/self-upgrade.bash" + sudo -E miaou-bash "$MIAOU_BASH_DIR"/lib/self-upgrade.bash } function uninstall { - echo "TODO: uninstall" + sudo -E miaou-bash "$MIAOU_BASH_DIR"/lib/uninstall.bash } function populate_error_arrays { diff --git a/lib/uninstall.bash b/lib/uninstall.bash new file mode 100644 index 0000000..8395923 --- /dev/null +++ b/lib/uninstall.bash @@ -0,0 +1,13 @@ +#!/usr/bin/env miaou-bash + +# MAIN +[[ "$UID" -ne 0 ]] && echo 'root privilege required' && exit 1 + +cd +rm /etc/bash.bashrc +mv /etc/bash.bashrc.ORIGINAL /etc/bash.bashrc +rm /etc/inputc +mv /etc/inputrc.ORIGINAL /etc/inputrc +rm /etc/vimrc/vimrc.{azerty,core,local,miaou,rookie} +rm -rf /opt/miaou-bash +echo 'MIAOU-BASH fully uninstalled, restored from original' diff --git a/uninstall.sh b/uninstall.sh deleted file mode 100755 index 6bd964e..0000000 --- a/uninstall.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -[ "$(id -u)" -ne 0 ] && echo 'root privilege required' && exit 1 - -BASEDIR=$PWD -[ ! "$BASEDIR" == '/opt/miaou-bash' ] && echo 'should be installed in /opt/miaou-bash directory' && exit 1 - -ORIGINAL="ORIGINAL" -declare -a arr=(/etc/bash.bashrc /etc/inputrc /etc/vim/vimrc) - -for i in "${arr[@]}"; do - if [[ -f "$i" ]] && [[ -f "$i.$ORIGINAL" ]]; then - echo "uninstalling $i" - rm "$i" - mv "$i.$ORIGINAL" "$i" - else - echo "$i" not overriden - fi -done