puneetsl / lotion

Unofficial Notion.so app for Linux
MIT License
2.01k stars 87 forks source link

Can't uninstall from ./uninstall.sh #113

Open mohammadhany opened 2 years ago

mohammadhany commented 2 years ago

i Can't uninstall from ./uninstall.sh. i am using fedora linux and after installing i tried to uninstall but in vain

file:///home/mohammadhanyemara/Pictures/Screenshots/Screenshot%20from%202022-08-20%2012-43-08.png

heeler-deer commented 2 years ago

hi ,i'm using ubuntu and face the same challenge i modify the uninstall.sh like that:

#!/usr/bin/env bash

export check="\xE2\x9C\x94"
export cross="\xE2\x9D\x8C"
command=$1
if [[  ! $command =~ native|web ]]; then
    printf "\nSelect which version you would want to uninstall:\n\n"
    select command in web native
    do
        if [[ $command =~ native|web ]]; then
            echo $command
            break
        else
            echo "Please input 1 or 2"
        fi
    done
fi
uninstall_prep() {
  export install_dir
  export shortcut_dir
  export exec_dir

  local share_dir
  share_dir="/usr/share"

  if [[ -d ${share_dir}/lotion ]]; then
    install_dir="${share_dir}/lotion-$command"
    shortcut_dir="${share_dir}/applications"
    exec_dir="/usr/bin"
  else
    install_dir="$(pwd)/Lotion-$command"
    shortcut_dir="/usr/share/applications"
    exec_dir="/usr/bin"
  fi
}

delete_directory() {
  if [[ -d "${install_dir}" ]]; then
    rm -Rf "${install_dir}" || exit
    echo -e "${check} ${install_dir} was successfully deleted."
  else
    echo -e "${cross} ${install_dir} directory was not found. Skipping."
  fi
}
if [[ $command == 'web' ]]; then
  shortcut_file=Lotion.desktop
else
  shortcut_file=Notion_native.desktop
fi

delete_files() {
  declare -a files
  files=("${shortcut_dir}/${shortcut_file}" "${exec_dir}/lotion-$command" "${exec_dir}/lotion_uninstall")

  for file in "${files[@]}"; do
    if [[ -f "${file}" ]]; then
      rm "${file}" || exit
      echo -e "${cross} ${file} was successfully deleted."
    else
      echo -e "${cross} ${file} was not found. Skipping."
    fi
  done
}

uninstall_prep
delete_directory
delete_files

you should modify last 2 lines in function uninstall_prep() for your path