diff --git a/calcsetup.sh b/calcsetup.sh index f656086..47299e5 100644 --- a/calcsetup.sh +++ b/calcsetup.sh @@ -1,14 +1,21 @@ # This script will fetch necessary packages -# Note: An Internet connection is REQUIRED for this script to succeed. +echo Note: An Internet connection is REQUIRED for this script to succeed. -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 +if [[ -e .alreadyrun ]]; then +sleep 1 +cat .alreadyrun +sleep 1 +exit +#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 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." @@ -21,21 +28,69 @@ if [ &ans == "n" ]; then fi fi +# If the default rpi password is unchanged, skip prompting for the password 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 fi -sudo apt install xorg ratpoison idle3 python3-matplotlib -y +# 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 +sudo echo "# Disable spi and i2c, we need these pins." >> /boot/config.txt +sudo echo "dtparam=spi=off" >> /boot/config.txt +sudo echo "dtparam=i2c_arm=off" >> /boot/config.txt +sudo echo "" >> /boot/config.txt +sudo echo "# Set screen size and any overscan required" >> /boot/config.txt +sudo echo "overscan_left=0" >> /boot/config.txt +sudo echo "overscan_right=0" >> /boot/config.txt +sudo echo "overscan_top=0" >> /boot/config.txt +sudo echo "overscan_bottom=0" >> /boot/config.txt +sudo echo "framebuffer_width=800" >> /boot/config.txt +sudo echo "framebuffer_height=480" >> /boot/config.txt +sudo echo "" >> /boot/config.txt +sudo echo "# enable the DPI display" >> /boot/config.txt +sudo echo "enable_dpi_lcd=1" >> /boot/config.txt +sudo echo "display_default_lcd=1" >> /boot/config.txt +sudo echo "" >> /boot/config.txt +sudo echo "# set up the size to 800x480" >> /boot/config.txt +sudo echo "dpi_group=2" >> /boot/config.txt +sudo echo "dpi_mode=87" >> /boot/config.txt +sudo echo "" >> /boot/config.txt +sudo echo "# set up the hsync/vsync/clock polarity and format" >> /boot/config.txt +sudo echo "dpi_output_format=454661" >> /boot/config.txt +sudo echo "" >> /boot/config.txt +sudo echo "# set up the size to 800x480" >> /boot/config.txt +sudo echo "hdmi_timings=800 0 40 48 88 480 0 13 3 32 0 0 0 60 0 32000000 6" >> /boot/config.txt + +# 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 if [[ -e ~/.xinitrc ]]; then echo "xinitrc exists... skipping" else cp /etc/X11/xinit/xinitrc ~/.xinitrc fi -# Copy X11 and ratpoison skeleton files to PATH +# Modify init configs for X and Ratpoison echo "exec /usr/bin/ratpoison" >> ~/.xinitrc +echo "banish" >> ~/.ratpoisonrc 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 2 + +sudo shutdown -h now