Skip to content

Commit

Permalink
put in install path checks for init.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Mar 20, 2018
1 parent 92407e8 commit 7202b28
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ignore comments files
todo.txt
notes.txt

# ignore mac generated files
.DS_Store

# ignore pycharm ide
.idea

# ignore compiled python scripts
*.pyc

# ignore virtual env
venv
29 changes: 25 additions & 4 deletions build/root/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,32 @@ source /root/aur.sh
# container perms
####

# create file with contets of here doc
cat <<'EOF' > /tmp/permissions_heredoc
# define comma separated list of paths
install_paths="/usr/lib/jackett,/var/lib/jackett,/home/nobody"

# split comma separated string into list for install paths
IFS=',' read -ra install_paths_list <<< "${install_paths}"

# process install paths in the list
for i in "${install_paths_list[@]}"; do

# confirm path(s) exist, if not then exit
if [[ ! -d "${i}" ]]; then
echo "[crit] Path '${i}' does not exist, exiting build process..." ; exit 1
fi

done

# convert comma separated string of install paths to space separated, required for chmod/chown processing
install_paths=$(echo "${install_paths}" | tr ',' ' ')

# create file with contents of here doc, note EOF is NOT quoted to allow us to expand current variable 'install_paths'
# we use escaping to prevent variable expansion for PUID and PGID, as we want these expanded at runtime of init.sh
# note - do NOT double quote variable for install_paths otherwise this will wrap space separated paths as a single string
cat <<EOF > /tmp/permissions_heredoc
# set permissions inside container
chown -R "${PUID}":"${PGID}" /usr/lib/jackett/ /var/lib/jackett/ /home/nobody
chmod -R 775 /usr/lib/jackett/ /var/lib/jackett/ /home/nobody
chown -R "\${PUID}":"\${PGID}" ${install_paths}
chmod -R 775 ${install_paths}
EOF

Expand Down

0 comments on commit 7202b28

Please sign in to comment.