Merge branch 'test' into fix/btrfs
This commit is contained in:
commit
d232926441
|
|
@ -54,7 +54,7 @@ sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment
|
|||
|
||||
# create partitions
|
||||
sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:'BIOSBOOT' ${DISK} # partition 1 (BIOS Boot Partition)
|
||||
sgdisk -n 2::+100M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # partition 2 (UEFI Boot Partition)
|
||||
sgdisk -n 2::+300M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # partition 2 (UEFI Boot Partition)
|
||||
sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${DISK} # partition 3 (Root), default start, remaining
|
||||
if [[ ! -d "/sys/firmware/efi" ]]; then # Checking for bios system
|
||||
sgdisk -A 1:set:2 ${DISK}
|
||||
|
|
@ -79,7 +79,7 @@ mountallsubvol () {
|
|||
mount -o ${mountoptions},subvol=@.snapshots /dev/mapper/ROOT /mnt/.snapshots
|
||||
mount -o ${mountoptions},subvol=@var /dev/mapper/ROOT /mnt/var
|
||||
}
|
||||
if [[ "${DISK}" == "nvme" ]]; then
|
||||
if [[ "${DISK}" =~ "nvme" ]]; then
|
||||
if [[ "${FS}" == "btrfs" ]]; then
|
||||
mkfs.vfat -F32 -n "EFIBOOT" ${DISK}p2
|
||||
mkfs.btrfs -L ROOT ${DISK}p3 -f
|
||||
|
|
@ -91,7 +91,7 @@ if [[ "${DISK}" == "nvme" ]]; then
|
|||
elif [[ "${FS}" == "luks" ]]; then
|
||||
mkfs.vfat -F32 -n "EFIBOOT" ${DISK}p2
|
||||
# enter luks password to cryptsetup and format root partition
|
||||
echo -n "${luks_password}" | cryptsetup -y -v luksFormat ${DISK}p3 -
|
||||
echo -n "${luks_password}" | cryptsetup -v luksFormat ${DISK}p3 -
|
||||
# open luks container and ROOT will be place holder
|
||||
echo -n "${luks_password}" | cryptsetup open ${DISK}p3 ROOT -
|
||||
# now format that container
|
||||
|
|
@ -118,7 +118,7 @@ else
|
|||
mount -t ext4 ${DISK}3 /mnt
|
||||
elif [[ "${FS}" == "luks" ]]; then
|
||||
mkfs.vfat -F32 -n "EFIBOOT" ${DISK}2
|
||||
echo -n "${luks_password}" | cryptsetup -y -v luksFormat ${DISK}3 -
|
||||
echo -n "${luks_password}" | cryptsetup -v luksFormat ${DISK}3 -
|
||||
echo -n "${luks_password}" | cryptsetup open ${DISK}3 ROOT -
|
||||
mkfs.btrfs -L ROOT /dev/mapper/ROOT
|
||||
mount -t btrfs /dev/mapper/ROOT /mnt
|
||||
|
|
@ -192,4 +192,4 @@ echo -ne "
|
|||
-------------------------------------------------------------------------
|
||||
SYSTEM READY FOR 1-setup.sh
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
"
|
||||
|
|
|
|||
56
1-setup.sh
56
1-setup.sh
|
|
@ -48,12 +48,12 @@ echo -ne "
|
|||
"
|
||||
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
|
||||
locale-gen
|
||||
timedatectl --no-ask-password set-timezone ${timezone}
|
||||
timedatectl --no-ask-password set-timezone ${TIMEZONE}
|
||||
timedatectl --no-ask-password set-ntp 1
|
||||
localectl --no-ask-password set-locale LANG="en_US.UTF-8" LC_TIME="en_US.UTF-8"
|
||||
|
||||
# Set keymaps
|
||||
localectl --no-ask-password set-keymap ${keymap}
|
||||
localectl --no-ask-password set-keymap ${KEYMAP}
|
||||
|
||||
# Add sudo no password rights
|
||||
sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers
|
||||
|
|
@ -103,19 +103,61 @@ elif lspci | grep -E "Radeon"; then
|
|||
elif lspci | grep -E "Integrated Graphics Controller"; then
|
||||
pacman -S libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils --needed --noconfirm
|
||||
fi
|
||||
|
||||
if ! source install.conf; then
|
||||
# Loop through user input until the user gives a valid username
|
||||
while true
|
||||
do
|
||||
read -p "Please enter username:" username
|
||||
# username regex per response here https://unix.stackexchange.com/questions/157426/what-is-the-regex-to-validate-linux-users
|
||||
# lowercase the username to test regex
|
||||
if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
echo "Incorrect username."
|
||||
done
|
||||
# convert name to lowercase before saving to install.conf
|
||||
echo "username=${username,,}" >> ${HOME}/${SCRIPTHOME}/install.conf
|
||||
fi
|
||||
if [ $(whoami) = "root" ];
|
||||
then
|
||||
useradd -m -G wheel,libvirt -s /bin/bash $username
|
||||
passwd $username
|
||||
cp -R ${HOME}/${SCRIPTHOME} /home/${username}/
|
||||
chown -R ${username}: /home/${username}/${SCRIPTHOME}
|
||||
|
||||
# Loop through user input until the user gives a valid hostname, but allow the user to force save
|
||||
while true
|
||||
do
|
||||
read -p "Please name your machine:" nameofmachine
|
||||
# hostname regex (!!couldn't find spec for computer name!!)
|
||||
if [[ "${nameofmachine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
# if validation fails allow the user to force saving of the hostname
|
||||
read -p "Username doesn't seem correct. Do you still want to save it? (y/n)" force
|
||||
if [[ "${force,,}" = "y" ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo ${nameofmachine} > /etc/hostname
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Adding User
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
if [ $(whoami) = "root" ]; then
|
||||
useradd -m -G wheel,libvirt -s /bin/bash $username
|
||||
useradd -m -G wheel,libvirt -s /bin/bash $USERNAME
|
||||
# use chpasswd to enter $username:$password
|
||||
echo "$username:$password" | chpasswd
|
||||
cp -R /root/$SCRIPTHOME /home/$username/
|
||||
chown -R $username: /home/$username/$SCRIPTHOME
|
||||
echo "$USERNAME:$PASSWORD" | chpasswd
|
||||
cp -R /root/$SCRIPTHOME /home/$USERNAME/
|
||||
chown -R $USERNAME: /home/$USERNAME/$SCRIPTHOME
|
||||
# enter $hostname to /etc/hostname
|
||||
echo $hostname > /etc/hostname
|
||||
echo $HOSTNAME > /etc/hostname
|
||||
else
|
||||
echo "You are already a user proceed with aur installs"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -17,7 +17,23 @@ GRUB EFI Bootloader Install & Check
|
|||
if [[ -d "/sys/firmware/efi" ]]; then
|
||||
grub-install --efi-directory=/boot ${DISK}
|
||||
fi
|
||||
|
||||
echo -e "Installing CyberRe Grub theme..."
|
||||
THEME_DIR="/boot/grub/themes"
|
||||
THEME_NAME=CyberRe
|
||||
echo -e "Creating the theme directory..."
|
||||
mkdir -p "${THEME_DIR}/${THEME_NAME}"
|
||||
echo -e "Copying the theme..."
|
||||
cd ${HOME}/ArchTitus
|
||||
cp -a ${THEME_NAME}/* ${THEME_DIR}/${THEME_NAME}
|
||||
echo -e "Backing up Grub config..."
|
||||
cp -an /etc/default/grub /etc/default/grub.bak
|
||||
echo -e "Setting the theme as the default..."
|
||||
grep "GRUB_THEME=" /etc/default/grub 2>&1 >/dev/null && sed -i '/GRUB_THEME=/d' /etc/default/grub
|
||||
echo "GRUB_THEME=\"${THEME_DIR}/${THEME_NAME}/theme.txt\"" >> /etc/default/grub
|
||||
echo -e "Updating grub..."
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
echo -e "All set!"
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 638 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
|
|
@ -0,0 +1,49 @@
|
|||
# Copyright (C) 2020 L. Henrique Lopes - HENK
|
||||
|
||||
# general settings
|
||||
title-text: ""
|
||||
title-color: "#3ec6ae"
|
||||
message-font: "DejaVu Sans Regular 14"
|
||||
message-color: "#fd262e"
|
||||
message-bg-color: "#808080"
|
||||
desktop-image: "background.png"
|
||||
desktop-color: "#808080"
|
||||
terminal-font: "DejaVu Sans Regular 14"
|
||||
|
||||
|
||||
# boot menu
|
||||
+ boot_menu {
|
||||
left = 28%
|
||||
width = 50%
|
||||
top = 22%
|
||||
height = 45%
|
||||
item_font = "DroidLogo Regular 17"
|
||||
item_color = "#fb3048"
|
||||
selected_item_font = "DroidLogo Regular 17"
|
||||
selected_item_color = "#74d6cf"
|
||||
icon_width = 16
|
||||
icon_height = 16
|
||||
item_height = 33
|
||||
item_padding = 20
|
||||
item_icon_space = 5
|
||||
item_spacing = 5
|
||||
menu_pixmap_style = "boot_menu2_*.png"
|
||||
selected_item_pixmap_style = "highlight_*.png"
|
||||
}
|
||||
|
||||
# Show progress
|
||||
+ progress_bar {
|
||||
id = "__timeout__"
|
||||
left = 0%
|
||||
width = 100%
|
||||
top = 99%
|
||||
height = 31
|
||||
show_text = false
|
||||
text = ""
|
||||
fg_color = "#3daee9"
|
||||
bg_color = "#31363b"
|
||||
border_color = "#31363b"
|
||||
highlight_style = "progress_highlight_*.png"
|
||||
}
|
||||
|
||||
|
||||
94
startup.sh
94
startup.sh
|
|
@ -1,5 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
# This script will ask users about their prefrences like disk, file system,
|
||||
# This script will ask users about their prefrences
|
||||
# like disk, file system, timezone, keyboard layout,
|
||||
# user name, password, etc.
|
||||
|
||||
# set up a config file
|
||||
CONFIG_FILE=setup.conf
|
||||
if [ ! -f $CONFIG_FILE ]; then # check if file exists
|
||||
touch -f $CONFIG_FILE # create file if not exists
|
||||
fi
|
||||
|
||||
# set options in setup.conf
|
||||
set_option() {
|
||||
if grep -Eq "^${1}.*" $CONFIG_FILE; then # check if option exists
|
||||
sed -i -e "/^${1}.*/d" $CONFIG_FILE # delete option if exists
|
||||
fi
|
||||
echo "${1}=${2}" >>$CONFIG_FILE # add option
|
||||
}
|
||||
logo () {
|
||||
# This will be shown on every set as user is progressing
|
||||
echo -ne "
|
||||
|
|
@ -27,13 +43,13 @@ echo -ne "
|
|||
"
|
||||
read FS
|
||||
case $FS in
|
||||
1) echo "FS=btrfs" >> setup.conf;;
|
||||
2) echo "FS=ext4" >> setup.conf;;
|
||||
1) set_option FS btrfs;;
|
||||
2) set_option FS ext4;;
|
||||
3)
|
||||
echo -ne "Please enter your luks password: "
|
||||
read luks_password
|
||||
echo "luks_password=$luks_password" >> setup.conf
|
||||
echo "FS=luks" >> setup.conf;;
|
||||
read -s luks_password # read password without echo
|
||||
set_option luks_password $luks_password
|
||||
set_option FS luks;;
|
||||
0) exit ;;
|
||||
*) echo "Wrong option please select again"; filesystem;;
|
||||
esac
|
||||
|
|
@ -41,16 +57,16 @@ esac
|
|||
timezone () {
|
||||
# Added this from arch wiki https://wiki.archlinux.org/title/System_time
|
||||
time_zone="$(curl --fail https://ipapi.co/timezone)"
|
||||
echo -ne "System detected your timezone to be '$time_zone'"
|
||||
echo -ne "System detected your timezone to be '$time_zone' \n"
|
||||
echo -ne "Is this correct? yes/no:"
|
||||
read answer
|
||||
case $answer in
|
||||
y|Y|yes|Yes|YES)
|
||||
echo "timezone=$time_zone" >> setup.conf;;
|
||||
set_option TIMEZONE $time_zone;;
|
||||
n|N|no|NO|No)
|
||||
echo "Please enter your desired timezone e.g. Europe/London :"
|
||||
read new_timezone
|
||||
echo "timezone=$new_timezone" >> setup.conf;;
|
||||
set_option TIMEZONE $new_timezone;;
|
||||
*) echo "Wrong option. Try again";timezone;;
|
||||
esac
|
||||
}
|
||||
|
|
@ -88,8 +104,9 @@ Please select key board layout from this list
|
|||
|
||||
"
|
||||
read -p "Your key boards layout:" keymap
|
||||
echo "keymap=$keymap" >> setup.conf
|
||||
set_option KEYMAP $keymap
|
||||
}
|
||||
|
||||
drivessd () {
|
||||
echo -ne "
|
||||
Is this an ssd? yes/no:
|
||||
|
|
@ -104,8 +121,11 @@ case $ssd_drive in
|
|||
*) echo "Wrong option. Try again";drivessd;;
|
||||
esac
|
||||
}
|
||||
|
||||
# selection for disk type
|
||||
diskpart () {
|
||||
lsblk
|
||||
# show disks present on system
|
||||
lsblk -n --output TYPE,KNAME | awk '$1=="disk"{print NR,"/dev/"$2}' # show disks with /dev/ prefix
|
||||
echo -ne "
|
||||
------------------------------------------------------------------------
|
||||
THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK
|
||||
|
|
@ -113,27 +133,57 @@ echo -ne "
|
|||
after formating your disk there is no way to get data back
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Please enter disk to work on: (example /dev/sda):
|
||||
Please enter full path to disk: (example /dev/sda):
|
||||
"
|
||||
read option
|
||||
echo "DISK=$option" >> setup.conf
|
||||
|
||||
drivessd
|
||||
set_option DISK $option
|
||||
}
|
||||
userinfo () {
|
||||
echo -ne "Please enter username: "
|
||||
read username
|
||||
echo "username=$username" >> setup.conf
|
||||
echo -ne "Please enter your password: "
|
||||
read password
|
||||
echo "password=$password" >> setup.conf
|
||||
echo -ne "Please enter your hostname: "
|
||||
read hostname
|
||||
echo "hostname=$hostname" >> setup.conf
|
||||
read -p "Please enter your username: " username
|
||||
set_option USERNAME ${username,,} # convert to lower case as in issue #109
|
||||
echo -ne "Please enter your password: \n"
|
||||
read -s password # read password without echo
|
||||
set_option PASSWORD $password
|
||||
read -rep "Please enter your hostname: " hostname
|
||||
set_option HOSTNAME $hostname
|
||||
}
|
||||
# More features in future
|
||||
# language (){}
|
||||
rm -rf setup.conf &>/dev/null
|
||||
network (){
|
||||
echo -ne "
|
||||
Make sure your wifi device is active from the bios settings.
|
||||
You can also use rfkill to device listing. This script
|
||||
support only wifi connections.
|
||||
"
|
||||
iwctl device list # list devices present
|
||||
read -p "Select interface for connecting: " WLAN
|
||||
iwctl station $WLAN scan
|
||||
sleep 1
|
||||
echo "Getting network."
|
||||
sleep 1
|
||||
echo "Getting network.."
|
||||
sleep 1
|
||||
echo "Getting network..."
|
||||
iwctl station $WLAN get-networks
|
||||
read -p "Enter SSID to connect: " SSID
|
||||
echo "Enter network passphrase: \n"
|
||||
read -s PASS
|
||||
iwctl --passphrase '$PASS' station '$WLAN' connect '$SSID'
|
||||
echo "Checking connection"
|
||||
|
||||
if ping -c 1 archlinux.org &>/dev/null; then
|
||||
echo "Hurray!! You are connected."
|
||||
else
|
||||
echo "There is something this script cannot deal with!"
|
||||
fi
|
||||
}
|
||||
# Starting functions
|
||||
network
|
||||
clear
|
||||
logo
|
||||
userinfo
|
||||
clear
|
||||
logo
|
||||
|
|
|
|||
Loading…
Reference in New Issue