New Raspberry Pi Update Template: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
(Created page with "For a new Raspberry Pi I run the following script to make changes just the way I like. <pre> vi /home/pi/template.sh </pre> <pre> #!/bin/bash # Are you Root? if ${EUID}...")
 
No edit summary
 
Line 40: Line 40:
cat >> /boot/config.txt << EOF
cat >> /boot/config.txt << EOF


# Set GPU RAm to 16GB
# Set GPU RAM to 16MB
gpu_mem=16
gpu_mem=16
EOF
EOF

Latest revision as of 02:56, 18 February 2021

For a new Raspberry Pi I run the following script to make changes just the way I like.

vi /home/pi/template.sh
#!/bin/bash

# Are you Root?
if [[ ${EUID} -ne 0 ]]; then
        echo " !!! This tool must be run as root"
        exit 1
fi

# Enable SSH
update-rc.d ssh enable

# Regenerate SSH Keys
rm -f /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server

# Install VIM
apt -y install vim

# Set timezone to Brisbane, Australia
timedatectl set-timezone Australia/Brisbane

# Enable root SSH remote login
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin Yes/' /etc/ssh/sshd_config
systemctl restart ssh

# configure ll alias
cat >> /root/.profile << EOF

alias ll='ls -la --color --group-directories-first --time-style="+%Y-%m-%d %H:%M"'
EOF


cat >> /boot/config.txt << EOF

# Set GPU RAM to 16MB
gpu_mem=16
EOF

# Set VIM cut/paste insert
cat > /root/.vimrc << EOF
set mouse=r
syntax on
EOF

# Disable Wi-Fi and Bluetooth
cat > /etc/modprobe.d/blacklist-radios.conf << EOF
#Wi-Fi
blacklist brcmfmac
blacklist brcmutil

#Bluetooth
blacklist btbcm
blacklist hci_uart
EOF

systemctl disable hciuart

# Create update scripts to update OS
cat > /usr/sbin/update << EOF
#!/bin/bash

if [[ ${EUID} -ne 0 ]]; then
        echo " !!! This tool must be run as root"
        exit 1
fi

apt-get update
apt-get -y full-upgrade
apt-get -y dist-upgrade
apt-get -y autoclean
apt-get -y autoremove

echo
echo
echo Updates Completed
echo
EOF

chmod +x /usr/sbin/update


# Run update scripts and update rPi firmware
update
sudo SKIP_WARNING=1 rpi-update
sudo bash /home/pi/template.sh
reboot