Browse Source

uninstall

main
pvincent 3 days ago
parent
commit
433370e730
  1. 4
      bin/miaou-bash
  2. 13
      lib/uninstall.bash
  3. 19
      uninstall.sh

4
bin/miaou-bash

@ -265,11 +265,11 @@ function on_error {
} }
function self_upgrade { 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 { function uninstall {
echo "TODO: uninstall"
sudo -E miaou-bash "$MIAOU_BASH_DIR"/lib/uninstall.bash
} }
function populate_error_arrays { function populate_error_arrays {

13
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'

19
uninstall.sh

@ -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
Loading…
Cancel
Save