diff --git a/circlean_fs/root_partition/opt/groomer/config.sh b/circlean_fs/root_partition/opt/groomer/config.sh index e69bf2e..4ef51d9 100755 --- a/circlean_fs/root_partition/opt/groomer/config.sh +++ b/circlean_fs/root_partition/opt/groomer/config.sh @@ -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 diff --git a/circlean_fs/root_partition/opt/groomer/groomer.sh b/circlean_fs/root_partition/opt/groomer/groomer.sh index daeb027..7e6b89e 100755 --- a/circlean_fs/root_partition/opt/groomer/groomer.sh +++ b/circlean_fs/root_partition/opt/groomer/groomer.sh @@ -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} diff --git a/circlean_fs/root_partition/opt/groomer/mount_dest.sh b/circlean_fs/root_partition/opt/groomer/mount_dest.sh index a32b45d..16437b4 100755 --- a/circlean_fs/root_partition/opt/groomer/mount_dest.sh +++ b/circlean_fs/root_partition/opt/groomer/mount_dest.sh @@ -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 diff --git a/circlean_fs/root_partition/opt/groomer/music.sh b/circlean_fs/root_partition/opt/groomer/music.sh index 0ac07f1..81d8122 100755 --- a/circlean_fs/root_partition/opt/groomer/music.sh +++ b/circlean_fs/root_partition/opt/groomer/music.sh @@ -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