rpy-calculator/calcsetup.sh

109 lines
3.2 KiB
Bash
Raw Permalink Normal View History

2018-09-26 12:09:52 -09:00
# This script will fetch necessary packages
echo Note: An Internet connection is REQUIRED for this script to succeed.
if [[ -e .alreadyrun ]]; then
sleep 1
cat .alreadyrun
sleep 1
exit
2018-10-04 13:14:09 -09:00
fi
2018-09-26 12:09:52 -09:00
#read -e -n 1 -p "Do you have an Internet connection? " ans
#if [ $ans == "n" ]; then
# echo -e "\e[31mPlease connect to the Internet and rerun this command. \e[39m"
# echo "Exiting..."
# sleep .5
# exit 1
#fi
# Asks the user if they're on the correct version
2018-09-26 12:09:52 -09:00
read -e -n 1 -p "Are you running Raspbian Stretch Lite? " ans
if [ &ans == "n" ]; then
echo -e "\e[33m\e[1mThis script is useful only in Raspbian Lite."
echo -e "Running this in the full Raspbian desktop is untested and will likely break.\e[39m\e[0m"
read -e -n 1 -p "Do you still want to try? " ans
if [ $ans == "n" ]; then
echo "Exiting..."
sleep .5
exit 2
fi
fi
# If the default rpi password is unchanged, skip prompting for the password
2018-09-26 12:09:52 -09:00
read -e -n 1 -p "Have you changed the default username or password? " ans
if [ $ans == "y" ]; then
sudo apt update
else
echo raspberry | sudo -S apt update
sudo apt upgrade -y
2018-09-26 12:09:52 -09:00
fi
# Install drivers for LCD
sudo rpi-update
sudo apt install raspi-gpio
sudo raspi-gpio get
sleep 1
wget https://raw.githubusercontent.com/adafruit/Adafruit-DPI-Kippah/master/dt-blob.bin
sudo cp dt-blob.bin /boot/
sleep 1
2018-10-04 13:23:45 -09:00
touch tmpboot.txt
echo "# Disable spi and i2c, we need these pins." >> tmpboot.txt
echo "dtparam=spi=off" >> tmpboot.txt
echo "dtparam=i2c_arm=off" >> tmpboot.txt
echo "" >> tmpboot.txt
echo "# Set screen size and any overscan required" >> tmpboot.txt
echo "overscan_left=0" >> tmpboot.txt
echo "overscan_right=0" >> tmpboot.txt
echo "overscan_top=0" >> tmpboot.txt
echo "overscan_bottom=0" >> tmpboot.txt
echo "framebuffer_width=800" >> tmpboot.txt
echo "framebuffer_height=480" >> tmpboot.txt
echo "" >> tmpboot.txt
echo "# enable the DPI display" >> tmpboot.txt
echo "enable_dpi_lcd=1" >> tmpboot.txt
echo "display_default_lcd=1" >> tmpboot.txt
echo "" >> tmpboot.txt
echo "# set up the size to 800x480" >> tmpboot.txt
echo "dpi_group=2" >> tmpboot.txt
echo "dpi_mode=87" >> tmpboot.txt
echo "" >> tmpboot.txt
echo "# set up the hsync/vsync/clock polarity and format" >> tmpboot.txt
echo "dpi_output_format=454661" >> tmpboot.txt
echo "" >> tmpboot.txt
echo "# set up the size to 800x480" >> tmpboot.txt
echo "hdmi_timings=800 0 40 48 88 480 0 13 3 32 0 0 0 60 0 32000000 6" >> tmpboot.txt
touch oldboot.txt
cat /boot/config.txt >> oldboot.txt
cat oldboot.txt >> newboot.txt
2018-10-04 16:55:00 -09:00
cat tmpboot.txt >> newboot.txt
sudo cp newboot.txt /boot/config.txt
sleep 2
2018-09-26 12:09:52 -09:00
# Install X server, DM, WM, vim (for some reason), and python stuff
sudo apt install vim xorg lightdm ratpoison idle3 python3-matplotlib -y
# Checks to see if the init config for X exists, and copies the skeleton file
2018-09-26 12:09:52 -09:00
if [[ -e ~/.xinitrc ]]; then
echo "xinitrc exists... skipping"
else
cp /etc/X11/xinit/xinitrc ~/.xinitrc
fi
# Modify init configs for X and Ratpoison
2018-09-26 12:09:52 -09:00
echo "exec /usr/bin/ratpoison" >> ~/.xinitrc
echo "banish" >> ~/.ratpoisonrc
2018-09-26 12:09:52 -09:00
echo "exec /usr/bin/idle3" >> ~/.ratpoisonrc
touch .alreadyrun
echo "This script can only be run once." >> .alreadyrun
echo "Shutting down. Connect LCD, then power back on."
sleep 5
sudo shutdown -h now
2018-10-04 13:11:59 -09:00
EOF