blog-contributions/opsec/Arch/echo_memento.sh

112 lines
2.0 KiB
Bash
Raw Normal View History

2024-07-25 12:23:36 +02:00
#!/bin/bash
#boot into usb
loadkeys fr
ping -c4 archlinux.org
timedatectl set-ntp true
ip a | grep inet
pacman -Syy
pacman -S reflector
reflector -c "France" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist
fdisk -l
#one harddrive : /dev/sda
#one partition : /dev/sda1
cfdisk /dev/sda
#gpt partition
#delete this partition
#create new one (512M) (linux filesystem)
#select freespace again
#create new one (20G) (linux filesystem)
#select freespace again
#the rest is for home partition (linux filesystem)
#write changes to disk type yes
#and quit
lsblk
#now format it
#sda1 : 512M
#sda2 : 20G
#sda3 : restG
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
mount /dev/sda2 /mnt
mkdir /mnt/home
mount /dev/sda3 /mnt/home
lsblk
#sda2 is mounted to mnt
#sda3 is mounted to /mnt/home
pacstrap -i /mnt base linux linux-firmware sudo nano
#skid faisait base linux linux-firmware
genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
#root partition
#and home partition
arch-chroot /mnt /bin/bash
ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
hwclock --systohc --utc
date
#timezone correct ?
#nano /etc/locale.gen
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen
echo 'LANG=en_US.UTF-8' >/etc/locale.conf
locale-gen
echo 'KEYMAP=fr' > /etc/vconsole.conf
echo 'nowhere' > /etc/hostname
echo "127.0.0.1 localhost" > /etc/hosts
echo "127.0.1.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
pacman -S networkmanager
systemctl enable NetworkManager
pacman -S dhcpcd
systemctl enable dhcpcd
#set root password
passwd
useradd nothing
mkdir /home/nothing
cp /etc/skel/.* /home/nothing/
chown -R nothing: /home/nothing
#set nothing's password
passwd nothing
pacman -S sudo
echo '%wheel ALL=(ALL) ALL' >> /etc/sudoers
usermod -aG wheel nothing
pacman -S grub os-prober efibootmgr
mkdir /boot/efi
mount /dev/sda1 /boot/efi
lsblk
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --removable
grub-mkconfig -o /boot/grub/grub.cfg
exit
umount -R /mnt
reboot
#tarace go anarchy