From c455b051034f2f64ca8fa8dda0fc19845f7c4b25 Mon Sep 17 00:00:00 2001 From: IFo Hancroft Date: Fri, 5 Feb 2021 19:13:56 +0200 Subject: [PATCH 1/5] Changed /usr/local/ to /usr/ to avoid the problems that come from using /usr/local/ --- install.sh | 4 ++-- uninstall.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 40dc2e7..d66d0ed 100755 --- a/install.sh +++ b/install.sh @@ -10,7 +10,7 @@ Installer="$(readlink -f "$0")" SourcePath="${Installer%/*}" -InstallPath="/usr/local" +InstallPath="/usr" BinPath="$InstallPath/bin" LauncherPath="$InstallPath/share/applications" IconPath="$InstallPath/share/icons/hicolor/scalable/apps" @@ -90,4 +90,4 @@ sudo cp -v "pdfmted-editor" "pdfmted-inspector" "pdfmted-thumbnailer" "${BinPath sudo cp -v "desktop/pdfmted-editor.desktop" "desktop/pdfmted-inspector.desktop" "${LauncherPath}/" sudo cp -v "desktop/pdfmted.svg" "${IconPath}/" -echo "Done." \ No newline at end of file +echo "Done." diff --git a/uninstall.sh b/uninstall.sh index f9cd23c..9e3941d 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -7,7 +7,7 @@ # Variables -InstallPath="/usr/local" +InstallPath="/usr" BinPath="$InstallPath/bin" LauncherPath="$InstallPath/share/applications" IconPath="$InstallPath/share/icons/hicolor/scalable/apps" @@ -39,4 +39,4 @@ echo "Uninstalling $Application ..." [[ -f "$LauncherPath/pdfmted-inspector.desktop" ]] && sudo rm -v "$LauncherPath/pdfmted-inspector.desktop" [[ -f "$IconPath/pdfmted.svg" ]] && sudo rm -v "$IconPath/pdfmted.svg" -echo "Done." \ No newline at end of file +echo "Done." From 81c168daf8e5958fcb929c913368b73186bfafd7 Mon Sep 17 00:00:00 2001 From: IFo Hancroft Date: Thu, 9 Sep 2021 20:16:11 +0300 Subject: [PATCH 2/5] reverted moving /usr/local to /usr and added directory creation if they do not exist --- install.sh | 6 +++++- uninstall.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index d66d0ed..ca20c8c 100755 --- a/install.sh +++ b/install.sh @@ -10,11 +10,15 @@ Installer="$(readlink -f "$0")" SourcePath="${Installer%/*}" -InstallPath="/usr" +InstallPath="/usr/local" BinPath="$InstallPath/bin" LauncherPath="$InstallPath/share/applications" IconPath="$InstallPath/share/icons/hicolor/scalable/apps" +mkdir -p "$BinPath" +mkdir -p "$LaunchPath" +mkdir -p "$IconPath" + Application="PDFMtEd" InstallationFiles=("desktop/pdfmted-editor.desktop" "desktop/pdfmted-inspector.desktop"\ "desktop/pdfmted.svg" "pdfmted-editor" "pdfmted-inspector" "pdfmted-thumbnailer") diff --git a/uninstall.sh b/uninstall.sh index 9e3941d..1b8f627 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -7,7 +7,7 @@ # Variables -InstallPath="/usr" +InstallPath="/usr/local" BinPath="$InstallPath/bin" LauncherPath="$InstallPath/share/applications" IconPath="$InstallPath/share/icons/hicolor/scalable/apps" From 4ed99b822a406e27ccfda48797c3292281036f77 Mon Sep 17 00:00:00 2001 From: IFo Hancroft Date: Fri, 10 Sep 2021 23:59:05 +0300 Subject: [PATCH 3/5] Fixed a typo Fixed a typo where I was trying to create a dir using an unexisting variable $LaunchPath instead of $LauncherPath --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 9e46e7e..399fd18 100755 --- a/install.sh +++ b/install.sh @@ -16,7 +16,7 @@ LauncherPath="$InstallPath/share/applications" IconPath="$InstallPath/share/icons/hicolor/scalable/apps" mkdir -p "$BinPath" -mkdir -p "$LaunchPath" +mkdir -p "$LauncherPath" mkdir -p "$IconPath" Application="PDFMtEd" From df2e51b2604389aa67558c9d24921b97c2193d3f Mon Sep 17 00:00:00 2001 From: aliraeisdanaei Date: Wed, 15 Mar 2023 09:43:39 -0400 Subject: [PATCH 4/5] Changed install.sh to try alt install directory --- install.sh | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 399fd18..4eafffb 100755 --- a/install.sh +++ b/install.sh @@ -11,13 +11,13 @@ Installer="$(readlink -f "$0")" SourcePath="${Installer%/*}" InstallPath="/usr/local" +InstallPathAlt="/usr" BinPath="$InstallPath/bin" LauncherPath="$InstallPath/share/applications" IconPath="$InstallPath/share/icons/hicolor/scalable/apps" - -mkdir -p "$BinPath" -mkdir -p "$LauncherPath" -mkdir -p "$IconPath" +BinPathAlt="$InstallPathAlt/bin" +LauncherPathAlt="$InstallPathAlt/share/applications" +IconPathAlt="$InstallPathAlt/share/icons/hicolor/scalable/apps" Application="PDFMtEd" InstallationFiles=("desktop/pdfmted-editor.desktop" "desktop/pdfmted-inspector.desktop"\ @@ -52,14 +52,24 @@ check_sourcefiles(){ done } +# First argument is the installation directory to check +# Second argument is the alt installation directory +# Third argument is the name of the installation dir variable check_destinations(){ - for i in "$@"; do - if [[ ! -d "$i" ]]; then - echo "Error: Installation directory not found ($i)" - echo "Aborting installation." - exit 1 - fi - done + if [[ ! -d "$1" ]]; then + echo "Error: Installation directory not found ($1)" + echo "Trying alternative Installation directory ($2)" + if [[ ! -d "$2" ]]; then + echo "Error: Alternative Installation directory not found ($2)" + echo "Aborting installation." + exit 1 + else + echo "Changing to alternative Installation directory" + # using name reference to change the actual variable for 1 + local -n installpath=$3 + installpath=$2 + fi + fi } # Main @@ -84,8 +94,11 @@ echo "Checking installation files for integrity..." check_sourcefiles "${InstallationFiles[@]}" echo "Checking installation directory..." -check_destinations "$BinPath" "$LauncherPath" "$IconPath" +check_destinations "$BinPath" "$BinPathAlt" "BinPath" +check_destinations "$LauncherPath" "$LauncherPathAlt" "LauncherPath" +check_destinations "$IconPath" "$IconPathAlt" "IconPath" +exit 0 echo "Checking dependencies..." check_deps "${Dependencies[@]}" From 79d91b98172ce9bfeea1db3af68ea4dd9009fef9 Mon Sep 17 00:00:00 2001 From: aliraeisdanaei Date: Wed, 15 Mar 2023 09:48:27 -0400 Subject: [PATCH 5/5] removed testing exit, and installed successfuly --- install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install.sh b/install.sh index 4eafffb..80f3b14 100755 --- a/install.sh +++ b/install.sh @@ -98,7 +98,6 @@ check_destinations "$BinPath" "$BinPathAlt" "BinPath" check_destinations "$LauncherPath" "$LauncherPathAlt" "LauncherPath" check_destinations "$IconPath" "$IconPathAlt" "IconPath" -exit 0 echo "Checking dependencies..." check_deps "${Dependencies[@]}"