-
Notifications
You must be signed in to change notification settings - Fork 5
/
ks_template.cfg
101 lines (86 loc) · 3 KB
/
ks_template.cfg
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
#version=DEVEL
%pre
#password=$(tr -dc A-NP-Za-z1-9 </dev/urandom | head -c 12)
password="12345678"
echo "Luks Password: $password"
GPU="GPU_INTERNAL"
DEVICE="$(dmidecode --s "system-product-name")"
if [[ "$DEVICE" == "V5xTNC_TND_TNE" || "$DEVICE" == "V54x_6x_TU" || "$DEVICE" == "MS-7E06" || "$DEVICE" == "nitropad-ns50" || "$DEVICE" == "nitropad-nv41" || "$DEVICE" == "NitroPad-NV41" || "$DEVICE" == "NitroPad-NS51" || "$DEVICE" == "NitroPC" ]]; then
DISK_INSTALL="nvme0n1"
else
DISK_INSTALL="sda"
fi
DISK_DATA="/dev/$(lsblk -l -o name,label|grep QUBES_OEM|head -n 1|cut -d " " -f 1)"
DISK_QISO="/dev/$(lsblk -l -o name,label|grep QUBES-R4|head -n 1|cut -d " " -f 1)"
if echo "$DISK_DATA $DISK_QISO" |grep "$DISK_INSTALL"; then
echo "ERROR: Disk Data: $DISK_DATA is also Disk Install: $DISK_INSTALL"
exit 1
fi
#fix for https://github.com/QubesOS/qubes-issues/issues/9440
date -s "11/25/2024 10:00:00"
hwclock -w
date
echo "DISK_DATA: $DISK_DATA"
echo "DISK_INSTALL: $DISK_INSTALL"
echo "DEVICE: $DEVICE"
mkdir /tmp/data_nitro
mkdir /tmp/mnt
mount $DISK_DATA /tmp/mnt
cp -r /tmp/mnt/nitrokey /tmp/data_nitro
cp -r /tmp/mnt/gpu_install /tmp/gpu_install
umount /tmp/mnt
echo "ignoredisk --only-use=${DISK_INSTALL}" > /tmp/part-include
#hide external graphic card
if [[ "$GPU" == "GPU_EXTERNAL" ]];then
echo "bootloader --location=mbr --boot-drive=${DISK_INSTALL} --append="rd.qubes.hide_pci=01:00.0"" >> /tmp/part-include
else
echo "bootloader --location=mbr --boot-drive=${DISK_INSTALL}" >> /tmp/part-include
fi
echo "autopart --type thinp --encrypted --passphrase=\"$password\"" >> /tmp/part-include
# wipe first 5GB of the disk workaround for clearpart not working proper
dd if=/dev/zero of=/dev/${DISK_INSTALL} bs=1000MB count=5
%end
# Use graphical install
graphical
# clear disk
zerombr
#Keyboard layouts
keyboard --vckeymap=KB_LANG --xlayouts='KB_LANG'
# System language
lang SYS_LANG
# Network information
network --hostname=dom0
# System timezone
timezone Europe/Berlin --utc
# X Window System configuration information
xconfig --startxonboot
# Root password
rootpw --lock
# Partition clearing information
# Disk partitioning information
%include /tmp/part-include
# Poweroff after installation
poweroff
%packages
@^qubes-xfce
kernel-latest
kernel-latest-qubes-vm
%end
%post --nochroot
set -e
oem_dir=/tmp/data_nitro
mkdir /mnt/sysimage/srv/formulas/base/nitrokey-formula/
cp -a $oem_dir/nitrokey /mnt/sysimage/srv/formulas/base/nitrokey-formula/
# Force xserver to use the intel graphic card to make it work with a external graphic card
if [[ "$GPU" == "GPU_EXTERNAL" ]];then
cp /tmp/gpu_install/20-intel.conf /mnt/sysimage/etc/X11/xorg.conf.d/
cp /tmp/gpu_install/install.sh /mnt/sysimage/
fi
mkdir -p /mnt/sysimage/srv/salt/_tops/base
ln -s /srv/formulas/base/nitrokey-formula/nitrokey/init.top \
/mnt/sysimage/srv/salt/_tops/base/nitrokey.top
printf 'file_roots:\n base:\n - %s\n' \
'/srv/formulas/base/nitrokey-formula' \
> /mnt/sysimage/etc/salt/minion.d/formula-nitrokey.conf
echo "Build EN"
%end