File indexing completed on 2024-05-19 05:35:37

0001 #!/bin/sh
0002 
0003 # SPDX-License-Identifier: GPL-3.0-or-later
0004 # SPDX-FileCopyrightText: 2021 Aditya Mehra <aix.m@outlook.com>
0005 
0006 OPTS=$(getopt -o '' --long enable,disable -- "$@")
0007 
0008 if [ ! $? ]; then echo "Failed parsing options." >&2; exit 1; fi
0009 
0010 eval set -- "$OPTS"
0011 
0012 ENABLE=false
0013 while true; do
0014     case "$1" in
0015         --enable) ENABLE=true;;
0016         --disable) ENABLE=false;;
0017                 --) shift; break ;;
0018         esac
0019         shift
0020 done
0021 shift $((OPTIND-1))
0022 
0023 rm /etc/xdg/bigscreen
0024 
0025 if $ENABLE; then
0026         printf "[General]\nMycroftEnabled=true\n" >> /etc/xdg/bigscreen
0027 else
0028         printf "[General]\nMycroftEnabled=false\n" >> /etc/xdg/bigscreen
0029 fi
0030 
0031 if [ -f /opt/mycroft ]; then
0032         SCRIPTFILE=/etc/pico-wizard/scripts.d/01-fix-mycroft-perms
0033 
0034         if [ -f "$SCRIPTFILE" ]; then
0035             echo "$SCRIPTFILE exist skipping"
0036         else
0037             mkdir -p /etc/pico-wizard/scripts.d/
0038             printf "#! /bin/bash\n\nchown -R \$PICOWIZARD_USERNAME:\$PICOWIZARD_USERNAME /opt/mycroft-core/\nchown -R \$PICOWIZARD_USERNAME:\$PICOWIZARD_USERNAME /opt/mycroft/" >> /etc/pico-wizard/scripts.d/01-fix-mycroft-perms
0039             chmod 755 /etc/pico-wizard/scripts.d/01-fix-mycroft-perms
0040         fi
0041 fi