#!/bin/bash # Name: parautinst # Description: Parabola automated installer # Author: Esteban V. Carnevale - alfplayer@mailoo.org # Binary configuration switches are set like this # 1 to enable # 0 to disable # sshfs remote cache directory location #cache_sshfs='USER@HOST:CACHEDIR' # Chroot directory #chrootdir=/tmp/chroot chrootdir="/mnt" # HTTP proxy #http_proxy=http://HOST:PORT/ # Create partition and mount? (binary) partitioning_and_mount=1 # Pacman needs to be updated before installing Parabola? (binary) pacman_needs_upgrade=0 # parabola-keyring needs to be updated before installing Parabola? (binary) parabola_keyring_needs_upgrade=0 # Set a Parabola mirror #mirror='http://repo.parabolagnulinux.org/$repo/os/$arch' # Hostname hostname="parabola" # Time zone timezone="/usr/share/zoneinfo/America/Buenos_Aires" # Locale locale="en_US.UTF-8 UTF-8" # Keymap keymap="es" # Install virtio initramfs modules? (binary) virtio=0 red='\e[31m' # Red cyan_bg='\e[46m' # Cyan background txtrst='\e[0m' # Text Reset info() { echo -e ${cyan_bg}PARAUTINST:${txtrst} "$@" ; } error() { echo -e ${cyan_bg}PARAUTINST error:${txtrst} "$@" 1>&2 ; exit 1 ; } [[ "$@" ]] || error "Usage: parautinst [partition]\nExample: parautinst sda1\nWARNING! All data on the specified partition will be lost." info "${red}WARNING! All data on the partition $1 will be lost.${txtrst}\n\nPress any key to continue, or Ctrl-C to cancel." read -n1 echo part="$1" hdd=${part%?} export red cyan_bg txtrst info error part hdd chrootdir hostname timezone locale keymap virtio export -f info error [[ ! -e ${chrootdir} ]] && mkdir "${chrootdir}" [[ ${mirror} ]] && echo "Server = ${mirror}" > /etc/pacman.d/mirrorlist pacmancmd='pacman --cachedir /tmp -Sy --noconfirm --needed' (( ${partitioning_and_mount} )) & { info "Unmounting ${part}" umount /dev/${part} info "Partitioning ${hdd}" parted /dev/${hdd} -s "mklabel msdos" parted /dev/${hdd} -s "mkpart primary ext4 1MiB -1s" info "Creating filesystem on ${part}" mkfs.ext4 /dev/${part} info "Mounting ${part} on ${chrootdir}" mount /dev/${part} "${chrootdir}" } (( ${pacman_needs_upgrade} )) && { info "Updating pacman database" pacman -Sy info "Updating pacman" ${pacmancmd} pacman } [[ ${cache_sshfs} ]] && { info "Installing sshfs" ${pacmancmd} sshfs info "Mounting package cache over sshfs" if grep -s '\s/var/cache/pacman/pkg\s' /etc/mtab ; then info "Package cache already mounted" else mount -t fuse.sshfs -o noauto,user,idmap=user,comment=x-systemd.automount,allow_other,StrictHostKeyChecking=no "${cache_sshfs}" /var/cache/pacman/pkg || error "Error mounting the package cache using sshfs" fi } (( ${parabola_keyring_needs_upgrade} )) && { info "Installing parabola-keyring" ${pacmancmd} parabola-keyring } info "Running parautinst and installing base group and grub" pacstrap -c "${chrootdir}" base grub #cp /etc/libretools.conf /etc/makepkg.conf ${chrootdir}/etc info "Running genfstab" genfstab -p "${chrootdir}" >> "${chrootdir}"/etc/fstab cp parautinst-chroot "${chrootdir}"/parautinst-chroot #chmod +x ${chrootdir}/parautinst-chroot arch-chroot "${chrootdir}" /bin/bash parautinst-chroot rm "${chrootdir}"/parautinst-chroot