after-chroot.sh created

This commit is contained in:
git
2024-06-11 15:57:07 +02:00
parent af0be93cb7
commit 2e92f3e547
3 changed files with 83 additions and 2 deletions

View File

@@ -0,0 +1,77 @@
#!/bin/bash
source env.sh
#locale
echo -e "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
echo -e "cs_CZ.UTF-8 UTF-8" >> /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 && \
cryptsetup luksAddKey $DISK\2 /crypto_keyfile.bin && \
mkinitcpio -p linux-hardened && \
#passset
passwd && \
#bootloader
pacman -Sy && \
yes | 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 && \
sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"cryptdevice=UUID=`blkid -s UUID -o value $DISK\2`:lvm-system\"/g" /etc/default/grub && \
sed -i "s/#GRUB_ENABLE_CRYPTODISK/GRUB_ENABLE_CRYPTODISK/g" /etc/default/grub && \
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=artix --recheck $DISK && \
grub-mkconfig -o /boot/grub/grub.cfg
#services
yes | pacman -S haveged haveged-openrc && \
rc-update add haveged default && \
yes | 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
#network
yes | pacman -S networkmanager networkmanager-openrc networkmanager-openvpn network-manager-applet && \
rc-update add NetworkManager default && \
#ssh
yes | pacman -S openssh openssh-openrc && \
rc-update add sshd default && \
#other deamons
yes | 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
yes | pacman -S vi artools bash-completion lsof strace && \
yes | pacman -S wget htop mc zip samba unrar p7zip unzip && \
yes | pacman -S hdparm smartmontools hwinfo dmidecode && \
yes | pacman -S whois rsync nmap tcpdump inetutils net-tools ndisc6 && \

View File

@@ -4,4 +4,7 @@
DISK="/dev/sda"
CRYPT_N="lvm-system"
LVM_N="lvmSystem"
LVM_N="lvmSystem"
HOSTNAME="4rt1x"
TIMEZONE="Europe/Prague"
USERNAME="warezjoe"

View File

@@ -4,7 +4,7 @@ source env.sh
#Parted
pacman -Sy && \
pacman -S parted && \
yes | pacman -S parted && \
parted -s $DISK mklabel gpt && \
parted -s -a optimal $DISK mkpart "primary" "fat32" "0%" "512MiB" && \
parted -s $DISK set 1 esp on && \
@@ -39,4 +39,5 @@ mount $DISK\1 /mnt/boot/efi && \
basestrap /mnt base base-devel openrc elogind-openrc linux-hardened linux-hardened-headers linux-firmware && \
fstabgen -U /mnt >> /mnt/etc/fstab && \
echo "tmpfs /tmp tmpfs rw,nosuid,noatime,nodev,size=4G,mode=1777 0 0" >> /mnt/etc/fstab && \
cp after-chroot.sh env.sh /mnt/root/ && \
artix-chroot /mnt /bin/bash