828 lines
31 KiB
Bash
Executable File
828 lines
31 KiB
Bash
Executable File
#!/bin/bash
|
|
## For laptop lid trigger: Write following in /etc/acpi/events/lm_lid
|
|
# event=button/lid.*
|
|
# action=/data/DatenLucas/Dokumente/Dokumente/Projekte/Server/scripts/quiethost/wallpaperChanger.sh -l -c
|
|
LOG_DIR="/home/lucas/.LOG/"
|
|
IMG_DIR="/data/DatenLucas/Media/Stuff/Wallpaper/"
|
|
PrivKey="file:/home/lucas/Documents/Dokumente/Projekte/Server/quiethost/IMG_privateKey.pem"
|
|
MONITOR_FILE="/home/lucas/.config/monitors.xml"
|
|
THALES=false
|
|
IMG_FOLDER="Desktop1920x1080/"
|
|
X_FOLDER="corrupt"
|
|
DAEMON=false
|
|
LOG=false
|
|
DECODE_SINGLE=false
|
|
REMOVE=false
|
|
CUSTOM_DIR=false
|
|
CONFIG=false
|
|
CONFIGFILE="wp.conf"
|
|
DEVICE_CARD="card0"
|
|
NAMING_TABLE="naming_table.txt"
|
|
NAMING_TABLE_ENC="naming_table_enc.txt"
|
|
EXCLUDE_CONFIG_DEF="XXXDEFAULTXXX"
|
|
REPLACE_ENC_IMG=false
|
|
WC_USER="lucas"
|
|
WC_GROUP="lucas"
|
|
EDIT_CONFIG=false
|
|
usage(){
|
|
printf "Usage:
|
|
-u\t\t\tUDEV Mode
|
|
-a\t\t\tacapid Mode(Lid Close DAEMON)
|
|
-t <min>\t\tStart DAEMON and Change Image every min Interval
|
|
-p <path>\t\tPath of Image folder
|
|
-s <search>\t\tChose Search Parameters(everything until next -*)
|
|
-ex <exclude>\t\tExclude String from Search
|
|
-c\t\t\tUse Config File
|
|
-l\t\t\tUse Log File
|
|
-elements\tInclude Spectral Lines of Elements Pictures
|
|
-thales\t\t\tUse thales Config
|
|
-e\t\t\tEdit Config File
|
|
-h\t\t\tDisplay this\n"
|
|
}
|
|
usageX(){
|
|
printf "UsageX:
|
|
-x\t\t\tSwitch Source Folder to X
|
|
-X\t\t\tClear Config and change Wallpaper
|
|
-dec_all\t\tDecode all Images
|
|
-dec_leave\t\tLeave used Images decoded
|
|
-dec_arg <pattern>\tDecode certain Images matching pattern *<arg>*
|
|
-printNT\t\tDecode NT to stdout
|
|
-modifyNT\t\tDecode NT/Encode if decoded NT present
|
|
-replace\t\tReplace Image in NT
|
|
-insta\t\tInsta Mode\n"
|
|
}
|
|
change_image(){
|
|
SZ="1920x1080"
|
|
IMGtype=("Wallpaper" "Screensaver" "Grub" "Login")
|
|
valueGnomeOpt=("'stretched'" "'spanned'")
|
|
typeGnomeOpt=("background" "screensaver")
|
|
MONITOR_num=$((${#screen_width_X[@]} - 1))
|
|
EXCLUDE=${EXCLUDE_CONFIG}
|
|
for IMG in $(find ${IMG_DIR}${IMG_FOLDER} -name '*.jp*g' -or -name '*.JP*G'); do
|
|
if [ "$(identify $IMG | grep -iP "jp[e]?g")" != "" ]; then
|
|
convert "$IMG" "$(echo $IMG | sed 's/JP[E]\?G/png/g' | sed 's/jp[e]\?g/png/g')"
|
|
rm "$IMG"
|
|
IMG="$(echo $IMG | sed 's/JP[E]\?G/png/g' | sed 's/jp[e]\?g/png/g')"
|
|
fi
|
|
done
|
|
if [ "${IMG_FOLDER}" == "${X_FOLDER}" ] && [ "${DAEMON}" == "false" ];then
|
|
echo "Check Encryprion"
|
|
check_encryption
|
|
fi
|
|
IMG_NUM_TOTAL=$(find ${IMG_DIR}${IMG_FOLDER} -name '*.png' | wc -l)
|
|
for (( i=0;i<${#IMGtype[@]};i++ )); do # i = Background/Screensaver/Grub
|
|
echo "Change ${IMGtype[${i}]}"
|
|
if [ ${i} -ge 2 ]; then
|
|
EXCLUDE="Panorama"
|
|
if [ "${IMG_FOLDER}" == "${X_FOLDER}" ];then
|
|
echo Search
|
|
SEARCH=""
|
|
IMG_FOLDER="Desktop1920x1080/"
|
|
fi
|
|
if [[ ${i} -eq 3 ]] && [[ ${THALES} == "false" ]]; then
|
|
SEARCH=""
|
|
SEARCH[0]="Elements"
|
|
EXCLUDE=${EXCLUDE_CONFIG_DEF}
|
|
fi
|
|
for (( k=0;k<${#SEARCH[@]};k++ )); do
|
|
SEARCH[$k]="$(echo "${SEARCH[$k]}" | sed 's/Panorama//g')"
|
|
done
|
|
fi
|
|
if [ "${IMG_FOLDER}" == "${X_FOLDER}" ];then
|
|
echo "Decode Naming Table"
|
|
file_path="${IMG_DIR}${IMG_FOLDER}/"
|
|
if [ -f "${file_path}${NAMING_TABLE_ENC}" ];then
|
|
openssl enc -d -aes-256-cbc -pbkdf2 -salt -in "${file_path}${NAMING_TABLE_ENC}" -out "${file_path}${NAMING_TABLE}" -pass "${PrivKey}"
|
|
fi
|
|
fi
|
|
ConvertSTR=""
|
|
for (( j=0;j<${MONITOR_num};j++ )); do # j = Screen
|
|
ind=$((${i}*2+$j))
|
|
img_fit_counter=0;
|
|
IMG_FIT=false
|
|
while ! $IMG_FIT; do
|
|
if [ ${#SEARCH[@]} -eq 1 ]; then
|
|
SEARCH_PARAMETER=${SEARCH[0]}
|
|
else
|
|
SEARCH_PARAMETER=${SEARCH[$ind]}
|
|
fi
|
|
SEARCH_NUM="$(echo ${SEARCH_PARAMETER} | grep -oE "[[:digit:]]{2}")"
|
|
SEARCH_STR="$(echo ${SEARCH_PARAMETER} | grep -oE "[^[:digit:]]+")"
|
|
echo "Search Parameter: ${SEARCH_STR} - ${SEARCH_NUM}, exclude ${EXCLUDE}"
|
|
if [ "${IMG_FOLDER}" == "${X_FOLDER}" ];then
|
|
IMG_count=$(cat "${file_path}${NAMING_TABLE}" | cut -f1 -d';' | grep -i "${SEARCH_STR}.*${SEARCH_NUM}" | grep -iv "${EXCLUDE}" | grep -v "_decrypted" | wc -l)
|
|
else
|
|
IMG_count=$(find ${IMG_DIR}${IMG_FOLDER} -name '*.png' | grep -i "${SEARCH_STR}.*${SEARCH_NUM}" | grep -iv "${EXCLUDE}" | grep -v "_decrypted" | wc -l)
|
|
fi
|
|
if [ ${IMG_count} -eq 0 ];then
|
|
echo "No image found for ${IMGtype[${i}]} ${SEARCH_STR}"
|
|
if [ "${SEARCH_STR}" == "" ];then
|
|
exit 1
|
|
else
|
|
SEARCH=""
|
|
continue
|
|
fi
|
|
else
|
|
echo "${IMG_count} Images found"
|
|
fi
|
|
NUM=$(($RANDOM % $IMG_count))
|
|
if [ "${IMG_FOLDER}" == "${X_FOLDER}" ];then
|
|
IFS=$'\n'; set -f
|
|
IMG_ARR=($(cat "${file_path}${NAMING_TABLE}" | cut -f1 -d';' | grep -i "${SEARCH_STR}.*${SEARCH_NUM}" | grep -iv "${EXCLUDE}"))
|
|
IMG_ENC_ARR=($(cat "${file_path}${NAMING_TABLE}" | grep "$(echo ${IMG_ARR[@]} | sed 's/ /\\\|/g')" | cut -f2 -d';'))
|
|
unset IFS; set +f
|
|
else
|
|
IFS=$'\n'; set -f
|
|
IMG_ARR=($(find ${IMG_DIR}${IMG_FOLDER} -name '*.png' | grep -i "${SEARCH_STR}.*${SEARCH_NUM}" | grep -iv "${EXCLUDE}" | grep -v "_decrypted"))
|
|
unset IFS; set +f
|
|
fi
|
|
IMG=${IMG_ARR[$NUM]}
|
|
for (( k=0;k<${#IMAGES[@]};k++ ));do
|
|
if [[ ("${SEARCH[0]}" != "${SEARCH_PARAMETER}" && "${SEARCH_NUM}" != "" ) || ("${SEARCH[0]}" == "${SEARCH_PARAMETER}" && "${SEARCH_NUM}" == "") ]]; then
|
|
counter=0;
|
|
while [[ "${IMG}" == ${IMAGES[$k]} && ${counter} -lt ${IMG_count} ]]; do
|
|
echo Disable Same Image
|
|
NUM=$(($RANDOM % $IMG_count))
|
|
IMG=${IMG_ARR[$NUM]}
|
|
((counter++))
|
|
done
|
|
fi
|
|
done
|
|
IMAGES[$ind]=$IMG
|
|
if [ "${IMG_FOLDER}" == "${X_FOLDER}" ];then
|
|
echo "Decrypt Image"
|
|
IMG_DEC=${file_path}${IMG}
|
|
IMG_ENC=${IMG_ENC_ARR[$NUM]}
|
|
if [ -f "${file_path}${IMG_DEC}" ]; then
|
|
echo "File Name already present: ${IMG_DEC}"
|
|
IMG_DEC="$(echo "${IMG_DEC}" | sed 's/.png/_DOUBLE_'"${RANDOM}"'\.png/g')"
|
|
fi
|
|
openssl enc -aes-256-cbc -pbkdf2 -d -in "${file_path}${IMG_ENC}" -out "${IMG_DEC}" -pass "${PrivKey}"
|
|
if [ $? -eq 0 ]; then
|
|
echo "Decryption Succesfull"
|
|
else
|
|
echo "Decryption failed"
|
|
fi
|
|
IMG=${IMG_DEC}
|
|
fi
|
|
if [[ "$(echo ${IMG} | grep "Elements/Elements_")" != "" ]]; then
|
|
for ((k=0;k<3;k++)); do
|
|
if [ ${i} -lt 3 ]; then
|
|
POINTSIZE=12
|
|
else
|
|
POINTSIZE=24
|
|
fi
|
|
IFS=$'\n'; set -f
|
|
IMG_ARR2=($(find ${IMG_DIR}${IMG_FOLDER} -name '*.png' | grep "Elements/Elements_" | grep -v "${IMG}"))
|
|
unset IFS; set +f
|
|
IMG_count2=${#IMG_ARR2[@]}
|
|
NUM=$(($RANDOM % $IMG_count2))
|
|
IMG2=${IMG_ARR2[$NUM]}
|
|
convert -append $IMG $IMG2 "${LOG_DIR}NextCombined.png"
|
|
NUM=$(echo $IMG | grep -o -P '(?<=Panorama_).*(?=.png)' | cut -f1 -d'_')
|
|
NUM2=$(echo $IMG2 | grep -o -P '(?<=Panorama_).*(?=.png)' | cut -f1 -d'_')
|
|
LET=$(echo $IMG | grep -o -P '(?<=Panorama_).*(?=.png)' | cut -f2 -d'_')
|
|
LET2=$(echo $IMG2 | grep -o -P '(?<=Panorama_).*(?=.png)' | cut -f2 -d'_')
|
|
NAME=$(echo $IMG | grep -o -P '(?<=Panorama_).*(?=.png)' | cut -f3 -d'_')
|
|
NAME2=$(echo $IMG2 | grep -o -P '(?<=Panorama_).*(?=.png)' | cut -f3 -d'_')
|
|
NAME="$(printf "%s %s %s" "$NUM" "$LET" "$NAME")"
|
|
if [ "$( echo ${NAME} | grep -o "[A-Za-z]")" == "" ]; then NAME=${NAME_BUF}; fi
|
|
NAME2="$(printf "%s %s %s" "$NUM2" "$LET2" "$NAME2")"
|
|
if [ $(( ${k}%2 )) -eq 0 ]; then
|
|
y_1=$(( 510 + k*540 ));
|
|
y_2=$(( 580 + k*540 ));
|
|
convert -font helvetica -fill white -pointsize ${POINTSIZE} -draw "text 20,'${y_1}' '${NAME}' text 20,'${y_2}' '${NAME2}'" "${LOG_DIR}NextCombined.png" "${LOG_DIR}NextCombined.png"
|
|
fi
|
|
IMG="${LOG_DIR}NextCombined.png"
|
|
NAME_BUF=${NAME2}
|
|
if [ ${i} -lt 3 ]; then break; fi
|
|
done
|
|
fi
|
|
## Aspect Ratio Part
|
|
imageAR=$(getAspectRatio ${IMG})
|
|
printf "%s%d: $(echo ${IMG} | rev | cut -f1 -d'/' | rev) IAR: %s - SAR: %s\n" "${IMGtype[${i}]}" "${j}" "${imageAR}" "${screen_Aspect_Ratio[$j]}"
|
|
if [[ "$IMG" == "" ]]; then exit; fi
|
|
BIGIMG=false
|
|
AR_tolerance="0.26"
|
|
if [ $(echo ${imageAR}'=='${screenAR_ARR[${i}]} | bc -l) -eq 1 ]; then
|
|
# if [ ${MONITOR_num} -eq 1 ]; then break; fi
|
|
echo "Copy $((${screen_width_X[$j]}*${MONITOR_num}))x${screen_height_Y[$j]} Image"
|
|
cp "$IMG" "${LOG_DIR}Next${IMGtype[${i}]}.png"
|
|
IMG_FIT=true
|
|
BIGIMG=true
|
|
j=${MONITOR_num}
|
|
if [ "${IMG_FOLDER}" == "${X_FOLDER}" ] && ! ${DECODE_SINGLE} ;then
|
|
echo "Remove Decrypted Image"
|
|
rm ${IMG}
|
|
fi
|
|
break
|
|
elif [[ $(echo ${imageAR}'<'${screenAR_ARR[${i}]}'*(1+'${AR_tolerance}')' | bc -l) -eq 1 && $(echo ${imageAR}'>'${screenAR_ARR[${i}]}'*(1-'${AR_tolerance}')' | bc -l) -eq 1 ]] ;then
|
|
# if [ ${MONITOR_num} -eq 1 ]; then break; fi
|
|
echo "Convert Image to $((${screen_width_X[$j]}*${MONITOR_num}))x${screen_height_Y[$j]}"
|
|
convert "$IMG" -resize $((${screen_width_X[$j]}*${MONITOR_num}))x${screen_height_Y[$j]}\! "${LOG_DIR}Next${IMGtype[${i}]}.png"
|
|
IMG_FIT=true
|
|
BIGIMG=true
|
|
j=${MONITOR_num}
|
|
if [ "${IMG_FOLDER}" == "${X_FOLDER}" ] && ! ${DECODE_SINGLE} ;then
|
|
echo "Remove Decrypted Image"
|
|
rm "${IMG}"
|
|
fi
|
|
break
|
|
elif [ $(echo ${imageAR}'=='${screen_Aspect_Ratio[$j]} | bc -l) -eq 1 ]; then
|
|
img_height_X="$(identify $IMG | cut -f3 -d' ' | cut -f2 -d'x')"
|
|
img_width_Y="$(identify $IMG | cut -f3 -d' ' | cut -f1 -d'x')"
|
|
#echo "${img_width_Y}x${img_height_X}:${screen_width_X[$j]}x${screen_height_Y[$j]}"
|
|
if [[ "${img_width_Y}" != "${screen_width_X[$j]}" || "${img_height_X}" != "${screen_height_Y[$j]}" ]]; then
|
|
echo "Convert Image to ${screen_width_X[$j]}x${screen_height_Y[$j]} Image"
|
|
IMG_FIT=true
|
|
convert "$IMG" -resize ${screen_width_X[$j]}x${screen_height_Y[$j]}\! "${LOG_DIR}IMG$ind.png"
|
|
ConvertSTR="$ConvertSTR ${LOG_DIR}IMG$ind.png"
|
|
else
|
|
echo "Copy ${screen_width_X[$j]}x${screen_height_Y[$j]} Image"
|
|
IMG_FIT=true
|
|
cp "$IMG" "${LOG_DIR}IMG$ind.png"
|
|
ConvertSTR="$ConvertSTR ${LOG_DIR}IMG$ind.png"
|
|
fi
|
|
elif [[ $(echo ${imageAR}'<'${screen_Aspect_Ratio[$j]}'*(1+'${AR_tolerance}')' | bc -l) -eq 1 && $(echo ${imageAR}'>'${screen_Aspect_Ratio[$j]}'*(1-'${AR_tolerance}')' | bc -l) -eq 1 ]]; then
|
|
echo "Convert Image to ${screen_width_X[$j]}x${screen_height_Y[$j]}"
|
|
convert "$IMG" -resize ${screen_width_X[$j]}x${screen_height_Y[$j]}\! "${LOG_DIR}IMG$ind.png"
|
|
cp "$IMG" "$( echo "${IMG}_bak" | sed 's/_decrypted//g')"
|
|
IMG_FIT=true
|
|
cp "${LOG_DIR}IMG$ind.png" "$IMG"
|
|
ConvertSTR="$ConvertSTR ${LOG_DIR}IMG$ind.png"
|
|
else
|
|
echo "Image ${IMG} out of bounds"
|
|
fi
|
|
((img_fit_counter++))
|
|
if [ "${IMG_FOLDER}" == "${X_FOLDER}" ] && ! ${DECODE_SINGLE} ;then
|
|
echo "Remove Decrypted Image"
|
|
rm "${IMG}"
|
|
fi
|
|
if [ $img_fit_counter -ge $IMG_NUM_TOTAL ]; then
|
|
echo "No Images Found. Change Search Parameter"
|
|
break
|
|
fi
|
|
done
|
|
done
|
|
if ! $BIGIMG; then
|
|
convert $ConvertSTR -background black +append ${LOG_DIR}Next${IMGtype[${i}]}.png
|
|
fi
|
|
mv ${LOG_DIR}Next${IMGtype[${i}]}.png ${LOG_DIR}Current${IMGtype[${i}]}.png
|
|
chmod 777 ${LOG_DIR}Current${IMGtype[${i}]}.png
|
|
if [[ "$(whoami)" == "root" && ${i} -lt 2 ]]; then
|
|
if [ "$(su ${WC_USER} -c "gsettings get org.gnome.desktop.${typeGnomeOpt[${i}]} picture-uri")" != "'file://${LOG_DIR}Current${IMGtype[${i}]}.png'" ]; then
|
|
echo Set gsettings ${type[${i}]} picture-uri
|
|
su ${WC_USER} -c "gsettings set org.gnome.desktop.${typeGnomeOpt[${i}]} picture-uri file://${LOG_DIR}Current${IMGtype[${i}]}.png"
|
|
fi
|
|
if [ "$(su ${WC_USER} -c "gsettings get org.gnome.desktop.${typeGnomeOpt[${i}]} picture-options")" != "'spanned'" ]; then
|
|
echo Set gsettings ${typeGnomeOpt[${i}]} picture-options
|
|
su ${WC_USER} -c "gsettings set org.gnome.desktop.${typeGnomeOpt[${i}]} picture-options spanned"
|
|
fi
|
|
chown ${WC_USER}:${WC_GROUP} ${LOG_DIR}*png
|
|
elif [ ${i} -lt 2 ]; then
|
|
if [ "$(gsettings get org.gnome.desktop.${typeGnomeOpt[${i}]} picture-uri)" != "'file://${LOG_DIR}Current${IMGtype[${i}]}.png'" ]; then
|
|
echo Set gsettings ${type[${i}]} picture-uri
|
|
gsettings set org.gnome.desktop.${typeGnomeOpt[${i}]} picture-uri file://${LOG_DIR}Current${IMGtype[${i}]}.png
|
|
fi
|
|
if [ "$(gsettings get org.gnome.desktop.${typeGnomeOpt[${i}]} picture-options)" != "'spanned'" ]; then
|
|
echo Set gsettings ${typeGnomeOpt[${i}]} picture-options
|
|
gsettings set org.gnome.desktop.${typeGnomeOpt[${i}]} picture-options spanned
|
|
fi
|
|
fi
|
|
if [ "${IMG_FOLDER}" == "${X_FOLDER}" ] ;then
|
|
echo "Remove Naming Table"
|
|
rm "${file_path}${NAMING_TABLE}"
|
|
fi
|
|
done
|
|
}
|
|
getAspectRatio() {
|
|
if [ "$1" == "" ]; then return "0"; fi
|
|
identify "$1" | perl -ne '/(.+?)\s+[A-Z]{3}\s+(\d+)x(\d+)/; print $3/$2, "\n"'
|
|
}
|
|
decode_all() {
|
|
echo "Decode all Images"
|
|
IMG_FOLDER_TMP="${X_FOLDER}"
|
|
file_path="${IMG_DIR}${IMG_FOLDER_TMP}/"
|
|
if [ -f "${file_path}${NAMING_TABLE_ENC}" ];then
|
|
openssl enc -d -aes-256-cbc -pbkdf2 -salt -in "${file_path}${NAMING_TABLE_ENC}" -out "${file_path}${NAMING_TABLE}" -pass "${PrivKey}"
|
|
fi
|
|
for file in $(find ${IMG_DIR}${IMG_FOLDER_TMP} -name '*.png_enc'); do
|
|
if [ "$(identify ${file} 2>>/dev/null | grep "PNG")" == "" ]; then
|
|
DEC_NAME="${file_path}$(cat "${file_path}${NAMING_TABLE}" | grep "$(echo ${file} | rev | cut -f1 -d'/' | rev)" | cut -f1 -d';')"
|
|
if [ -f "${file_path}${DEC_NAME}" ]; then
|
|
echo "File Name already present: ${DEC_NAME}"
|
|
DEC_NAME="$(echo "${DEC_NAME}" | sed 's/.png/_DOUBLE_'"${RANDOM}"'\.png/g')"
|
|
else
|
|
echo "Decode ${DEC_NAME}"
|
|
fi
|
|
openssl enc -d -aes-256-cbc -pbkdf2 -salt -in "${file}" -out "${DEC_NAME}" -pass "${PrivKey}"
|
|
rm ${file}
|
|
fi
|
|
done
|
|
rm "${file_path}${NAMING_TABLE_ENC}"
|
|
rm "${file_path}${NAMING_TABLE}"
|
|
}
|
|
check_encryption() {
|
|
IMG_FOLDER="${X_FOLDER}"
|
|
ENC_FILE_COUNT=0;
|
|
file_path="${IMG_DIR}${IMG_FOLDER}/"
|
|
for file in $(find ${IMG_DIR}${IMG_FOLDER} -name '*.png_enc'); do
|
|
ENC_FILE_ARR[${ENC_FILE_COUNT}]=${file}
|
|
((ENC_FILE_COUNT++))
|
|
done
|
|
((ENC_FILE_COUNT--))
|
|
IFS=$'\n' ENC_FILE_ARR=($(sort <<<"${ENC_FILE_ARR[*]}"))
|
|
unset IFS
|
|
if [ -f "${file_path}${NAMING_TABLE_ENC}" ];then
|
|
openssl enc -d -aes-256-cbc -pbkdf2 -salt -in "${file_path}${NAMING_TABLE_ENC}" -out "${file_path}${NAMING_TABLE}" -pass "${PrivKey}"
|
|
fi
|
|
for file in $(find ${IMG_DIR}${IMG_FOLDER} -name '*.png' | sort); do
|
|
if [ "$(identify ${file} 2>>/dev/null | grep "PNG")" != "" ]; then
|
|
if [ ${#ENC_FILE_ARR[@]} -eq 0 ]; then
|
|
ENC_FILE_COUNT=0
|
|
ENC_NAME_CORE="0"
|
|
cat "${file_path}${NAMING_TABLE}"
|
|
else
|
|
ENC_NAME_CORE=$(( $(echo "${ENC_FILE_ARR[${ENC_FILE_COUNT}]}" | cut -d'.' -f1 | rev | cut -f1 -d'/' | rev | bc) + 1))
|
|
((ENC_FILE_COUNT++))
|
|
fi
|
|
ENC_NAME="$(printf "%05d" ${ENC_NAME_CORE}).png_enc"
|
|
ENC_FILE_ARR[${ENC_FILE_COUNT}]=${ENC_NAME}
|
|
if [ -f "${file_path}${ENC_NAME}" ]; then
|
|
echo "File Name already present: ${ENC_NAME}"
|
|
ENC_NAME="$(echo "${ENC_NAME_CORE}")_DOUBLE_${RANDOM}.png_enc"
|
|
else
|
|
echo "Encode ${file} to ${ENC_NAME}"
|
|
fi
|
|
file_identifier="$( echo "${file}" | rev | cut -f1 -d'/' | rev)"
|
|
if [ -f "${file_path}${NAMING_TABLE}" ];then
|
|
if [ "$(cat "${file_path}${NAMING_TABLE}" | grep "${file_identifier}")" != "" ] && ! ${REPLACE_ENC_IMG} ; then
|
|
echo "Identifier ${file_identifier} already present, changing to"
|
|
file_identifier="$(echo "${file_identifier}" | sed 's/\.png/_enc_DOUBLE_'"${RANDOM}"'\.png/g')"
|
|
echo "${file_identifier}"
|
|
echo "${file_identifier};${ENC_NAME}" >> "${file_path}${NAMING_TABLE}"
|
|
elif [ "$(cat "${file_path}${NAMING_TABLE}" | grep "${file_identifier}")" != "" ] && ${REPLACE_ENC_IMG} ; then
|
|
ENC_NAME="$(cat "${file_path}${NAMING_TABLE}" | grep "${file_identifier}" | cut -d';' -f2)"
|
|
echo "Identifier ${file_identifier} already present, replacing image ${ENC_NAME}"
|
|
else
|
|
echo "${file_identifier};${ENC_NAME}" >> "${file_path}${NAMING_TABLE}"
|
|
fi
|
|
fi
|
|
openssl enc -aes-256-cbc -pbkdf2 -salt -in "${file}" -out "${file_path}${ENC_NAME}" -pass "${PrivKey}"
|
|
rm "${file}"
|
|
fi
|
|
done
|
|
openssl enc -aes-256-cbc -pbkdf2 -salt -in "${file_path}${NAMING_TABLE}" -out "${file_path}${NAMING_TABLE_ENC}" -pass "${PrivKey}"
|
|
rm "${file_path}${NAMING_TABLE}"
|
|
IMG_FOLDER="${X_FOLDER}"
|
|
}
|
|
decode_images() {
|
|
echo "Decode All *$1*"
|
|
IMG_FOLDER_TMP="${X_FOLDER}"
|
|
file_path="${IMG_DIR}${IMG_FOLDER_TMP}/"
|
|
if [ -f "${file_path}${NAMING_TABLE_ENC}" ];then
|
|
openssl enc -d -aes-256-cbc -pbkdf2 -salt -in "${file_path}${NAMING_TABLE_ENC}" -out "${file_path}${NAMING_TABLE}" -pass "${PrivKey}"
|
|
fi
|
|
files=($(cat "${file_path}${NAMING_TABLE}" | grep -e ".*$1.*" | cut -f2 -d';'))
|
|
for file in ${files[@]}; do
|
|
if [ "$(identify ${file} 2>>/dev/null | grep "PNG")" == "" ]; then
|
|
naming_table_line=$(cat "${file_path}${NAMING_TABLE}" | grep "$(echo ${file} | rev | cut -f1 -d'/' | rev)")
|
|
DEC_NAME="${file_path}$(echo ${naming_table_line} | cut -f1 -d';')"
|
|
if [ "$(echo ${naming_table_line} | grep -e ".*$1.*")" == "" ]; then
|
|
continue
|
|
fi
|
|
if [ -f "${DEC_NAME}" ]; then
|
|
echo "File Name already present: ${DEC_NAME}"
|
|
DEC_NAME="$(echo "${DEC_NAME}" | sed 's/.png/_DOUBLE_'"${RANDOM}"'\.png/g')"
|
|
else
|
|
echo "Decode ${DEC_NAME}"
|
|
fi
|
|
openssl enc -d -aes-256-cbc -pbkdf2 -salt -in "${file_path}${file}" -out "${DEC_NAME}" -pass "${PrivKey}"
|
|
if [[ "${REMOVE}" == "true" ]]; then
|
|
echo "Remove line ${naming_table_line} from Naming Table"
|
|
sed -i '/'"${naming_table_line}"'/d' ${file_path}${NAMING_TABLE}
|
|
echo "Remove ${file_path}${file}"
|
|
rm "${file_path}${file}"
|
|
fi
|
|
fi
|
|
done
|
|
openssl enc -aes-256-cbc -pbkdf2 -salt -in "${file_path}${NAMING_TABLE}" -out "${file_path}${NAMING_TABLE_ENC}" -pass "${PrivKey}"
|
|
rm "${file_path}${NAMING_TABLE}"
|
|
}
|
|
printNamingTable() {
|
|
IMG_FOLDER_TMP="${X_FOLDER}/"
|
|
file_path="${IMG_DIR}${IMG_FOLDER_TMP}/"
|
|
if [ -f "${file_path}${NAMING_TABLE_ENC}" ];then
|
|
openssl enc -d -aes-256-cbc -pbkdf2 -salt -in "${file_path}${NAMING_TABLE_ENC}" -pass "${PrivKey}"
|
|
else
|
|
echo "No Naming Table under ${file_path}${NAMING_TABLE_ENC}"
|
|
fi
|
|
}
|
|
modifyNT() {
|
|
IMG_FOLDER_TMP="${X_FOLDER}/"
|
|
file_path="${IMG_DIR}${IMG_FOLDER_TMP}"
|
|
NAMING_TABLE="naming_table_mod.txt"
|
|
if [ -f "${file_path}${NAMING_TABLE_ENC}" ];then
|
|
if [ ! -f "${file_path}${NAMING_TABLE}" ];then
|
|
openssl enc -d -aes-256-cbc -pbkdf2 -salt -in "${file_path}${NAMING_TABLE_ENC}" -out "${file_path}${NAMING_TABLE}" -pass "${PrivKey}"
|
|
echo "Decrypting to ${file_path}${NAMING_TABLE}"
|
|
else
|
|
openssl enc -aes-256-cbc -pbkdf2 -salt -in "${file_path}${NAMING_TABLE}" -out "${file_path}${NAMING_TABLE_ENC}" -pass "${PrivKey}"
|
|
rm "${file_path}${NAMING_TABLE}"
|
|
echo "Encrypting to ${file_path}${NAMING_TABLE_ENC}"
|
|
fi
|
|
else
|
|
echo "No Naming Table under ${file_path}${NAMING_TABLE_ENC}"
|
|
fi
|
|
}
|
|
logfile_cleanup(){
|
|
size=$(ls -l $LOG_FILE | cut -f5 -d' ')
|
|
echo Logfile Size: $size
|
|
if [ $size -gt 10000 ]; then
|
|
lines=$(wc -l $LOG_FILE | cut -f1 -d' ')
|
|
lines_new=$(($lines / 2))
|
|
echo Lines: $lines
|
|
echo Lines_new: $lines_new
|
|
sed -i "1,${lines_new}d" $LOG_FILE
|
|
exec 1>>${LOG_FILE} 2>&1
|
|
fi
|
|
}
|
|
sort_ARR(){
|
|
for ((i=0; i <= $((${#screen_pos_X[@]} - 2)); ++i)); do
|
|
for ((j=((i + 1)); j <= ((${#screen_pos_X[@]} - 1)); ++j)); do
|
|
if [[ ${screen_pos_X[i]} -gt ${screen_pos_X[j]} ]]; then
|
|
tmp1=${screen_pos_X[i]}
|
|
screen_pos_X[i]=${screen_pos_X[j]}
|
|
screen_pos_X[j]=$tmp1
|
|
tmp2=${screen_width_X[i]}
|
|
screen_width_X[i]=${screen_width_X[j]}
|
|
screen_width_X[j]=$tmp2
|
|
tmp3=${screen_height_Y[i]}
|
|
screen_height_Y[i]=${screen_height_Y[j]}
|
|
screen_height_Y[j]=$tmp3
|
|
fi
|
|
done
|
|
done
|
|
|
|
screen_width_X[${#screen_width_X[@]}]=${screen_width_X[0]}
|
|
screen_height_Y[${#screen_height_Y[@]}]=${screen_height_Y[0]}
|
|
screen_Aspect_Ratio[${#screen_Aspect_Ratio[@]}]=${screen_Aspect_Ratio[0]}
|
|
screenAR_ARR=("${screenAR}" "${screenAR}" "${screen_Aspect_Ratio[0]}" "${screen_Aspect_Ratio[0]}")
|
|
}
|
|
sum_ARR(){
|
|
arr=($@)
|
|
if [ ${#arr[@]} -eq 0 ]; then return 0; fi
|
|
IFS='+'; set -f
|
|
sum=$(echo "scale=1;${arr[*]}"|bc)
|
|
unset IFS; set +f
|
|
echo $sum
|
|
}
|
|
get_screensize(){
|
|
if [ "$(ls /sys/class/drm/${DEVICE_CARD}/ | grep "${DEVICE_CARD}-")" == "" ]; then
|
|
printf "Wrong Device Card: %s -> " "${DEVICE_CARD}"
|
|
DEVICE_CARD="card1"
|
|
printf "New: %s\n" "${DEVICE_CARD}"
|
|
fi
|
|
IFS=$'\n'; set -f
|
|
devices=($(ls /sys/class/drm/${DEVICE_CARD}/ | grep "${DEVICE_CARD}-" | cut -f2- -d'-'))
|
|
unset IFS; set +f
|
|
CONN_COUNT=0
|
|
for ((i=0;i<${#devices[@]};i++)); do
|
|
echo "Device: ${devices[${i}]}"
|
|
devices_name[${i}]=$(echo ${devices[${i}]}| grep -o "[[:alpha:]]*" | grep -m1 "[[:alpha:]]*")
|
|
devices_num[${i}]=$(echo ${devices[${i}]}|rev| grep -o "[[:digit:]]" | grep -m1 "[[:digit:]]")
|
|
status[${i}]=$(cat /sys/class/drm/${DEVICE_CARD}/${DEVICE_CARD}-"${devices[${i}]}"/status)
|
|
enabled[${i}]=$(cat /sys/class/drm/${DEVICE_CARD}/${DEVICE_CARD}-"${devices[${i}]}"/enabled)
|
|
if [ $(echo ${devices[${i}]} | grep "eDP" | wc -l) -ge 1 ]; then
|
|
if [ $(grep "wallpaperChanger.sh" /etc/acpi/events/lm_lid 2>/dev/null | wc -l) -eq 0 ]; then
|
|
echo "ERROR: No laptop lid trigger file: /etc/acpi/events/lm_lid"
|
|
fi
|
|
if [ $(grep "open" /proc/acpi/button/lid/LID0/state | wc -l) -eq 0 ]; then
|
|
status[${i}]="disconnected"
|
|
echo "Laptop Lid closed"
|
|
else
|
|
echo "Laptop Lid open"
|
|
fi
|
|
fi
|
|
if [ "${status[${i}]}" == "connected" ] && [ "${enabled[${i}]}" == "enabled" ]; then
|
|
((CONN_COUNT++))
|
|
fi
|
|
echo "${devices[${i}]}: ${status[${i}]}, ${enabled[${i}]}"
|
|
done
|
|
if [ "${THALES}" == "true" ] && [ $(id -u) -eq 0 ];then
|
|
echo "Open Monitor File as lfaber"
|
|
CONFIG_ARR=($(sudo -u lfaber cat ${MONITOR_FILE} | tr '\n' ';' | sed 's/ \+//g' | sed 's/<\/configuration>/<\/configuration>\n/g' | grep "<configuration>"))
|
|
else
|
|
echo "Open Monitor File"
|
|
CONFIG_ARR=($(cat ${MONITOR_FILE} | tr '\n' ';' | sed 's/ \+//g' | sed 's/<\/configuration>/<\/configuration>\n/g' | grep "<configuration>"))
|
|
fi
|
|
for ((j=0;j<${#CONFIG_ARR[@]};j++)); do
|
|
CONFIG_ARR[$j]="$(echo "${CONFIG_ARR[$j]}" | tr ';' '\n')"
|
|
MONITOR_COUNT=$(echo "${CONFIG_ARR[$j]}" | grep -c "<logicalmonitor>")
|
|
CONFIG_SUCCESS=true
|
|
if [ $CONN_COUNT -eq $MONITOR_COUNT ]; then
|
|
echo "Monitors: $MONITOR_COUNT"
|
|
for ((i=0;i<${#devices[@]};i++)); do
|
|
CONFIG_TEST=${CONFIG_ARR[$j]}
|
|
if [ "${status[${i}]}" == "connected" ]; then
|
|
SIZE_X="$(cat "/sys/class/drm/${DEVICE_CARD}/${DEVICE_CARD}-${devices[${i}]}/device/device/graphics/fb0/virtual_size" | cut -f1 -d',')"
|
|
SIZE_Y="$(cat "/sys/class/drm/${DEVICE_CARD}/${DEVICE_CARD}-${devices[${i}]}/device/device/graphics/fb0/virtual_size" | cut -f2 -d',')"
|
|
CONFIG_TEST="$(echo "${CONFIG_TEST}" | tr '\n' ';' | sed 's/<\/logicalmonitor>;/<\/logicalmonitor>\n/g' | grep "${devices_name[${i}]}" | grep "${devices_num[${i}]}" | grep ";<width>${SIZE_X}</width>;<height>${SIZE_Y}</height>;")"
|
|
fi
|
|
if [ "${CONFIG_TEST}" == "" ]; then
|
|
CONFIG_SUCCESS=false
|
|
echo "Wrong Monitor"
|
|
fi
|
|
done
|
|
if ${CONFIG_SUCCESS}; then
|
|
CONFIG_NEW="${CONFIG_ARR[$j]}"
|
|
else
|
|
echo "Wrong Monitor"
|
|
fi
|
|
else
|
|
echo "Connected Monitors: $CONN_COUNT"
|
|
echo "Configured Monitors: $MONITOR_COUNT"
|
|
fi
|
|
# CONFIG_ARR[$j]="$(echo "${CONFIG_ARR[$j]}" | grep "<connector>${devices[${i}]}")"
|
|
done
|
|
if [ $CONN_COUNT -eq 1 ]; then
|
|
for ((i=0;i<${#devices[@]};i++)); do
|
|
if [ "${status[${i}]}" == "connected" ]; then
|
|
SIZE_X="$(cat "/sys/class/drm/${DEVICE_CARD}/${DEVICE_CARD}-${devices[${i}]}/device/device/graphics/fb0/virtual_size" | cut -f1 -d',')"
|
|
SIZE_Y="$(cat "/sys/class/drm/${DEVICE_CARD}/${DEVICE_CARD}-${devices[${i}]}/device/device/graphics/fb0/virtual_size" | cut -f2 -d',')"
|
|
POS="<x>0</x>"
|
|
CONFIG_NEW="<width>$SIZE_X</width>\n<height>$SIZE_Y</height>\n$POS\n"
|
|
fi
|
|
done
|
|
fi
|
|
if [ "$CONFIG_NEW" == "" ]; then
|
|
echo "Abort: Monitor Information not consistent"
|
|
exit
|
|
fi
|
|
IFS=$'\n'; set -f
|
|
screen_width_X=($(echo -e "$CONFIG_NEW" | grep "width" | grep -o "[[:digit:]]*"))
|
|
screen_height_Y=($(echo -e "$CONFIG_NEW" | grep "height" | grep -o "[[:digit:]]*"))
|
|
screen_pos_X=($(echo -e "$CONFIG_NEW" | grep "<x>" | grep -o "[[:digit:]]*"))
|
|
unset IFS; set +f
|
|
for ((i=0; i<${#screen_width_X[@]} ; i++ )); do
|
|
screen_Aspect_Ratio[${i}]=$(perl -E "say ${screen_height_Y[${i}]}/${screen_width_X[${i}]}")
|
|
done
|
|
screenAR=$(perl -E "say ${screen_height_Y[0]}/$(sum_ARR ${screen_width_X[@]})")
|
|
}
|
|
get_config() {
|
|
while [[ ${1:0:1} == - ]]; do
|
|
echo "Param: $1"
|
|
[[ $1 == -u ]] && {
|
|
MODE="udev";
|
|
shift 1;
|
|
continue;
|
|
};
|
|
[[ $1 == -a ]] && {
|
|
MODE="acpid";
|
|
shift 1;
|
|
continue;
|
|
};
|
|
[[ $1 == -t ]] && {
|
|
if [ $# -lt 2 ]; then
|
|
usage
|
|
exit
|
|
fi
|
|
minutes=$2;
|
|
DAEMON=true;
|
|
MODE="daemon";
|
|
LOG=true;
|
|
shift 2;
|
|
continue;
|
|
};
|
|
[[ $1 == -p ]] && {
|
|
if [ $# -lt 2 ]; then
|
|
usage
|
|
exit
|
|
fi
|
|
CUSTOM_DIR=true;
|
|
IMG_DIR=$2;
|
|
shift 2;
|
|
continue;
|
|
};
|
|
[[ $1 == -e ]] && {
|
|
EDIT_CONFIG=true;
|
|
shift 1;
|
|
continue;
|
|
};
|
|
[[ $1 == -s ]] && {
|
|
if [ $# -lt 2 ]; then
|
|
SEARCH=""
|
|
else
|
|
|
|
counter=0
|
|
while (true); do
|
|
if [[ "$2" == "-"* || "$2" == "" ]]; then shift 1; break; fi
|
|
SEARCH[$counter]=$2
|
|
((counter++))
|
|
shift 1
|
|
done
|
|
fi
|
|
continue;
|
|
};
|
|
[[ $1 == -c ]] && {
|
|
CONFIG=true;
|
|
shift 1;
|
|
continue;
|
|
};
|
|
[[ $1 == -elements ]] && {
|
|
EXCLUDE_CONFIG=${EXCLUDE_CONFIG_DEF}
|
|
shift 1;
|
|
continue;
|
|
};
|
|
[[ $1 == -l ]] && {
|
|
LOG=true;
|
|
shift 1;
|
|
continue;
|
|
};
|
|
[[ $1 == -x ]] && {
|
|
X_FOLDER="corrupt"
|
|
IMG_FOLDER="${X_FOLDER}"
|
|
shift 1;
|
|
continue;
|
|
};
|
|
[[ $1 == -h ]] && {
|
|
usage
|
|
shift 1;
|
|
exit 0;
|
|
};
|
|
[[ $1 == -hX ]] && {
|
|
usageX
|
|
shift 1;
|
|
exit 0;
|
|
};
|
|
[[ $1 == -ex ]] && {
|
|
EXCLUDE_CONFIG="$2"
|
|
shift 2;
|
|
};
|
|
[[ $1 == -X ]] && {
|
|
> /home/lucas/.LOG/wp.conf
|
|
rm /home/lucas/.LOG/IMG[0-3].png
|
|
shift 1;
|
|
continue;
|
|
};
|
|
[[ $1 == -dec_leave ]] && {
|
|
DECODE_SINGLE=true
|
|
shift 1;
|
|
continue;
|
|
};
|
|
[[ $1 == -insta ]] && {
|
|
X_FOLDER="insta"
|
|
IMG_FOLDER="${X_FOLDER}"
|
|
shift 1;
|
|
continue;
|
|
};
|
|
[[ $1 == -dec_arg ]] && {
|
|
arg=$2;
|
|
shift 2;
|
|
[[ $1 == -rm ]] && {
|
|
REMOVE=true
|
|
shift 1;
|
|
};
|
|
decode_images "${arg}"
|
|
exit 0;
|
|
};
|
|
[[ $1 == -rm ]] && {
|
|
shift 1;
|
|
REMOVE=true
|
|
};
|
|
[[ $1 == -dec_all ]] && {
|
|
decode_all
|
|
exit
|
|
};
|
|
[[ $1 == -printNT ]] && {
|
|
printNamingTable
|
|
shift 1;
|
|
exit 0;
|
|
};
|
|
[[ $1 == -modifyNT ]] && {
|
|
modifyNT
|
|
shift 1;
|
|
exit 0;
|
|
}
|
|
[[ $1 == -replace ]] && {
|
|
REPLACE_ENC_IMG=true
|
|
shift 1;
|
|
continue;
|
|
}
|
|
[[ $1 == -thales ]] && {
|
|
THALES=true
|
|
shift 1;
|
|
continue;
|
|
}
|
|
echo "Parameter $1 discarded"
|
|
shift 1;
|
|
done
|
|
}
|
|
echo Start $0 $@
|
|
SEARCH=""
|
|
MODE="user";
|
|
#EXCLUDE_CONFIG=${EXCLUDE_CONFIG_DEF}
|
|
EXCLUDE_CONFIG="elements"
|
|
get_config "$@"
|
|
if ${THALES}; then
|
|
LOG_DIR="/home/diskspace/lfaber/Wallpaper/.LOG/"
|
|
IMG_DIR="/home/diskspace/lfaber/Wallpaper/"
|
|
MONITOR_FILE="/homes/lfaber/.config/monitors.xml"
|
|
WC_USER="lfaber"
|
|
WC_GROUP="elektra"
|
|
PrivKey=""
|
|
count=0
|
|
ret=1
|
|
while [ ${count} -lt 100 ]; do
|
|
sudo -u lfaber id 2>&1 1>>/dev/null
|
|
ret=$?
|
|
echo $ret
|
|
if [ ${ret} -ne 0 ]; then
|
|
echo "Wait for user lfaber"
|
|
else
|
|
break
|
|
fi
|
|
sleep 10
|
|
done
|
|
if [ ${ret} -ne 0 ]; then
|
|
echo "User lfaber not present, exit."
|
|
exit
|
|
else
|
|
echo "User lfaber loaded"
|
|
fi
|
|
fi
|
|
if $EDIT_CONFIG; then
|
|
vim "${LOG_DIR}${CONFIGFILE}"
|
|
fi
|
|
if $CONFIG; then
|
|
IFS=$' '; set -f
|
|
get_config $(cat "${LOG_DIR}${CONFIGFILE}")
|
|
unset IFS; set +f
|
|
fi
|
|
if $LOG; then
|
|
LOG_FILE="${LOG_DIR}wallpaperchanger_${MODE}.log"
|
|
ls $LOG_DIR >> /dev/null 2>&1
|
|
if [[ $? -ne 0 ]]; then
|
|
echo "Directory $LOG_DIR not present"
|
|
exit 1
|
|
fi
|
|
exec 1>>${LOG_FILE} 2>&1
|
|
date
|
|
fi
|
|
if $CUSTOM_DIR; then
|
|
if [ "$(echo "${IMG_DIR: -1}")" == "/" ]; then
|
|
IMG_FOLDER="$(echo ${IMG_DIR} | rev | cut -f2 -d'/' | rev)/"
|
|
IMG_DIR="$(echo ${IMG_DIR} | rev | cut -f3- -d'/' | rev)/"
|
|
else
|
|
IMG_FOLDER="$(echo ${IMG_DIR} | rev | cut -f1 -d'/' | rev)/"
|
|
IMG_DIR="$(echo ${IMG_DIR} | rev | cut -f2- -d'/' | rev)/"
|
|
fi
|
|
echo ${IMG_FOLDER}
|
|
echo ${IMG_DIR}
|
|
fi
|
|
ls ${IMG_DIR}${IMG_FOLDER} >> /dev/null 2>&1
|
|
if [[ $? -ne 0 ]]; then
|
|
echo "Directory ${IMG_DIR}${IMG_FOLDER} not present"
|
|
exit 1
|
|
fi
|
|
get_screensize
|
|
sort_ARR
|
|
|
|
if [ "${screenAR}" == "0.5625" ]; then
|
|
EXCLUDE_CONFIG="Panorama"
|
|
fi
|
|
echo "Screen Width: ${screen_width_X[@]}"
|
|
echo "Screen Height: ${screen_height_Y[@]}"
|
|
echo "Screen Pos: ${screen_pos_X[@]}"
|
|
echo "Monitor Aspect Ratio: ${screen_Aspect_Ratio[@]} - Screen: ${screenAR}"
|
|
echo "Dir: ${IMG_DIR}${IMG_FOLDER}"
|
|
echo "User: $(whoami)"
|
|
if ${DAEMON}; then
|
|
if [ "`echo $minutes | egrep ^[[:digit:]]+$`" = "" ];then
|
|
echo "$minutes is not an Integer"
|
|
exit
|
|
else
|
|
echo "Interval: $minutes min"
|
|
fi
|
|
echo "Start DAEMON"
|
|
sleep_time=$(( $minutes * 60 ))
|
|
while [[ 1 -eq 1 ]]; do
|
|
if $CONFIG; then
|
|
IMG_FOLDER="Desktop1920x1080/"
|
|
IFS=$' '; set -f
|
|
get_config $(cat "${LOG_DIR}${CONFIGFILE}")
|
|
unset IFS; set +f
|
|
fi
|
|
get_screensize
|
|
sort_ARR
|
|
change_image
|
|
date
|
|
logfile_cleanup
|
|
echo "DAEMON Mode"
|
|
sleep $sleep_time
|
|
done
|
|
else
|
|
change_image
|
|
fi
|
|
exit 0
|