Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-image
Commits
2a5be644
Commit
2a5be644
authored
Nov 19, 2012
by
Nikos Skalkotos
Browse files
Fix a bug introduced in
9fca5245
AssignHostname task did not search for Unattend.xml in a case insensitive way.
parent
c459a69d
Changes
3
Hide whitespace changes
Inline
Side-by-side
snf-image-helper/common.sh
View file @
2a5be644
...
...
@@ -340,6 +340,18 @@ get_last_free_sector() {
fi
}
get_unattend
()
{
local
target
=
"
$1
"
# Workaround to search for $target/Unattend.xml in an case insensitive way.
exists
=
$(
find
"
$target
"
/
-maxdepth
1
-iname
unattend.xml
)
if
[
$(
wc
-l
<<<
"
$exists
"
)
-gt
1
]
;
then
log_error
"Found multiple Unattend.xml files in the image:"
$exists
fi
echo
"
$exists
"
}
cleanup
()
{
# if something fails here, it shouldn't call cleanup again...
trap
- EXIT
...
...
snf-image-helper/tasks/40InstallUnattend.in
View file @
2a5be644
...
...
@@ -45,13 +45,12 @@ fi
target
=
$SNF_IMAGE_TARGET
mkdir
-p
"
$target
/Windows/Setup/Scripts"
# Workaround to search for C:\Unattend.xml in an case insensitive way.
exists
=
$(
find
"
$target
"
/
-maxdepth
1
-iname
unattend.xml
)
unattend
=
$(
get_unattend
"
$target
"
)
if
[
-n
"
$
exists
"
-a
-z
"
$SNF_IMAGE_PROPERTY_USE_DEFAULT_UNATTEND
"
]
;
then
if
[
-n
"
$
unattend
"
-a
-z
"
$SNF_IMAGE_PROPERTY_USE_DEFAULT_UNATTEND
"
]
;
then
warn
"Using the Unattend.xml file found in the image"
else
xargs
rm
-f
<<<
"
$exists
"
rm
-f
"
$unattend
"
if
[
-n
"
$SNF_IMAGE_UNATTEND
"
]
;
then
echo
"Installing custom Unattend.xml file..."
if
[
-f
"
$SNF_IMAGE_UNATTEND
"
]
;
then
...
...
snf-image-helper/tasks/50AssignHostname.in
View file @
2a5be644
...
...
@@ -37,16 +37,21 @@ windows_hostname() {
local
target
=
"
$1
"
local
password
=
"
$2
"
local
tmp_unattend
=
`
mktemp
`
||
exit
1
local
tmp_unattend
=
$(
mktemp
)
||
exit
1
add_cleanup
rm
"
$tmp_unattend
"
echo
-n
"Assigning new computer name..."
local
namespace
=
"urn:schemas-microsoft-com:unattend"
unattend
=
$(
get_unattend
"
$target
"
)
if
[
-z
"
$unattend
"
]
;
then
log_error
"Unattend.xml is missing."
fi
"
$XMLSTARLET
"
ed
-N
x
=
$namespace
-u
"/x:unattend/x:settings/x:component/x:ComputerName"
-v
"
$password
"
"
$
target
/U
nattend
.xml
"
>
"
$tmp_unattend
"
"
$XMLSTARLET
"
ed
-N
x
=
$namespace
-u
"/x:unattend/x:settings/x:component/x:ComputerName"
-v
"
$password
"
"
$
u
nattend
"
>
"
$tmp_unattend
"
cat
"
$tmp_unattend
"
>
"
$
target
/U
nattend
.xml
"
cat
"
$tmp_unattend
"
>
"
$
u
nattend
"
echo
done
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment