Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ~/.profile: executed by the command interpreter for login shells.
- # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
- # exists.
- # see /usr/share/doc/bash/examples/startup-files for examples.
- # the files are located in the bash-doc package.
- # the default umask is set in /etc/profile; for setting the umask
- # for ssh logins, install and configure the libpam-umask package.
- #umask 022
- # if running bash
- if [ -n "$BASH_VERSION" ]; then
- # include .bashrc if it exists
- if [ -f "$HOME/.bashrc" ]; then
- . "$HOME/.bashrc"
- fi
- fi
- rebootFlg="reboot.flg"
- expandFlg="expand.flg"
- # set PATH so it includes user's private bin if it exists
- if [ -d "$HOME/bin" ] ; then
- PATH="$HOME/bin:$PATH"
- fi
- # Check ram dedicated to the GPU
- if ! grep -q "gpu_mem=128" "/boot/config.txt"; then
- echo "Changing GPU ram"
- sed '/gpu_mem/d' /boot/config.txt | sudo tee /boot/config.txt > /dev/null
- echo "gpu_mem=128" | sudo tee -a /boot/config.txt > /dev/null
- touch "$rebootFlg"
- fi
- # Timezone
- if ! cmp --silent /usr/share/zoneinfo/Europe/Lisbon /etc/localtime; then
- sudo cp /usr/share/zoneinfo/Europe/Lisbon /etc/localtime
- echo Changing timezone
- touch "$rebootFlg"
- fi
- # if the flag is present, expand the file system
- # resizefs.sh extracted from raspi-config
- if [ -f "$expandFlg" ]; then
- echo "Expanding card"
- chmod +x ~/Desktop/raspi/resizefs.sh
- sudo ~/Desktop/raspi/resizefs.sh
- touch "$rebootFlg"
- rm "$expandFlg"
- fi
- # Check serial number
- PISERIAL="PI-"`cat /proc/cpuinfo | grep Serial |awk '{gsub ("^0*", "", $3); print $3}'`
- if grep -q $PISERIAL "/etc/hostname"; then
- echo "Host:" $PISERIAL
- else
- echo "Changing host"
- echo $PISERIAL | sudo tee /etc/hostname > /dev/null
- sed '/127.0.1.1/d' /etc/hosts | sudo tee /etc/hosts > /dev/null
- echo 127.0.1.1 $PISERIAL | sudo tee -a /etc/hosts > /dev/null
- touch "$rebootFlg"
- fi
- # restarts system if required
- if [ -f "$rebootFlg" ]; then
- rm "$rebootFlg"
- sudo reboot
- fi
- # Check if session is local or remote
- if [[ $(who am i) =~ \([-a-zA-Z0-9\.]+\)$ ]] ; then
- echo Conected by SSH;
- sudo python ~/Desktop/raspi/cfgmenu.py
- else
- echo Starting signage system
- echo Press any key to change settings
- if read -n1 -t5 -r -s x; then
- sudo python ~/Desktop/raspi/cfgmenu.py
- sudo reboot
- else
- echo Checking for updates
- cd ~/Desktop/raspi/
- # the update script will start the presentation or restart on completion
- python ./update.py 2>>log.txt
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement