Last active
August 8, 2021 14:26
-
-
Save DennisLfromGA/72352741e2bf303b03b5d894e3e8a2dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
hwid=${1:-eve} | |
confdiff='' | |
conffile="recovery.conf" | |
confscript='get-recovery.conf' | |
location="${HOME}/Downloads/" | |
del=3 | |
key='' | |
mkdir -p ${location} | |
if [ -s ${location}/${conffile} ]; then | |
cp ${location}/${conffile} ${location}/${conffile}.old | |
else | |
if ! type ${confscript} >/dev/null 2>&1; then | |
echo "The script '${confscript}' is not installed in your \$PATH, exiting ..." | |
exit 1 | |
else | |
${confscript} && sleep ${del} | |
fi | |
fi | |
confdiff=$(stat -c %Y ${location}/${conffile} | echo $(expr $(date +%s) - $(cat))) | |
if [ "${confdiff}" -gt 86400 ]; then | |
echo "${conffile} is not from today ..." | |
${confscript} && sleep ${del} | |
#else | |
# echo "The '${conffile}' is from today, you're good ..." | |
fi | |
echo -n "Getting ${conffile} info. for hwidmatch '${hwid}' - " | |
count=$(grep -i "hwidmatch=^${hwid}" -c ${location}/${conffile}) | |
echo "${count} found." | |
if [ ${count} = 0 ]; then | |
exit 1 | |
elif [ ${count} = 1 ]; then | |
echo "--" | |
else | |
read -s -n 1 -t "${del}" -p "Press any key or wait ${del} seconds to view ${count} '${hwid}' hwidmatches .." key | |
echo | |
echo "--" | |
fi | |
grep --color=auto -i "hwidmatch=^${hwid}" -A 7 -B 4 ${location}/${conffile} | |
echo "--" | |
exit 0 |
Ensured directory $location exists and removed unnecessary 'good to go' comment.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Renamed script and removed unused variable 'xit'.