Statistics
| Branch: | Tag: | Revision:

root / snf-image-helper / tasks / 40InstallUnattend.in @ 6196f457

History | View | Annotate | Download (1.5 kB)

1
#! /bin/bash
2

    
3
### BEGIN TASK INFO
4
# Provides:		InstallUnattend
5
# RunBefore:		UmountImage
6
# RunAfter:		MountImage
7
# Short-Description:	Installs Unattend.xml for unattended windows setup
8
### END TASK INFO
9

    
10
set -e
11
. "@commondir@/common.sh"
12

    
13
if [ -z "$SNF_IMAGE_TARGET" ]; then
14
    log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing"
15
fi
16

    
17
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" != "windows" ]; then
18
    exit 0
19
fi
20

    
21
if [ ! -f "@commondir@/unattend.xml" ]; then
22
    log_error "File \`@commondir@/unattend.xml' is missing."
23
fi
24

    
25
target=$SNF_IMAGE_TARGET
26
mkdir -p "$target/Windows/Setup/Scripts"
27

    
28
cat "@commondir@/unattend.xml" > "$target/Unattend.xml"
29
echo "del /Q /F C:\Unattend.xml" > \
30
        "$target/Windows/Setup/Scripts/SetupComplete.cmd"
31

    
32
mkdir -p "$target/Windows/SnfScripts"
33

    
34
echo "exit" > "$target/Windows/SnfScripts/ExtendFilesystem"
35
echo "del /Q /F C:\Windows\SnfScripts\ExtendFilesystem" >> \
36
        "$target/Windows/Setup/Scripts/SetupComplete.cmd"
37

    
38
echo "@echo off" > "$target/Windows/SnfScripts/ChangeAdminPassword.cmd"
39
# For security reasons, overwrite the file before deleting...
40
spaces=$(printf "%200s");
41
echo "echo ${spaces// /X} > C:\Windows\SnfScripts\ChangeAdminPassword.cmd" >> \
42
        "$target/Windows/Setup/Scripts/SetupComplete.cmd"
43
echo "del /Q /F C:\Windows\SnfScripts\ChangeAdminPassword.cmd" >> \
44
        "$target/Windows/Setup/Scripts/SetupComplete.cmd"
45

    
46
echo "rmdir C:\Windows\SnfScripts" >> \
47
        "$target/Windows/Setup/Scripts/SetupComplete.cmd"
48

    
49
exit 0
50

    
51
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :