Fix fzf (arch)

This commit is contained in:
Augusto Gunsch 2021-08-09 20:53:23 -03:00
parent ec3f9f663c
commit 8225090272
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
2 changed files with 28 additions and 13 deletions

BIN
fzf Executable file

Binary file not shown.

View File

@ -16,10 +16,13 @@ quiet() {
set -e set -e
} }
### FORCE ROOT ###
### FORCE ROOT ###
[ $(whoami) != "root" ] && echo "Please run as root" && exit 1 [ $(whoami) != "root" ] && echo "Please run as root" && exit 1
### URLs ###
FZF_DOWNLOAD="$(curl -s https://api.github.com/repos/junegunn/fzf/releases/latest | grep linux_amd64 | sed -nE 's/^\s*"browser_download_url":\s*"(.*)"\s*$/\1/p')"
### COLORS ### ### COLORS ###
RED='\033[0;31m' RED='\033[0;31m'
LGREEN='\033[1;32m' LGREEN='\033[1;32m'
@ -59,10 +62,10 @@ print_phase() {
CUR_PHASE=$((CUR_PHASE+1)) CUR_PHASE=$((CUR_PHASE+1))
} }
install() { download_fzf() {
echo -n "Installing $1..." curl -sL "$FZF_DOWNLOAD" -o fzf.tar.gz
quiet pacman -Sq --needed --noconfirm $1 tar -xf fzf.tar.gz
echo "done" alias fzf="./fzf"
} }
prompt() { prompt() {
@ -166,17 +169,16 @@ install_base() {
fi fi
} }
configure() { set_timezone() {
print_phase "System configuration"
install fzf
echo "Choose timezone:" echo "Choose timezone:"
qpushd /mnt/usr/share/zoneinfo qpushd /mnt/usr/share/zoneinfo
ln -sf "/mnt/usr/share/zoneinfo/$(fzf --layout=reverse --height=20)" /mnt/etc/localtime ln -sf "/mnt/usr/share/zoneinfo/$(fzf --layout=reverse --height=20)" /mnt/etc/localtime
qpopd qpopd
[ "$DISTRO" = "arch" ] && alias chroot="arch-chroot" [ "$DISTRO" = "arch" ] && alias chroot="arch-chroot"
quiet chroot /mnt hwclock --systohc quiet chroot /mnt hwclock --systohc
}
set_locale() {
echo "Choose locale:" echo "Choose locale:"
local LOCALE=$(cat /mnt/etc/locale.gen | sed '/^#\s/D' | sed '/^#$/D' | sed 's/^#//' | fzf --layout=reverse --height=20) local LOCALE=$(cat /mnt/etc/locale.gen | sed '/^#\s/D' | sed '/^#$/D' | sed 's/^#//' | fzf --layout=reverse --height=20)
@ -188,7 +190,9 @@ configure() {
echo "export LANG=\"en_US.UTF-8\"" > /mnt/etc/locale.conf echo "export LANG=\"en_US.UTF-8\"" > /mnt/etc/locale.conf
echo "export LC_COLLATE=\"C\"" >> /mnt/etc/locale.conf echo "export LC_COLLATE=\"C\"" >> /mnt/etc/locale.conf
echo "done" echo "done"
}
setup_grub() {
echo -n "Configuring boot loader..." echo -n "Configuring boot loader..."
if [ $UEFI -eq 1 ]; then if [ $UEFI -eq 1 ]; then
quiet chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot --botloader-id=grub quiet chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot --botloader-id=grub
@ -197,7 +201,9 @@ configure() {
fi fi
quiet chroot grub-mkconfig -o /boot/grub/grub.cfg quiet chroot grub-mkconfig -o /boot/grub/grub.cfg
echo "done" echo "done"
}
setup_users() {
echo "Type root password:" echo "Type root password:"
chroot /mnt passwd -q chroot /mnt passwd -q
@ -207,7 +213,9 @@ configure() {
chroot /mnt useradd -m "$user" chroot /mnt useradd -m "$user"
echo "Type your password:" echo "Type your password:"
chroot /mnt passwd -q "$user" chroot /mnt passwd -q "$user"
}
setup_network() {
echo -n "Type the machine hostname: " echo -n "Type the machine hostname: "
local hostname local hostname
read hostname read hostname
@ -227,6 +235,17 @@ configure() {
quiet chroot pacman -S dhcpcd wpa_supplicant quiet chroot pacman -S dhcpcd wpa_supplicant
fi fi
echo "done" echo "done"
}
configure() {
print_phase "System configuration"
download_fzf
set_timezone
set_locale
setup_grub
setup_users
setup_network
umount -R /mnt umount -R /mnt
echo -n "Ready to reboot. Press any key to continue..." echo -n "Ready to reboot. Press any key to continue..."
@ -235,10 +254,6 @@ configure() {
} }
main() { main() {
echo -n "Updating package database..."
quiet pacman -Sy
echo "done"
partition partition
install_base install_base
configure configure