|
|
@@ -32,7 +32,7 @@
|
|
|
#
|
|
|
|
|
|
BASEDIR="data"
|
|
|
-SSH_FILE=$BASEDIR/id_rsa_bus
|
|
|
+SSH_FILE=$BASEDIR/id_rsa
|
|
|
COM_VAL=$BASEDIR/common_values.sh
|
|
|
|
|
|
SRV_LST=$BASEDIR/server_list
|
|
|
@@ -46,14 +46,126 @@ RULE_FN=$BASEDIR/rules.scm
|
|
|
|
|
|
DIU_UI=$BASEDIR/diu_ui_site_specific.js
|
|
|
|
|
|
+DO_CLEANUP_INSTALL=1
|
|
|
+
|
|
|
+if [[ "$DO_CLEANUP_INSTALL" != "" ]] ; then
|
|
|
+ echo "doing 'cleanup install'"
|
|
|
+ bd="../popufare"
|
|
|
+
|
|
|
+ mkdir -p .tmp
|
|
|
+
|
|
|
+ btd=`mktemp -d`
|
|
|
+ btd=`basename $btd`
|
|
|
+ mv /tmp/$btd .tmp/$btd
|
|
|
+ td=".tmp/$btd"
|
|
|
+
|
|
|
+ echo " Making temporary diectory for original copies ($td)"
|
|
|
+
|
|
|
+ apt-get update
|
|
|
+ apt-get install -y espeak mplayer git ppp ppp-dev sox alsa-utils unclutter fbi xinput-calibrator ffmpeg jq matchbox-window-manager libi2c-dev socat figlet vim pwgen minicom
|
|
|
+ apt-get autoremove -y
|
|
|
+
|
|
|
+ ###
|
|
|
+
|
|
|
+ ## See https://community.sixfab.com/t/how-to-remove-interface-wwan0/262
|
|
|
+ echo "attempting to disable wwan0 interface (adding blacklist for 'qmi_wwan', 'cd_wmd' to /etc/modprobe.d/raspi-blacklist.conf)"
|
|
|
+ mkdir -p /etc/modprobe.d
|
|
|
+ echo "blacklist qmi_wwan" >> /etc/modprobe.d/raspi-blacklist.conf
|
|
|
+ echo "blacklist cdc_wdm" >> /etc/modprobe.d/raspi-blacklist.conf
|
|
|
+ chmod 644 /etc/modprobe.d/raspi-blacklist.conf
|
|
|
+
|
|
|
+
|
|
|
+ ###
|
|
|
+
|
|
|
+ systemctl stop serial-getty@ttyAMA0.service
|
|
|
+ systemctl mask serial-getty@ttyAMA0.service
|
|
|
+
|
|
|
+ cp /etc/ppp/ip-up $td/ip-up
|
|
|
+ cp /etc/ppp/ip-down $td/ip-down
|
|
|
+
|
|
|
+ cp $bd/busunit/ppp-dialer/etc/ppp/ip-up /etc/ppp/ip-up
|
|
|
+ cp $bd/busunit/ppp-dialer/etc/ppp/ip-down /etc/ppp/ip-down
|
|
|
+
|
|
|
+ cp $bd/busunit/scripts/custom /home/bus/bin/custom
|
|
|
+ cp $bd/busunit/scripts/connection_tether-ppp.sh /home/bus/bin/connection_tether.sh
|
|
|
+
|
|
|
+ echo " Saving /boot/cmdline.txt to $td/cmdline.txt"
|
|
|
+ cp /boot/cmdline.txt $td/cmdline.txt
|
|
|
+ sed -i 's/console=serial0,115200 //' /boot/cmdline.txt
|
|
|
+
|
|
|
+
|
|
|
+ ###
|
|
|
+
|
|
|
+ mkdir -p /home/pi/bin
|
|
|
+ cp $bd/busunit/scripts/welcome_to_popufare.sh /home/pi/bin/welcome_to_popufare.sh
|
|
|
+ chown -R pi:pi /home/pi/bin
|
|
|
+ echo "/home/pi/bin/welcome_to_popufare.sh" >> /home/pi/.bashrc
|
|
|
+
|
|
|
+ ###
|
|
|
+
|
|
|
+ echo " compiling and installing ichthyic-passthrough"
|
|
|
+ bash -c " cd $bd/busunit/PIU/shim ; ./cmp.sh ; cp ./ichthyic-passthrough /home/bus/bin"
|
|
|
+
|
|
|
+ echo " installing popufare_monitor script"
|
|
|
+ bash -c " cp -f $bd/busunit/scripts/popufare_monitor /home/bus/bin/popufare_monitor"
|
|
|
+
|
|
|
+ echo " enabling ichthyic (touch /home/bus/config/popufare.ichthyic)"
|
|
|
+ bash -c " touch /home/bus/config/popufare.ichthyic ; chown bus:bus /home/bus/config/popufare.ichthyic"
|
|
|
+
|
|
|
+ echo " setting root crontab to call popufare_monitor (using $bd/busunit/scripts/crontab.root)"
|
|
|
+ bash -c " crontab $bd/busunit/scripts/crontab.root "
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ newhostname=popufare-`pwgen 8 1`
|
|
|
+ echo " Using hostname $newhostname"
|
|
|
+
|
|
|
+ echo " Saving /etc/hostname and /etc/hosts to $td"
|
|
|
+ cp /etc/hostname $td/hostname
|
|
|
+ cp /etc/hosts $td/hosts
|
|
|
+
|
|
|
+ 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 " Creating new /etc/hosts file"
|
|
|
+ mv $tfn /etc/hosts
|
|
|
+ chmod 644 /etc/hosts
|
|
|
+
|
|
|
+ echo " Removing stale Xauth cookie"
|
|
|
+ xauth remove popufaredev/unix:0
|
|
|
+
|
|
|
+ echo " Removing stale Singletone for Chromium"
|
|
|
+ rm -f /root/.config/[cC]hromium/[Ss]ingleton*
|
|
|
+ rm -f /home/pi/.config/[cC]hromium/[Ss]ingleton*
|
|
|
+ rm -f /home/bus/.config/[cC]hromium/[Ss]ingleton*
|
|
|
+
|
|
|
+ echo " REMEMBER TO SET THE LOGIN AND I2C FROM raspi-config!!!!"
|
|
|
+ echo " ....."
|
|
|
+ echo " PRESS ANY KEY TO ENTER raspi-config"
|
|
|
+ echo " ....."
|
|
|
+ read
|
|
|
+
|
|
|
+ raspi-config
|
|
|
+
|
|
|
+
|
|
|
+fi
|
|
|
+
|
|
|
if [[ -e "$SSH_FILE" ]] ; then
|
|
|
echo "# deploying SSH file $SSH_FILE to /home/bus/.ssh"
|
|
|
- cp -L -f "$SSH_FILE" /home/bus/.ssh/id_rsa_bus
|
|
|
- chown bus:bus /home/bus/.ssh/id_rsa_bus
|
|
|
- chmod a-rwx /home/bus/.ssh/id_rsa_bus
|
|
|
- chmod u+r /home/bus/.ssh/id_rsa_bus
|
|
|
+ cp -L -f "$SSH_FILE" /home/bus/.ssh/id_rsa
|
|
|
cp -L -f "$SSH_FILE" /etc/ppp/id_rsa_bus
|
|
|
- chown root:root /etc/ppp/id_rsa_bus
|
|
|
+ chown bus:bus /home/bus/.ssh/id_rsa
|
|
|
+ chmod a-rwx /home/bus/.ssh/id_rsa
|
|
|
+ chmod u+r /home/bus/.ssh/id_rsa
|
|
|
chmod a-rwx /etc/ppp/id_rsa_bus
|
|
|
chmod u+r /etc/ppp/id_rsa_bus
|
|
|
else
|