Browse Source

hostname option and cleaning chromium for kiosk operation

* changing hostname causes Chromium to give a dialogue
  box, something about 'another profile'. Clean out
  chromium cruft to allow for normal operation
Abram Connelly 6 years ago
parent
commit
d44154c821
1 changed files with 46 additions and 2 deletions
  1. 46 2
      aux/deploy-busunit-interactive

+ 46 - 2
aux/deploy-busunit-interactive

@@ -74,6 +74,8 @@ echo ""
 echo -n "Hit return to continue [ok]: "
 read hitreturn
 
+DATESTR=`date '+%Y%m%d%H%M%S'`
+
 ###### basic sanity checks to make sure we're installing on a Raspberry Pi
 ######
 
@@ -441,6 +443,44 @@ if [[ "$setupsound" =~ ^[yY]$ ]] ; then
 
 fi
 
+##### Change hostname
+#####
+
+echo -n "Change hostname? [y/N]: "
+read changehostname
+
+if [[ "$changehostname" =~ ^[yY]$ ]] ; then
+
+
+  echo -n "  New hostname [popufaredev]: "
+  read newhostname
+
+  if [[ "$newhostname" == "" ]] ; then
+    newhostname=popufaredev
+  fi
+
+  echo "  Saving /etc/hostname to /root/hostname.$DATESTR"
+  sudo cp /etc/hostname /root/hostname.$DATESTR
+  sudo bash -c "echo '$newhostname' > /etc/hostname"
+
+  tfn=`mktemp`
+  echo -e '127.0.0.1\tlocalhost' > $tfn
+  echo -e '::1\t\tlocalhost ip6-localhost ip6-loopback' >> $tfn
+  echo -e 'ff02::1\t\tip6-allnodes' >> $tfn
+  echo -e 'ff02::2\t\tip6-allrouters' >> $tfn
+  echo '' >> $tfn
+  echo -e '127.0.1.1\t'"$newhostname" >> $tfn
+
+  echo "  Saving /etc/hosts to /root/hosts.$DATESTR"
+  sudo cp /etc/hosts /root/hosts.$DATESTR
+
+  echo "  Creating new /etc/hosts file"
+  sudo mv $tfn /etc/hosts
+  sudo chmod 644 /etc/hosts
+
+fi
+
+
 ##### Setup kiosk
 #####
 
@@ -455,11 +495,16 @@ if [[ "$setupkiosk" =~ ^[yY]?$ ]] ; then
   echo "  enabling kiosk.service ('systemctl enable kiosk.service')"
   sudo systemctl enable kiosk.service
 
+  ## Changing hostname will screw up chromium if it's already been run under a different
+  ## hostname. Remove the files that cause the problems so Chromium can run without
+  ## issue.
+  ##
+  echo "  removing chromium 'Singleton*' files"
+  sudo rm -rf /home/bus/.config/chromium/Singleton*
 fi
 
 echo ""
 
-
 ##### Setup startup
 #####
 
@@ -475,7 +520,6 @@ if [[ "$setupstartup" =~ ^[yY]?$ ]] ; then
   sudo cp /etc/rc.local $tmpfn
   sudo mv $tmpfn /root/$bfn
 
-
   echo "  /home/bus/popufare/busunit/scripts/rc.local -> /etc/rc.local"
   sudo cp /home/bus/popufare/busunit/scripts/rc.local /etc/rc.local