Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- function setup(){
- echo "Installation setup"
- echo "List of partition :"
- parted -l
- read -p "Select disk where install Archlinux : " -i "/dev/sd" -e DISK
- read -p "Type a username for basic user : " -e USERNAME
- read -p "Type a hostname for computers name : " -e HOSTNAME
- while [[ -z ${ANSWER} ]]; do
- read -p "Install on virtualbox ? [Y or N] " response
- case $response in
- [yY])
- local ANSWER=true
- VIRTUALBOX=true
- ;;
- [nN])
- local ANSWER=true
- VIRTUALBOX=false
- ;;
- *)
- echo "not a valid response"
- ;;
- esac
- done
- unset ANSWER
- unset response
- if [[ -e ${DISK} ]]; then #Test if the choosen disk exist
- while [ -z ${YN} ]
- do
- read -p "$(warning Are you okay with this? It will erase EVERYTHING in this disk and you will not be able to change the password. [y/N]) " response
- case $response in
- [yY][eE][sS][oO]|[yY])
- local YN=true
- echo "Creating partition"
- create_partitions
- echo "Partition created OK"
- echo "Make file system"
- mkfs_partitions
- echo "MKFS OK"
- echo "Mounting FileSystem"
- mount_fs
- echo "FileSystem mounted sucessful"
- info "Preparing boot"
- prepare_boot
- info "Boot prepared sucessful"
- info "Installing base"
- install_base
- info "Base installed sucessful"
- info "Generate fstab"
- generate_fstab
- info "fstab generated sucessful"
- info 'Chrooting into installed system to continue setup...'
- prepare_chroot
- ;;
- [nN])
- local YN=true
- info "Okay... Good Bye !"
- exit 0
- ;;
- *)
- echo "Mmmmh... don't understand, only Y or N are authorized. And I'm sure you can do it. "
- ;;
- esac
- done
- }
- function print_param(){
- echo "Disk : ${DISK}"
- echo "Username : ${USERNAME}"
- echo "Hostname : ${HOSTNAME}"
- echo "Password : ${PASSWORD}"
- echo "VIRTUALBOX : ${VIRTUALBOX}"
- }
- # to call before mount_fs
- function mkfs_partitions(){
- mkfs.ext2 ${DISK}1
- mkfs.ext4 ${DISK}2
- mkfs.ext4 ${DISK}3
- }
- function mount_fs(){
- mount /dev/sda2 /mnt
- mkdir /mnt/boot
- mount /dev/sda1 /mnt/boot
- mkdir /mnt/home
- mount /dev/sda3 /mnt/home
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement