-
-
Save fredsted/9ce7d848fcf2afdae1a86d97d6884d1a to your computer and use it in GitHub Desktop.
Raspberry Pi setup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Configurables | |
desktop_wallpaper_url="https://example.com/dashboard/wallpaper.png" | |
dashboard_files_url="https://example.com/dashboard/" # Must end in a slash | |
# Turn WiFi power management off | |
sudo iwconfig wlan0 power off | |
# Setup hostname | |
currhost=$(cat /etc/hostname) | |
echo "Enter a hostname for this pi: " | |
read newhost | |
sudo sed -i "s/$currhost/$newhost/g" /etc/{hosts,hostname} | |
# Configure wallpaper | |
wget $desktop_wallpaper_url -O /home/pi/wallpaper.png | |
desktopconf=" | |
[*] | |
wallpaper_mode=center | |
wallpaper_common=1 | |
wallpaper=/home/pi/wallpaper.png | |
desktop_bg=#ffffff | |
desktop_fg=#000000 | |
desktop_shadow=#d6d3de | |
desktop_font=Roboto Light 12 | |
show_wm_menu=0 | |
sort=mtime;ascending; | |
show_documents=0 | |
show_trash=0 | |
show_mounts=0 | |
" | |
echo "$desktopconf" > /home/pi/.config/pcmanfm/LXDE-pi/desktop-items-0.conf | |
# Install chromium | |
wget -qO - http://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add - | |
echo "deb http://dl.bintray.com/kusti8/chromium-rpi jessie main" | sudo tee -a /etc/apt/sources.list | |
sudo apt-get update | |
sudo apt-get install chromium-browser -y | |
# Configure autostart | |
autostartconf=" | |
@lxpanel --profile LXDE-pi | |
@pcmanfm --desktop --profile LXDE-pi | |
@xset s off | |
@xset -dpms | |
@xset s noblank | |
@/home/pi/startup.sh | |
@unclutter -idle 0.1 -root | |
" | |
echo "$autostartconf" > /home/pi/.config/lxsession/LXDE-pi/autostart | |
startupsh=" | |
#!/bin/sh | |
# Turn WiFi power management off | |
sudo iwconfig wlan0 power off | |
# Start Chromium in fullscreen | |
chromium-browser --disable-infobars --disable-session-crashed-bubble --display=':0' --kiosk \"$dashboard_files_url\$(hostname).html?\$RANDOM\" | |
" | |
# Configure startup.sh | |
echo "$startupsh" > /home/pi/startup.sh | |
chmod +x /home/pi/startup.sh | |
# Reboot | |
sudo reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment