-
Notifications
You must be signed in to change notification settings - Fork 2
/
EuroLinux-9-rpi-minimal.ks
183 lines (153 loc) · 4.77 KB
/
EuroLinux-9-rpi-minimal.ks
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
url --url="https://fbi.cdn.euro-linux.com/dist/eurolinux/server/9/aarch64/BaseOS/os/"
rootpw --plaintext raspberry
# Repositories to use
repo --name="baseos" --baseurl=https://fbi.cdn.euro-linux.com/dist/eurolinux/server/9/aarch64/BaseOS/os/
repo --name="appstream" --baseurl=https://fbi.cdn.euro-linux.com/dist/eurolinux/server/9/aarch64/AppStream/os/
repo --name="raspberrypi" --baseurl=https://fbi.cdn.euro-linux.com/dist/eurolinux/server/9/aarch64/RPI/all/ --cost=1000 --install
# install
keyboard us --xlayouts=us --vckeymap=us
timezone --isUtc --nontp UTC
selinux --enforcing
firewall --enabled --port=22:tcp
network --bootproto=dhcp --device=link --activate --onboot=on
services --enabled=sshd,NetworkManager,chronyd,cpupower
shutdown
bootloader --location=mbr
lang en_US.UTF-8
# Disk setup
clearpart --initlabel --all
part /boot --asprimary --fstype=vfat --size=512 --label=boot
part swap --asprimary --fstype=swap --size=256 --label=swap
part / --asprimary --fstype=ext4 --size=2000 --label=rootfs
# Package setup
%packages
-caribou*
-gnome-shell-browser-plugin
-java-1.6.0-*
-java-1.7.0-*
-java-11-*
-python*-caribou*
@core
bash-completion
NetworkManager-wifi
el-release
chrony
cloud-utils-growpart
e2fsprogs
net-tools
raspberrypi2-firmware
raspberrypi2-kernel4
raspberrypi-userland
nano
%end
%post
#######################
# FILES CONFIGURATION #
#######################
## Add rpi repository
cat > /etc/yum.repos.d/rpi.repo <<EOF
[rpi-eurolinux-9]
name=Raspberry PI for EuroLinux 9
baseurl=https://fbi.cdn.euro-linux.com/dist/eurolinux/server/9/aarch64/RPI/all/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-eurolinux9
EOF
## rootfs-expand that allows to easily fix partition size
cat > /usr/sbin/rootfs-expand << EOF
#!/bin/bash
clear
part=\$(mount |grep '^/dev.* / ' |awk '{print \$1}')
if [ -z "\$part" ];then
echo "Error detecting rootfs"
exit -1
fi
dev=\$(echo \$part|sed 's/[0-9]*\$//g')
devlen=\${#dev}
num=\${part:\$devlen}
if [[ "\$dev" =~ ^/dev/mmcblk[0-9]*p\$ ]];then
dev=\${dev:0:-1}
fi
if [ ! -x /usr/bin/growpart ];then
echo "Please install cloud-utils-growpart (sudo yum install cloud-utils-growpart)"
exit -2
fi
if [ ! -x /usr/sbin/resize2fs ];then
echo "Please install e2fsprogs (sudo yum install e2fsprogs)"
exit -3
fi
echo \$part \$dev \$num
echo "Extending partition \$num to max size ...."
growpart \$dev \$num
echo "Resizing ext4 filesystem ..."
resize2fs \$part
echo "Done."
df -h |grep \$part
EOF
chmod 755 /usr/sbin/rootfs-expand
# MOTD
cat << EOF > /etc/motd
Welcome to EuroLinux for Raspberry Pi!
Any suggestions are welcome at https://github.com/EuroLinux/raspberry-pi-build
Happy using.
To delete this message use:
echo '' > /etc/motd
EOF
# README
cat >/root/README << EOF
== EuroLinux 9 ==
If you want to resize your / partition, just type the following (as superuser):
rootfs-expand
Any suggestions are welcome at https://github.com/EuroLinux/raspberry-pi-build
EOF
cat > /boot/config.txt << EOF
# This file is provided as a placeholder for user options
# defaults for better graphic support
#disable_overscan=1
#dtoverlay=vc4-kms-v3d
#camera_auto_detect=0
#gpu_mem=64
#max_framebuffers=2
# Uncomment to enable SPI
#dtparam=spi=on
# Uncomment to enable I2C
#dtparam=i2c_arm=on
# Overclocking - CHECK DOCS!!!!
#over_voltage=8
#arm_freq=2300
EOF
# Specific cmdline.txt files needed for raspberrypi2/3
cat > /boot/cmdline.txt << EOF
console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait
EOF
# Remove ifcfg-link on pre generated images
rm -f /etc/sysconfig/network-scripts/ifcfg-link
# rebuild dnf cache
dnf clean all
/bin/date +%Y%m%d_%H%M > /etc/BUILDTIME
echo '%_install_langs C.utf8' > /etc/rpm/macros.image-language-conf
echo 'LANG="C.utf8"' > /etc/locale.conf
rpm --rebuilddb
# Remove machine-id on pre generated images
rm -f /etc/machine-id
touch /etc/machine-id
# Remove the ssh keys
rm -f "/etc/ssh/*_key*"
%end
%post --nochroot --erroronfail
hostnamectl set-hostname raspberry
/usr/sbin/blkid
LOOPPART=$(cat /proc/self/mounts |/usr/bin/grep '^\/dev\/mapper\/loop[0-9]p[0-9] '"$INSTALL_ROOT " | /usr/bin/sed 's/ .*//g')
echo "Found loop part for PARTUUID $LOOPPART"
BOOTDEV=$(/usr/sbin/blkid $LOOPPART|grep 'PARTUUID="........-03"'|sed 's/.*PARTUUID/PARTUUID/g;s/ .*//g;s/"//g')
echo "no chroot selected bootdev=$BOOTDEV"
if [ -n "$BOOTDEV" ];then
cat $INSTALL_ROOT/boot/cmdline.txt
echo sed -i "s|root=/dev/mmcblk0p3|root=${BOOTDEV}|g" $INSTALL_ROOT/boot/cmdline.txt
sed -i "s|root=/dev/mmcblk0p3|root=${BOOTDEV}|g" $INSTALL_ROOT/boot/cmdline.txt
fi
cat $INSTALL_ROOT/boot/cmdline.txt
# Fix swap partition
UUID_SWAP=$(/bin/grep 'swap' $INSTALL_ROOT/etc/fstab | awk '{print $1}' | awk -F '=' '{print $2}')
/usr/sbin/mkswap -L "_swap" -p 4096 -U "${UUID_SWAP}" /dev/disk/by-uuid/${UUID_SWAP}
%end