Skip to content

Commit

Permalink
Add quotation marks for paths with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Hooverdan96 committed Jun 19, 2024
1 parent 46efed7 commit abf1758
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions hdhomerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
############################################################################################################
# hdhomerun.sh
# Shell Script to prepare the container data and execute the record engine
# Version 2.5.4
# Version 2.5.6
# engine is run inside docker container, only exposing configuration and recording directory
# freely after https://github.com/demonrik/HDHR-DVR-docker
#
Expand Down Expand Up @@ -286,26 +286,26 @@ update_engine()
fi

echo "$(date -u)" "Downloading latest release" >> ${HDHR_LOG}
wget -qO ${HDHR_HOME}/${DVRBin}_rel ${DownloadURL}
wget -qO "${HDHR_HOME}/${DVRBin}_rel" "${DownloadURL}"
if [ "$BetaEngine" -eq "1" ]; then
echo "$(date -u)" "Downloading latest beta" >> ${HDHR_LOG}
wget -qO ${HDHR_HOME}/${DVRBin}_beta ${BetaURL}
wget -qO "${HDHR_HOME}/${DVRBin}_beta" ${BetaURL}
echo "$(date -u)" "Comparing which is newest" >> ${HDHR_LOG}
if [ ${HDHR_HOME}/${DVRBin}_rel -nt ${DVRData}/${DVRBin}_beta ] ; then
echo "$(date -u)" "Release version is newer - selecting as record engine" >> ${HDHR_LOG}
mv ${HDHR_HOME}/${DVRBin}_rel ${DVRData}/${DVRBin}
rm ${HDHR_HOME}/${DVRBin}_beta
mv "${HDHR_HOME}/${DVRBin}_rel" "${DVRData}/${DVRBin}"
rm "${HDHR_HOME}/${DVRBin}_beta"
chmod u+x ${DVRData}/${DVRBin}
elif [ ${HDHR_HOME}/${DVRBin}_rel -ot ${HDHR_HOME}/${DVRBin}_beta ]; then
echo "$(date -u)" "Beta version is newer - selecting as record engine" >> ${HDHR_LOG}
mv ${HDHR_HOME}/${DVRBin}_beta ${HDHR_HOME}/${DVRBin}
rm ${HDHR_HOME}/${DVRBin}_rel
chmod u+x ${HDHR_HOME}/${DVRBin}
mv "${HDHR_HOME}/${DVRBin}_beta" "${HDHR_HOME}/${DVRBin}"
rm "${HDHR_HOME}/${DVRBin}_rel"
chmod u+x "${HDHR_HOME}/${DVRBin}"
else
echo "$(date -u)" "Both versions are same - using the Release version" >> ${HDHR_LOG}
mv ${HDHR_HOME}/${DVRBin}_rel ${HDHR_HOME}/${DVRBin}
rm ${HDHR_HOME}/${DVRBin}_beta
chmod u+x ${HDHR_HOME}/${DVRBin}
mv "${HDHR_HOME}/${DVRBin}_rel" "${HDHR_HOME}/${DVRBin}"
rm "${HDHR_HOME}/${DVRBin}_beta"
chmod u+x "${HDHR_HOME}/${DVRBin}"
fi
else
mv ${HDHR_HOME}/${DVRBin}_rel ${HDHR_HOME}/${DVRBin}
Expand Down Expand Up @@ -351,13 +351,19 @@ adjust_ownership()
{
echo "$(date -u)" "** Adjusting Files and directory ownerships to $HDHR_USER" >> ${HDHR_LOG}
# adjust directories
chown ${HDHR_USER}:${HDHR_GRP} ${DVRData}
chown ${HDHR_USER}:${HDHR_GRP} ${DVRRec}
chown ${HDHR_USER}:${HDHR_GRP} ${HDHR_HOME}
echo "$(date -u)" "** Ownership change of Config Directory: $DVRData" >> ${HDHR_LOG}
chown ${HDHR_USER}:${HDHR_GRP} "${DVRData}"
echo "$(date -u)" "** Ownership change of Recording Directory: $DVRRec" >> ${HDHR_LOG}
chown ${HDHR_USER}:${HDHR_GRP} "${DVRRec}"
echo "$(date -u)" "** Ownership change of DVR Working Directory: HDHR_HOME" >> ${HDHR_LOG}
chown ${HDHR_USER}:${HDHR_GRP} "${HDHR_HOME}"
# adjust files
chown ${HDHR_USER}:${HDHR_GRP} ${HDHR_HOME}/${DVRBin}
chown ${HDHR_USER}:${HDHR_GRP} ${HDHR_LOG}
chown ${HDHR_USER}:${HDHR_GRP} ${DVRData}/${DVRConf}
echo "$(date -u)" "** Ownership change of DVR: $DVRBin" >> ${HDHR_LOG}
chown ${HDHR_USER}:${HDHR_GRP} "${HDHR_HOME}/${DVRBin}"
echo "$(date -u)" "** Ownership change of Log File: $HDHR_LOG" >> ${HDHR_LOG}
chown ${HDHR_USER}:${HDHR_GRP} "${HDHR_LOG}"
echo "$(date -u)" "** Ownership change of Configuration File: $DVRConf" >> ${HDHR_LOG}
chown ${HDHR_USER}:${HDHR_GRP} "${DVRData}/${DVRConf}"
}

############################################################################################################
Expand Down

0 comments on commit abf1758

Please sign in to comment.