Skip to main content

Tool for Installing Talking Arch

I've written a bash script that will install the Talking Arch distro non-interactively.

To use it follow these steps:

  1. Boot Talking Arch
  2. Set up your partitions
  3. `wget http://www.raspberryvi.org/Downloads/ta-tools-1.0.0.tar.gz
  4. tar zxf ta-tools-1.0.0.tar.gz
  5. Make sure the contained script is executable and run it.

It will do the first pre-chroot of the install and write a here script into the chroot and mark it executable.

After the chroot, run the newly created script to create the installation.

Here is the full script:



#!/bin/bash
#
# Talking Arch setup
#

# Change the commenting of the variables below
REGION=Europe
#REGION=America

CITY=London
#CITY=Chicago

LOCALE=en_UK
#LOCALE=en_US

KEYMAP=uk
#KEYMAP=us

DEVICE=${1}

HOSTNAME=arch

ROOTPASSWORD=root

USER=user
PASSWORD=password

# This MUST be a full path to where the script must be in the chroot
HERE_SCRIPT=/mnt/root/001-ta-tools.sh

# Crash out on any error
set -e

echo 'Mounting the disk partition(s)...'
mount ${DEVICE} /mnt

echo 'Pacstrapping the new system in what will be the chroot...'
pacstrap /mnt git base espeakup alsa-utils openssh acpi wget base-devel nmap lynx

echo 'Setting up fstab...'
genfstab -U -p /mnt >> /mnt/etc/fstab

#
# Write a 'here' script into the chroot before we chroot
#
cat  ${HERE_SCRIPT}
#!/bin/bash

set -e

echo 'Setting up localisation stuff...'
sed -i 's:#${LOCALE}.UTF-8 UTF-8:${LOCALE}.UTF-8 UTF-8:' /etc/locale.gen
echo "LANG=${LOCALE}.UTF-8" > /etc/locale.conf
export LANG=${LOCALE}.UTF-8
locale-gen

echo 'Removing /etc/localtime if it exists before replacing it...'
[ -f /etc/localtime ] && rm /etc/localtime
ln -s /usr/share/zoneinfo/${REGION}/${CITY} /etc/localtime

echo 'Setting up keymap...'
echo "KEYMAP=${KEYMAP}" > /etc/vconsole.conf

echo 'Setting the hardware clock...'
hwclock --systohc --utc

echo 'Setting the hostname...'
echo ${HOSTNAME} > /etc/hostname

echo 'Setting the password for root...'
echo -e "${ROOTPASSWORD}\n${ROOTPASSWORD}\n" | passwd root

echo 'Adding an ordinary user...'
useradd -m -g users -G wheel,storage,power,audio -s /bin/bash ${USER}
echo -e "${PASSWORD}\n${PASSWORD}\n" | passwd ${USER}

echo 'Editing /etc/sudoers to grant the usual privileges...'
sed -i 's:# %wheel ALL=(ALL) ALL: %wheel ALL=(ALL) ALL:' /etc/sudoers

echo 'Installing grub...'
pacman -S --noconfirm --noprogress grub-bios

echo 'Setting up grub...'
grub-install --target=i386-pc --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

echo 'Setting some stuff in /etc/hosts.allow...'
echo 'SSHD: ALL' >> /etc/hosts.allow

echo 'Enabling the sshd service...'
systemctl enable sshd.service

echo 'Enabling the dhcpcd service...'
systemctl enable dhcpcd.service

echo 'Enabling the espeakup service...'
systemctl enable espeakup.service

echo 'About to exit chroot...'
exit

echo 'un-mounting hard-disk partitions from virtual mount point...'
 umount /mnt/home
 umount /mnt

EOF

# Mark the created here script executable
chmod +x ${HERE_SCRIPT}


echo 'All done'
exit 0