@@ -35,8 +35,7 @@ let sanitize_name =
35
35
module Linux = struct
36
36
let firstboot_dir = " /usr/lib/virt-sysprep"
37
37
38
- let firstboot_sh = sprintf " \
39
- #!/bin/sh -
38
+ let firstboot_sh = sprintf {| #! / bin/ sh -
40
39
41
40
# ## BEGIN INIT INFO
42
41
# Provides : virt- sysprep
@@ -57,14 +56,14 @@ d=%s/scripts
57
56
d_done=% s/ scripts- done
58
57
logfile=~ root/ virt- sysprep- firstboot.log
59
58
60
- echo \ " $0\" \ " $@\ " 2>&1 | tee -a $logfile
61
- echo \ " Scripts dir: $d\ " 2>&1 | tee -a $logfile
59
+ echo " $0" " $@" 2 > & 1 | tee - a $ logfile
60
+ echo " Scripts dir: $d" 2 > & 1 | tee - a $ logfile
62
61
63
- if test \ " $1\ " = \ " start\ "
62
+ if test " $1" = " start"
64
63
then
65
64
mkdir - p $ d_done
66
65
for f in $ d/* ; do
67
- if test -x \ " $f\ "
66
+ if test - x " $f"
68
67
then
69
68
# move the script to the 'scripts- done ' directory, so it is not
70
69
# executed again at the next boot
75
74
done
76
75
rm - f $ d_done/*
77
76
fi
78
- " firstboot_dir firstboot_dir
77
+ | } firstboot_dir firstboot_dir
79
78
80
79
let systemd_target = " multi-user.target"
81
80
@@ -282,38 +281,37 @@ module Windows = struct
282
281
* XXX It would be better to use powershell here. For some ideas see
283
282
* https://github.com/HCK-CI/HLK-Setup-Scripts/
284
283
*)
285
- let firstboot_script = sprintf " \
286
- @echo off
284
+ let firstboot_script = sprintf {|@ echo off
287
285
288
286
setlocal EnableDelayedExpansion
289
287
set firstboot=% s
290
- set log=%%firstboot%%\\ log.txt
288
+ set log=%% firstboot%% \log.txt
291
289
292
- set scripts=%%firstboot%%\\ scripts
293
- set scripts_done=%%firstboot%%\\ scripts-done
290
+ set scripts=%% firstboot%% \scripts
291
+ set scripts_done=%% firstboot%% \scripts- done
294
292
295
- call :main >> \ " %%log%%\ " 2>&1
293
+ call :main >> "%%log%%" 2 > & 1
296
294
exit / b
297
295
298
296
:main
299
297
echo starting firstboot service
300
298
301
- if not exist \ " %%scripts_done%%\ " (
302
- mkdir \ " %%scripts_done%%\ "
299
+ if not exist "%%scripts_done%%" (
300
+ mkdir "%%scripts_done%%"
303
301
)
304
302
305
303
:: Pick the next script to run .
306
- for %%%%f in (\ " %%scripts%%\"\ \ *.bat) do (
307
- echo running \ " %%%%f\ "
308
- pushd \ " %%scripts%%\ "
309
- call \ " %%%%~nf\ "
304
+ for %%%% f in (" %%scripts%%" \*. bat) do (
305
+ echo running " %%%%f"
306
+ pushd " %%scripts%%"
307
+ call " %%%%~nf"
310
308
set elvl=! errorlevel!
311
309
echo .... exit code ! elvl!
312
310
popd
313
311
314
312
if ! elvl! NEQ 249 (
315
313
echo Script succeeded, moving to scripts- done
316
- move \ " %%%%f\" \ " %%scripts_done%%\ "
314
+ move " %%%%f" " %%scripts_done%%"
317
315
) else (
318
316
echo Script failed, will retry on next boot
319
317
)
@@ -329,8 +327,8 @@ for %%%%f in (\"%%scripts%%\"\\*.bat) do (
329
327
330
328
:: Fallthrough here if there are no scripts.
331
329
echo uninstalling firstboot service
332
- \ " %%firstboot%%\\ %s \ " -s firstboot uninstall
333
- " firstboot_dir_win srvany in
330
+ " %%firstboot%%\% s " - s firstboot uninstall
331
+ | } firstboot_dir_win srvany in
334
332
335
333
g#write (firstboot_dir // " firstboot.bat" )
336
334
(String. unix2dos firstboot_script);
0 commit comments