Files
Moje_Poznamky/artix_scripts/after-chroot.sh
2024-06-28 11:43:11 +02:00

95 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
source env.sh
#locale
sed -i "s/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g" /etc/locale.gen && \
sed -i "s/#cs_CZ.UTF-8 UTF-8/cs_CZ.UTF-8 UTF-8/g" /etc/locale.gen && \
locale-gen && \
echo LANG=cs_CZ.UTF-8 > /etc/locale.conf && \
export LANG=cs_CZ.UTF-8 && \
#timezone
ln -s /usr/share/zoneinfo/$TIMEZONE /etc/localtime && \
#hostname
echo "hostname=$HOSTNAME" > /etc/conf.d/hostname && \
#mk
sed -i "s/consolefont block/consolefont block encrypt lvm2 resume/g" /etc/mkinitcpio.conf && \
#key-gen and cryptoset
dd if=/dev/random of=/crypto_keyfile.bin bs=512 count=8 iflag=fullblock && \
chmod 000 /crypto_keyfile.bin && \
sed -i "s/FILES=(/FILES=(\/crypto_keyfile.bin/g" /etc/mkinitcpio.conf && \
pacman -S lvm2 lvm2-openrc cryptsetup cryptsetup-openrc && \
if [ $BIOSorEFI == "EFI" ]; then
cryptsetup luksAddKey $DISK\2 /crypto_keyfile.bin
else
cryptsetup luksAddKey $DISK\1 /crypto_keyfile.bin
fi
mkinitcpio -p linux-hardened && \
#passset
passwd && \
#bootloader
pacman -Sy && \
pacman -S dosfstools freetype2 fuse2 gptfdisk libisoburn mtools os-prober grub efibootmgr && \
sed -i "s/quiet/quiet resume=UUID=`blkid -s UUID -o value /dev/lvmSystem/volSwap`/g" /etc/default/grub && \
if [ $BIOSorEFI == "EFI" ]; then
sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"cryptdevice=UUID=`blkid -s UUID -o value $DISK\2`:lvm-system\"/g" /etc/default/grub
else
sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"cryptdevice=UUID=`blkid -s UUID -o value $DISK\1`:lvm-system\"/g" /etc/default/grub
fi
sed -i "s/#GRUB_ENABLE_CRYPTODISK/GRUB_ENABLE_CRYPTODISK/g" /etc/default/grub
if [ $BIOSorEFI == "EFI" ]; then
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=artix --recheck $DISK
else
grub-install --target=i386-pc $DISK --bootloader-id=artix --recheck $DISK
fi
grub-mkconfig -o /boot/grub/grub.cfg && \
#services
pacman -S haveged haveged-openrc && \
rc-update add haveged default && \
pacman -S cronie cronie-openrc && \
rc-update add cronie default && \
#user
useradd -m -G wheel -s /bin/bash $USERNAME && \
passwd $USERNAME && \
sed -i "s/# %wheel ALL=(ALL:ALL) NOPASSWD: ALL/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/g" /etc/sudoers && \
#Font set
echo 'consolefont="eurlatgr"' > /etc/conf.d/consolefont && \
rc-update add consolefont boot && \
#network
pacman -S networkmanager networkmanager-openrc networkmanager-openvpn network-manager-applet && \
rc-update add NetworkManager default && \
#ssh
pacman -S openssh openssh-openrc && \
rc-update add sshd default && \
#other deamons
pacman -S ntp ntp-openrc acpid acpid-openrc syslog-ng syslog-ng-openrc && \
rc-update add ntpd default && \
rc-update add acpid default && \
rc-update add syslog-ng default && \
#Usefull utils
pacman -S vi artools bash-completion lsof strace && \
yes a | pacman -S wget htop mc zip samba unrar p7zip unzip less && \
yes a | pacman -S hdparm smartmontools hwinfo dmidecode vim && \
yes a | pacman -S whois rsync nmap tcpdump inetutils net-tools ndisc6