@@ -128,17 +128,6 @@ VAI_configure_hostname() {
128
128
echo " ${hostname} " > " ${target} /etc/hostname"
129
129
}
130
130
131
- VAI_configure_rc_conf () {
132
- # Set the value of various tokens
133
- sed -i " s:Europe/Madrid:${timezone} :" " ${target} /etc/rc.conf"
134
- sed -i " s:\" es\" :\" ${keymap} \" :" " ${target} /etc/rc.conf"
135
-
136
- # Activate various tokens
137
- sed -i " s:#HARDWARECLOCK:HARDWARECLOCK:" " ${target} /etc/rc.conf"
138
- sed -i " s:#TIMEZONE:TIMEZONE:" " ${target} /etc/rc.conf"
139
- sed -i " s:#KEYMAP:KEYMAP:" " ${target} /etc/rc.conf"
140
- }
141
-
142
131
VAI_add_user () {
143
132
chroot " ${target} " useradd -m -s /bin/bash -U -G wheel,users,audio,video,cdrom,input " ${username} "
144
133
if [ -z " ${password} " ] ; then
@@ -154,7 +143,7 @@ VAI_configure_grub() {
154
143
echo " hostonly=yes" > " ${target} /etc/dracut.conf.d/hostonly.conf"
155
144
156
145
# Choose the newest kernel
157
- kernel_version=" $( chroot " ${target} " xbps-query linux | awk -F " [-_] " ' /pkgver/ {print $2} ' ) "
146
+ kernel_version=" $( xbps-uhelper -r ${target} version linux | sed ' s/_.*// ' ) "
158
147
159
148
# Install grub
160
149
chroot " ${target} " grub-install " ${disk} "
@@ -220,8 +209,10 @@ VAI_end_action() {
220
209
221
210
VAI_configure_autoinstall () {
222
211
# -------------------------- Setup defaults ---------------------------
223
- disk=" $( lsblk -ipo NAME,TYPE,MOUNTPOINT | awk ' {if ($2=="disk") {disks[$1]=0; last=$1} if ($3=="/") {disks[last]++}} END {for (a in disks) {if(disks[a] == 0){print a; break}}}' ) "
224
- hostname=" $( ip -4 -o -r a | awk -F' [ ./]' ' {x=$7} END {print x}' ) "
212
+ disk_expr=" .blockdevices[0].name"
213
+ disk=" $( lsblk --json | jq -r " $disk_expr " ) "
214
+ hostname_expr=' [.[]|select(.operstate=="UP").addr_info.[]|select(.scope=="global").local].[0]'
215
+ hostname=" $( ip --json -r a | jq -r " $hostname_expr " ) "
225
216
target=" /mnt"
226
217
timezone=" America/Chicago"
227
218
keymap=" us"
0 commit comments