diff --git a/README.md b/README.md index 9062612..eb89b35 100644 --- a/README.md +++ b/README.md @@ -49,13 +49,15 @@ $ sudo egpu-switcher setup ``` Uninstall: -> **Warning**: Do not use this command on any version prior to 0.10.2! +> **Critical Warning**: **Do not use this command on any version prior to `0.10.2`!**\ > There was a critical typo in the Makefile which would delete your `/usr/bin` folder. Please do a manual uninstall by removing the `egpu-switcher` folder in the `/usr/bin/` and the `/usr/share/` directory. ```bash $ sudo egpu-switcher cleanup $ make uninstall ``` +> **Hint**: Up until version `0.12.0` there was an [issue](https://github.com/hertg/egpu-switcher/issues/25) that the cleanup command needed the egpu-switcher to be set up for the cleanup to work. If you are having trouble to cleanup, remove or upgrade the egpu-switcher take a look at [this possible fix](https://github.com/hertg/egpu-switcher/issues/25#issuecomment-590728815). + ## Commands
egpu-switcher setup [--override] [--noprompt] diff --git a/debian/changelog b/debian/changelog index cfe42c4..fbda4fe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +egpu-switcher (0.13.0) disco; urgency=medium + + * Prevent error on cleanup if setup hasnt been executed + * Remove unnecessary console print + + -- Michael HertigThu, 27 Feb 2020 23:33:13 +0100 + egpu-switcher (0.12.0) disco; urgency=medium * Better GPU detection with "lspci -d" (thanks to xabolcs) diff --git a/debian/files b/debian/files index aef805f..d5e29ef 100644 --- a/debian/files +++ b/debian/files @@ -1 +1 @@ -egpu-switcher_0.12.0_source.buildinfo utils optional +egpu-switcher_0.13.0_source.buildinfo utils optional diff --git a/egpu-switcher b/egpu-switcher index 17394b0..65ebb89 100755 --- a/egpu-switcher +++ b/egpu-switcher @@ -412,16 +412,14 @@ function cleanup() { rm -f ${xfile_internal} # delete the xorg.conf file, if it is a symlink and restore the last backup - if [ -L ${xfile} ]; then - rm -f ${xfile} - if [ -e ${xfile_backup}.* ]; then - local lastbackup=$(ls -t ${xfile_backup}.* | head -1) - print_info "Restoring latest backup ${green}${lastbackup}" - mv ${lastbackup} ${xfile} - else - print_info "Backup not found, restoring system without xorg.conf" - fi + if [ -L ${xfile} ]; then + rm -f ${xfile} + if [ -e ${xfile_backup}.* ]; then + local lastbackup=$(ls -t ${xfile_backup}.* | head -1) + print_info "Restoring latest backup ${green}${lastbackup}" + mv ${lastbackup} ${xfile} fi + fi if [ ${hard} -eq 1 ]; then print_info "Removing configuration files (--hard)" @@ -429,11 +427,16 @@ function cleanup() { rm -fd ${config_dir} fi - systemctl stop egpu.service - systemctl disable egpu.service - rm ${systemd_folder}/egpu.service - systemctl daemon-reload - systemctl reset-failed + # only try to stop the egpu.service if its loaded. + # note: using sed rather than the --value property on purpose, to support older versions of systemd + if [ $(sudo systemctl show -p LoadState egpu.service | sed 's/LoadState=//g') == "loaded" ]; then + print_info "Removing the 'egpu.service' systemd service" + systemctl stop egpu.service + systemctl disable egpu.service + rm ${systemd_folder}/egpu.service + systemctl daemon-reload + systemctl reset-failed + fi print_success "Done... Finished cleanup" } diff --git a/images/screenshot_setup.png b/images/screenshot_setup.png index a01c455..794cf1d 100644 Binary files a/images/screenshot_setup.png and b/images/screenshot_setup.png differ