Make variables in config.sh readonly

pull/58/head
Dan Puttick 2017-08-09 17:29:09 -04:00
parent b6564d7298
commit 9dd6b2c460
4 changed files with 24 additions and 26 deletions

View File

@ -1,29 +1,30 @@
USERNAME="kitten"
ID=`/usr/bin/id -u`
#!/bin/bash
set -eu
readonly USERNAME="kitten"
readonly ID=$(/usr/bin/id -u)
# Paths used in multiple scripts
SRC="src"
DEV_SRC="/dev/source_key"
SRC_MNT="/media/src"
readonly SRC="src"
readonly DEV_SRC="/dev/source_key"
readonly SRC_MNT="/media/src"
DST="dst"
DEV_DST="/dev/dest_key"
DST_MNT="/media/dst"
TEMP="${DST_MNT}/temp"
ZIPTEMP="${DST_MNT}/ziptemp"
LOGS="${DST_MNT}/logs"
DEBUG_LOG="/tmp/groomer_debug_log.txt"
MUSIC="/opt/midi/"
readonly DST="dst"
readonly DEV_DST="/dev/dest_key"
readonly DST_MNT="/media/dst"
readonly TEMP="${DST_MNT}/temp"
readonly LOGS_DIR="${DST_MNT}/logs"
readonly DEBUG_LOG="/tmp/groomer_debug_log.txt"
readonly MUSIC_DIR="/opt/midi/"
# Commands
SYNC="/bin/sync"
TIMIDITY="/usr/bin/timidity"
MOUNT="/bin/mount"
PMOUNT="/usr/bin/pmount -A -s"
PUMOUNT="/usr/bin/pumount"
readonly SYNC="/bin/sync"
readonly TIMIDITY="/usr/bin/timidity"
readonly MOUNT="/bin/mount"
readonly PMOUNT="/usr/bin/pmount -A -s"
readonly PUMOUNT="/usr/bin/pumount"
# Config flags
DEBUG=false
readonly DEBUG=false

View File

@ -22,7 +22,6 @@ clean(){
# Remove temporary files from destination key
rm -rf ${TEMP}
rm -rf ${ZIPTEMP}
}
trap clean EXIT TERM INT
@ -57,12 +56,12 @@ do
echo "GROOMER: ${partition} mounted at /media/${SRC}"
# Put the filenames from the current partition in a logfile
find "/media/${SRC}" -fls "${LOGS}/contents_partition_${PARTCOUNT}.txt"
find "/media/${SRC}" -fls "${LOGS_DIR}/contents_partition_${PARTCOUNT}.txt"
# Create a directory on ${DST} named PARTION_$PARTCOUNT
target_dir="/media/${DST}/FROM_PARTITION_${PARTCOUNT}"
mkdir -p "${target_dir}"
LOGFILE="${LOGS}/processing_log.txt"
LOGFILE="${LOGS_DIR}/processing_log.txt"
# Run the current partition through filecheck.py
echo "==== Starting processing of /media/${SRC} to ${target_dir}. ====" >> ${LOGFILE}

View File

@ -69,10 +69,8 @@ else
# Prepare temp dirs and make sure they're empty if they already exist
mkdir -p "${TEMP}"
mkdir -p "${ZIPTEMP}"
mkdir -p "${LOGS}"
rm -rf "${TEMP}/"*
rm -rf "${ZIPTEMP}/"*
rm -rf "${LOGS}/"*
fi

View File

@ -14,7 +14,7 @@ trap killed EXIT TERM INT
# Force output on analog
amixer cset numid=3 1
files=(${MUSIC}*)
files=(${MUSIC_DIR}*)
while true; do
# -id flags set interface to "dumb" and -qq silences most/all terminal output