two stage installer test run

This commit is contained in:
James Devine 2018-01-29 21:58:25 +01:00 committed by GitHub
parent ba0019a5e3
commit a40cdb837e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 113 additions and 0 deletions

22
dhcpcd.conf Normal file
View file

@ -0,0 +1,22 @@
#interface wlan0
# static ip_address=192.168.12.1/24
hostname
clientid
presistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option interface_mtu
option ntp_servers
require dhcp_server_identifier
slaac private
profile static_wlan0
static ip_address=192.168.12.1
static routers=192.168.12.1
static domain_name_servers=192.168.12.1
interface wlan0
fallback static_wlan0

20
normalrc.local Normal file
View file

@ -0,0 +1,20 @@
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
exit 0

49
partialinstall.sh Normal file
View file

@ -0,0 +1,49 @@
#!/bin/bash
echo "Sorry. This procedure isn't ready yet, We're working on it! "
echo "--- Part 2: Updates and installation ---"
echo "--- Updating packages"
sudo apt --yes update
sudo apt --yes upgrade
echo "--- Installing packages via apt"
# needed for the CosmicPi software
sudo apt --yes install git python-pip htop python-numpy python-matplotlib python-flask mosquitto mosquitto-clients
echo "--- Installing python packages via pip"
sudo pip --no-cache-dir install pyserial configparser flask_googlemaps Flask-BasicAuth --extra-index-url https://www.piwheels.hostedpi.com/simple
#echo "we might need some more packages"
echo "--- Getting executable path"
EXECPATH="`dirname \"$0\"`" # relative
EXECPATH="`( cd \"$EXECPATH\" && pwd )`" # absolutized and normalized
if [ -z "$EXECPATH" ] ; then
# error; for some reason, the path is not accessible
# to the script (e.g. permissions re-evaled after suid)
exit 1 # fail
fi
echo "$EXECPATH"
TOREPLACE="PATH_TO_EXECUTABLE"
echo "--- Setting up systemd services"
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-mqtt.service
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-database_cleaner.service
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-detector.service
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-UI.service
sudo cp -f install_files/*.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable CosmicPi-mqtt.service
sudo systemctl enable CosmicPi-database_cleaner.service
sudo systemctl enable CosmicPi-detector.service
sudo systemctl enable CosmicPi-UI.service
#the ap was already done
echo "--- changing static ip address to 192.168.12.1 ---"
cp -f dhcpcd.conf /etc/dhcpcd.conf
echo"--- preventing this script from running next reboot ---"
cp -f normalrc.local /etc/rc.local
echo "--- Finished setup! Rebooting now ---"
sleep 10
sudo reboot now

22
rebootrc.local Normal file
View file

@ -0,0 +1,22 @@
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
sudo /home/cosmicpi/cosmicpi-rpi_V1.5/partialinstall.sh
exit 0