Some random bash scripts I've randomly written and want to save for future references
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

# Manually extracting value from settings JSON file
FOUND_CURSOR=0
JSON_PATH=/var/pos/config/UiSettings.cfg
echo " " > /tmp/checkIcons.log
# Are we launcing it for the first time (assuming currently cursor is visible)
if [[ ! -d /usr/share/icons/default-backup ]]
then
mv /usr/share/icons/default /usr/share/icons/default-backup
cp -r /usr/share/icons/xcursor-transparent /usr/share/icons/default
fi
if [[ ! -f ${JSON_PATH} ]]
then
echo "${JSON_PATH} is missing" >> /tmp/checkIcons.log
exit 0
fi
while IFS= read -r line
do
if [ ! -z "$(echo \"${line}\" | grep \"isCursorVisible\")" ]
then
echo "Found JSON key about cursor visibility" >> /tmp/checkIcons.log
FOUND_CURSOR=1
fi
if [ "$FOUND_CURSOR" = "1" ] && [ ! -z "$(echo \"$line\" | grep \"value\")" ]
then
if [ ! -z "$(echo \"${line}\" | grep 0)" ]
then
echo "Disable cursor visibility." >> /tmp/checkIcons.log
rm -rf /usr/share/icons/default
cp -r /usr/share/icons/xcursor-transparent /usr/share/icons/default
fi
if [ ! -z "$(echo \"${line}\" | grep 1)" ]
then
echo "Enable cursor visibility." >> /tmp/checkIcons.log
rm -rf /usr/share/icons/default
cp -r /usr/share/icons/default-backup /usr/share/icons/default
fi
fi
if [ ! -z "$(echo \"${line}\" | grep })" ]
then
FOUND_CURSOR=0
fi
done < ${JSON_PATH}