Skip to content

Commit bccd9cd

Browse files
committed
put in install path checks for init.sh
1 parent 7293041 commit bccd9cd

File tree

2 files changed

+40
-10
lines changed

2 files changed

+40
-10
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# ignore comments files
2+
todo.txt
3+
notes.txt
4+
5+
# ignore mac generated files
6+
.DS_Store
7+
8+
# ignore pycharm ide
9+
.idea
10+
11+
# ignore compiled python scripts
12+
*.pyc
13+
14+
# ignore virtual env
15+
venv

build/root/install.sh

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,32 @@ source /root/aur.sh
4747
# container perms
4848
####
4949

50-
# create file with contets of here doc
51-
cat <<'EOF' > /tmp/permissions_heredoc
52-
# set permissions inside container
53-
chown -R "${PUID}":"${PGID}" /usr/bin/tvheadend /run /home/nobody
54-
chmod -R 775 /usr/bin/tvheadend /run /home/nobody
50+
# define comma separated list of paths
51+
install_paths="/run,/home/nobody"
5552

56-
# if dvb adapter(s) passed through then set permissions
57-
if [[ -d /dev/dvb ]]; then
58-
chown -R "${PUID}":"${PGID}" /dev/dvb
59-
chmod -R 775 /dev/dvb
60-
fi
53+
# split comma separated string into list for install paths
54+
IFS=',' read -ra install_paths_list <<< "${install_paths}"
55+
56+
# process install paths in the list
57+
for i in "${install_paths_list[@]}"; do
58+
59+
# confirm path(s) exist, if not then exit
60+
if [[ ! -d "${i}" ]]; then
61+
echo "[crit] Path '${i}' does not exist, exiting build process..." ; exit 1
62+
fi
63+
64+
done
65+
66+
# convert comma separated string of install paths to space separated, required for chmod/chown processing
67+
install_paths=$(echo "${install_paths}" | tr ',' ' ')
68+
69+
# create file with contents of here doc, note EOF is NOT quoted to allow us to expand current variable 'install_paths'
70+
# we use escaping to prevent variable expansion for PUID and PGID, as we want these expanded at runtime of init.sh
71+
# note - do NOT double quote variable for install_paths otherwise this will wrap space separated paths as a single string
72+
cat <<EOF > /tmp/permissions_heredoc
73+
# set permissions inside container
74+
chown -R "\${PUID}":"\${PGID}" ${install_paths}
75+
chmod -R 775 ${install_paths}
6176
6277
EOF
6378

0 commit comments

Comments
 (0)