Revision a1b18724

b/example/hooks/windows/hostname
1
#!/bin/bash
2

  
3
set -e
4
. common.sh
5
. common_windows.sh
6

  
7
debug set -x
8

  
9
CLEANUP=( )
10

  
11
if [ -z "$HOSTNAME" ] ; then
12
    log_error "Missing hostname"
13
    exit 1
14
fi
15

  
16
if [ -z "$TARGET" -o ! -d "$TARGET" ] ; then
17
    log_error "Missing target directory"
18
    exit 1
19
fi
20

  
21
NEW_UNATTEND=`mktemp` || exit 1
22
CLEANUP+=("rm $NEW_UNATTEND")
23

  
24
echo -n "Executing hostname hook..."
25

  
26
NAMESPACE="urn:schemas-microsoft-com:unattend"
27

  
28
$XMLSTARLET ed -N x=$NAMESPACE -u "/x:unattend/x:settings/x:component/x:ComputerName" -v $HOSTNAME "$TARGET/Unattend.xml" > $NEW_UNATTEND
29

  
30
cat $NEW_UNATTEND > "$TARGET/Unattend.xml"
31

  
32
echo "done"
33

  
34
# execute cleaups
35
cleanup
36
trap - EXIT
37

  
38
echo "done"
39
exit 0
b/unattend.xml
4 4
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5 5
            <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
6 6
            <TimeZone>GTB Standard Time</TimeZone>
7
            <ComputerName>*</ComputerName>
7 8
        </component>
8 9
        <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
9 10
            <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon>

Also available in: Unified diff