-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·37 lines (33 loc) · 1.09 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#
# dnf install systemd-container
#
[[ $EUID -eq 0 ]] && {
echo "run as normal user"
exit 1
}
OG_USER=$(whoami)
mkdir -p rootfs #on btrfs: btrfs subvolume create rootfs
cd rootfs
ls -A1 | sudo xargs rm -rf
mkdir -p proc sys dev run
sudo mount -tproc /proc proc/
sudo mount -obind -tsysfs /sys sys/
sudo mount -obind /dev dev/
sudo mount -obind /run run/
cd ..
sudo dnf -y --use-host-config --releasever=40 --best --setopt=install_weak_deps=False --repo=fedora --repo=updates --installroot=$(pwd)/rootfs install dhcp-client dnf fedora-release glibc glibc-langpack-en iputils less ncurses passwd systemd systemd-networkd systemd-resolved util-linux vim-default-editor e2fsprogs efitools efibootmgr
sudo umount rootfs/proc
sudo umount rootfs/sys
sudo umount rootfs/dev
sudo umount rootfs/run
sudo chown -R ${OG_USER}: rootfs
chmod u+w rootfs
echo "Enter new root password:"
PW=$(mkpasswd)
chmod 600 rootfs/etc/shadow
sed -i -E "/^root:[*]:(.*)/ s@@root:${PW}:\1@" rootfs/etc/shadow
chmod 400 rootfs/etc/shadow
chmod 400 rootfs/etc/shadow-
chmod 400 rootfs/etc/gshadow
chmod 400 rootfs/etc/gshadow-