Skip to content

Commit

Permalink
Use better var name for doc dir
Browse files Browse the repository at this point in the history
  • Loading branch information
framps committed Jul 28, 2024
1 parent f90588c commit 010f4b6
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@

set -uo pipefail

readonly REPOSITORY="framps"
# Has to be updatedwhen PR is accepted
readonly REPOSITORY="framps" # UnconnectedBedna
readonly BRANCH="install" # testing

readonly PACKAGE_FILE="shrink-backup"
readonly LICENSE_FILE="LICENSE"
readonly README_FILE="README.md"
readonly DIR_LICENSE="/usr/share/doc/$PACKAGE_FILE"
readonly DIR_DOC="/usr/share/doc/$PACKAGE_FILE"
readonly DIR_EXE="/usr/local/sbin"
readonly DIR_ETC="/usr/local/etc"
readonly DOWNLOAD_REPOSITORY="https://raw.githubusercontent.com/$REPOSITORY/$PACKAGE_FILE/install"
readonly DOWNLOAD_REPOSITORY="https://raw.githubusercontent.com/$REPOSITORY/$PACKAGE_FILE/$BRANCH"
readonly FILES_2_DOWNLOAD=("$PACKAGE_FILE" "${PACKAGE_FILE}.conf" "$LICENSE_FILE" "$README_FILE")
readonly FILES_2_STORE=("$DIR_EXE" "$DIR_ETC" "$DIR_LICENSE" "$DIR_LICENSE")
readonly FILES_2_STORE=("$DIR_EXE" "$DIR_ETC" "$DIR_DOC" "$DIR_DOC")
readonly TMP_DIR=$(mktemp -d)

function cleanup() {
Expand Down Expand Up @@ -62,11 +65,11 @@ for (( i=0; i<${#FILES_2_DOWNLOAD[@]}; i++ )); do
(( $? )) && { echo "chmod of $sourceFile failed"; exit 1; }
sed --follow-symlinks -i -E "s/^(INSTALL_METHOD)=.+$/\1=\'curl\'/" "$sourceFile"
(( $? )) && { echo "sed of $sourceFile failed"; exit 1; }
elif [[ ! -d "$DIR_LICENSE" ]] && [[ "$sourceFile" == "$LICENSE_FILE" || "$sourceFile" == "$README_FILE" ]] ; then # create LICENSE directory
sudo mkdir -p "$DIR_LICENSE"
(( $? )) && { echo "mkdir of $DIR_LICENSE failed"; exit 1; }
sudo chown root:root "${DIR_LICENSE}/.."
(( $? )) && { echo "chown of ${DIR_LICENSE}/.. failed"; exit 1; }
elif [[ ! -d "$DIR_DOC" ]] && [[ "$sourceFile" == "$LICENSE_FILE" || "$sourceFile" == "$README_FILE" ]] ; then # create LICENSE directory
sudo mkdir -p "$DIR_DOC"
(( $? )) && { echo "mkdir of $DIR_DOC failed"; exit 1; }
sudo chown root:root "${DIR_DOC}/.."
(( $? )) && { echo "chown of ${DIR_SOC}/.. failed"; exit 1; }
fi
sudo mv "${sourceFile}" "${targetDir}"
(( $? )) && { echo "mv of $sourceFile failed"; exit 1; }
Expand Down

0 comments on commit 010f4b6

Please sign in to comment.