<commit_before>#!/bin/bash

## Author: <NAME> [<EMAIL>]
## Date: June 11, 2014
## Arch Installer Part #1: The Beginnings...

## Assumptions:
#	- System is booted using archboot iso with a working internet connection.
#   - All required partition (/, /boot, /home,...) have been mounted inside /mnt.
#   If this script is being executed from an arch system with arch-installer-scripts, please add the arch-installer-scripts to $PATH
#   PATH=$PATH:$(pwd)

AIS_MNT=/mnt

echo I will assume that you have partitioned the system and mounted the base partition on $AIS_MNT
echo Please ensure that you have a working internet connection.
read -p "Press any key to continue..."

# Configure the mirrorlist.
echo The first step is to configure to mirror list. 
read -p "Do you want to open it now? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
    $EDITOR /etc/pacman.d/mirrorlist
fi

# Install the base and base-devel (for ABS) packages
echo Installing the base packages in /mnt using pacstrap...
pacstrap -i $AIS_MNT base base-devel
echo

# Generate fstab
echo Generating and installing fstab...
mkdir -p $AIS_MNT/etc
genfstab -U -p $AIS_MNT >> $AIS_MNT/etc/fstab
echo You should check the generated fstab. I am opening it for you.
read -p "Press any key to continue...  " 
$EDITOR $AIS_MNT/etc/fstab
echo

# chroot into the base system
echo Chrooting into the base system...
arch-chroot $AIS_MNT /bin/bash<commit_msg>Add prompts at each step. Colorize.<commit_after>#!/bin/bash

## Author: <NAME> [<EMAIL>]
## Date: June 11, 2014
## Arch Installer Part #1: The Beginnings...

## Assumptions:
#	- System is booted using archboot iso with a working internet connection.
#   - All required partition (/, /boot, /home,...) have been mounted inside /mnt.
#   If this script is being executed from an arch system with arch-installer-scripts, please add the arch-installer-scripts to $PATH
#   PATH=$PATH:$(pwd)

AIS_MNT=/mnt

## Preamble
# Define colors for 'tput'
textrev=$(tput rev)
textblue=$(tput setaf 1)
textred=$(tput setaf 4)
textreset=$(tput sgr0)
note() {
    echo ${textblue}$@${textreset}
}
header() {
    echo ${textred}$@${textreset}
}

header Arch Linux Installer [Script I - Base Install]
note I will assume that you have partitioned the system and mounted the base partition on $AIS_MNT.
echo
header Checking network...
if ! ping -c 3 8.8.8.8 ; then
    note There seems to be some problem with your network. Please ensure that you have a working internet connection and try again.
    exit 1
else
    note We have a working network. Beginning the install process...
fi

read -p "Do you wish to (C)ontinue/e(x)it? " -n 1 -r
echo
if [[ $REPLY =~ ^[Xx]$ ]] ; then
	exit 0
fi
echo

# Configure the mirrorlist.
header Step 1: Configure Mirrorlist
read -p "Do you want to open the mirrorlist now? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
    $EDITOR /etc/pacman.d/mirrorlist
fi
echo

# Install the base and base-devel (for ABS) packages
header "Step 2: Install the base system."
note "We will now install the base packages in $AIS_MNT using pacstrap."
read -p "Do you wish to (c)ontinue/(S)kip/e(x)it? " -n 1 -r
echo
if [[ $REPLY =~ ^[Xx]$ ]] ; then
	exit 0
elif [[ $REPLY =~ ^[Yy]$ ]] ; then
    pacstrap -i $AIS_MNT base base-devel
fi
echo

# Generate fstab
header Step 3: Fstab
note I will now generate fstab for you. 
read -p "Do you wish to (c)ontinue/(S)kip/e(x)it? " -n 1 -r
echo
if [[ $REPLY =~ ^[Xx]$ ]] ; then
	exit 0
elif [[ $REPLY =~ ^[Yy]$ ]] ; then
    note Generating and installing fstab...
    mkdir -p $AIS_MNT/etc
    genfstab -U -p $AIS_MNT >> $AIS_MNT/etc/fstab
    note "You should check the generated fstab. I am opening it for you."
    read -p "Press any key to continue...  " 
    $EDITOR $AIS_MNT/etc/fstab
fi
echo

# chroot into the base system
header Step 4: Chroot
note We are now ready to chroot into the newly installed system to configure it. 
note Please run Part Two of the arch installer script after chrooting.
read -p "Do you wish to (c)ontinue/(S)kip/e(x)it? " -n 1 -r
echo
if [[ $REPLY =~ ^[Xx]$ ]] ; then
	exit 0
elif [[ $REPLY =~ ^[Yy]$ ]] ; then
    note Chrooting into the base system...
    arch-chroot $AIS_MNT /bin/bash
fi
{'fraction_non_alphanumeric': 0.11917840936231192, 'fraction_numerical': 0.008836876044900884, 'mean_word_length': 3.427061310782241, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2436857', 'n_tokens_mistral': 1532, 'n_tokens_neox': 1457, 'n_words': 595}