Created
June 25, 2012 01:40
-
-
Save drewreece/2985927 to your computer and use it in GitHub Desktop.
Update Arch Linux ARM on a Raspberry Pi
This file contains hidden or 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/sh | |
# | |
# Arch-First-Update.sh | |
# For Raspberry Pi | |
# | |
# Based on archlinuxarm-29-04-2012 | |
# SHA-1 b84d1eaba2ec64982da40ccd7dba06b186f6954 | |
# | |
# See http://www.raspberrypi.org/phpBB3/viewtopic.php?f=53&t=8512&p=107921#p107921 | |
# | |
# Script is spilt into functions to allow quick disabling & enabling of various stages | |
# Comment out any functions you don't need to run within the main processing area of the script. | |
# | |
# The following are optional... | |
# pacman_keys_setup <- will require confirming certificates manually | |
# additional_installers | |
# Disclaimer - use at your own risk & have a backup plan, it works for me | |
# Tested via SSH login | |
################# | |
### FUNCTIONS ### | |
################# | |
# System Updates | |
system_updates(){ | |
echo "system_updates..." | |
# Get pacman update first | |
pacman -Sy pacman --noconfirm | |
# install a quicker 'locate' tool (next 2 lines optional) | |
pacman -S mlocate --noconfirm | |
updatedb | |
# (ignore 'filesystem' then force 'filesystem' update due to /var/run moving) | |
# see https://www.archlinux.org/news/filesystem-upgrade-manual-intervention-required-1/ | |
pacman -Syu --ignore filesystem --noconfirm | |
pacman -S filesystem --force --noconfirm | |
} | |
# Setup pacman key | |
# Requires system activity for key generation | |
pacman_keys_setup(){ | |
echo "pacman_keys_setup..." | |
# 'haveged' needed to setup pacman key over ssh | |
# See https://wiki.archlinux.org/index.php/Pacman-key#Initializing_the_keyring | |
pacman -S haveged --noconfirm | |
rc.d start haveged | |
# Generate noise for the key. | |
echo "Pacman keygen in progress" | |
find / -name '*' -type f 2>/dev/null | |
#pacman-key --init # may need 2 calls to pacman-key | |
pacman-key --init | |
rc.d stop haveged | |
# unistall haveged | |
pacman -Rs haveged --noconfirm | |
# Install the keyring to make this process work | |
# See http://www.raspberrypi.org/phpBB3/viewtopic.php?p=107341#p107341 | |
pacman -S archlinux-keyring --noconfirm | |
pacman-key --populate archlinux | |
# Additional Pacman setup | |
# Set 'SigLevel = Optional TrustAll' in /etc/pacman.conf (uncomment next line) | |
#sed -i'' -e's/#SigLevel = Optional TrustAll/SigLevel = Optional TrustAll/' /etc/pacman.conf | |
} | |
# Extra installation. | |
additional_installers() { | |
echo "additional_installers..." | |
# Add any extra tools you want installing here and uncomment the call to 'additional_installers' | |
# e.g. for udev-automount | |
#pacman -S --noconfirm udev-automount | |
} | |
#################################### | |
### MAIN PROCESSING BEGINS BELOW ### | |
#################################### | |
# Got root? | |
if [ "$(id -u)" != "0" ]; then | |
clear | |
echo "#########################################################" | |
echo "Please execute with 'sudo' or -DANGEROUS!!!- as root" | |
echo "sudo $0" | |
echo "#########################################################" | |
exit 1 | |
fi | |
echo "Starting at ... " | |
echo `date` | |
# call functions... | |
system_updates | |
pacman_keys_setup | |
#additional_installers | |
echo "#########################################################" | |
echo "####################### DONE ############################" | |
echo "#########################################################" | |
echo "Extra steps ..." | |
echo "find / -name *.pacnew" | |
echo "... or ..." | |
echo "locate *.pacnew" | |
echo "To find new any config files that need merging." | |
echo "Config info -> https://wiki.archlinux.org/index.php/Beginners%27_Guide#Configure_the_system" | |
echo "Add a user -> https://wiki.archlinux.org/index.php/Beginners%27_Guide#Adding_a_User" | |
echo "Add a root password! -> https://wiki.archlinux.org/index.php/Beginners%27_Guide#Root_password" | |
echo "" | |
echo "#########################################################" | |
echo "#########################################################" | |
echo "#########################################################" | |
echo "" | |
echo "Finished at ..." | |
echo `date` | |
echo "" | |
echo "#########################################################" | |
echo "NOW REBOOT" | |
echo "#########################################################" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment