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
f6e23601
Commit
f6e23601
authored
Nov 04, 2011
by
Nikos Skalkotos
Browse files
Add diskdump support in the helper (part 2)
parent
42f09a19
Changes
9
Hide whitespace changes
Inline
Side-by-side
snf-image-helper/common.sh
View file @
f6e23601
...
...
@@ -29,6 +29,7 @@
RESULT
=
/dev/ttyS1
FLOPPY_DEV
=
/dev/fd0
PROGNAME
=
$(
basename
$0
)
PATH
=
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
...
...
@@ -50,6 +51,10 @@ log_error() {
exit
1
}
warn
()
{
echo
"Warning:
$@
"
>
&2
}
get_base_distro
()
{
local
root_dir
=
$1
...
...
@@ -154,6 +159,8 @@ cleanup() {
fi
}
trap
cleanup EXIT
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
snf-image-helper/tasks/10FixPartitionTable.in
View file @
f6e23601
...
...
@@ -20,20 +20,18 @@ fi
retval
=
$(
get_last_partition
"
$SNF_IMAGE_DEV
"
)
id
=
$(
echo
$retval
|
cut
-d
:
-f1
)
pstart
=
$(
echo
$retval
|
cut
-d
:
-f2
)
pend
=
$(
echo
$retval
|
cut
-d
:
-f3
)
ptype
=
$(
echo
$retval
|
cut
-d
:
-f5
)
if
[
$id
-gt
4
]
;
then
log_error
"We don't support logical volumes"
fi
pstart
=
$(
echo
$retval
|
cut
-d
:
-f2
)
pend
=
$(
echo
$retval
|
cut
-d
:
-f3
)
ptype
=
$(
echo
$retval
|
cut
-d
:
-f5
)
if
[
x
"
$ptype
"
=
"x"
]
;
then
# Don't know how to handle this
echo
"Warning: Last partition with id:
\`
$id
' is empty"
\
"or has unknown filesystem"
warn
"Last partition with id:
\`
$id
' is empty or has unknown filesystem"
warn
"I won't resize the partition"
exit
0
fi
...
...
@@ -41,7 +39,7 @@ new_pend=$(get_last_free_sector "$SNF_IMAGE_DEV")
#Extend the partition
$PARTED
-s
-m
"
$SNF_IMAGE_DEV
"
rm
$id
$PARTED
-s
-m
"
$SNF_IMAGE_DEV
"
rm
"
$id
"
$PARTED
-s
-m
"
$SNF_IMAGE_DEV
"
mkpart primary
"
$ptype
"
"
$pstart
"
"
$new_pend
"
#inform the kernel about the changes
...
...
snf-image-helper/tasks/20FilesystemResizeUnmounted.in
View file @
f6e23601
...
...
@@ -14,16 +14,12 @@ if [ ! -b "$SNF_IMAGE_DEV" ]; then
log_error
"Device file:
\`
${
SNF_IMAGE_DEV
}
' is not a block device"
fi
if
[
-z
"
$SNF_IMAGE_TYPE
"
]
;
then
log_error
"Image type does not exist"
fi
last_partition
=
$(
get_last_partition
"
$SNF_IMAGE_DEV
"
)
id
=
$(
echo
"
$last_partition
"
|
cut
-d
:
-f1
)
ptype
=
$(
echo
"
$last_partition
"
|
cut
-d
:
-f5
)
if
[[
"
$ptype
"
=
~
ext[234]
]]
;
then
device
=
"
$SNF_IMAGE_DEV
""
$
id
"
if
[[
"
$ptype
"
=
=
ext[234]
]]
;
then
device
=
"
$
{
SNF_IMAGE_DEV
}${
id
}
"
"
$RESIZE2FS
"
"
$device
"
fi
...
...
snf-image-helper/tasks/40AddDeleteUnattendScript.in
View file @
f6e23601
...
...
@@ -14,7 +14,7 @@ if [ ! -d "$SNF_IMAGE_TARGET" ]; then
log_error
"Target dir:
\`
$SNF_IMAGE_TARGET
' is missing"
fi
if
[
"
$SNF_IMAGE_
TYPE
"
=
"
ntfsdump
"
]
;
then
if
[
"
$SNF_IMAGE_
OS
"
=
"
windows
"
]
;
then
# Make sure Unattend.xml is removed after setup has finished
mkdir
-p
"
$SNF_IMAGE_TARGET
/Windows/Setup/Scripts"
echo
"del /Q /F C:
\U
nattend.xml"
>
"
$SNF_IMAGE_TARGET
/Windows/Setup/Scripts/SetupComplete.cmd"
...
...
snf-image-helper/tasks/40DeleteSSHKeys.in
View file @
f6e23601
...
...
@@ -16,7 +16,7 @@ fi
target
=
"
$SNF_IMAGE_TARGET
"
if
[
"
$SNF_IMAGE_
TYPE
"
!=
"
extdump
"
]
;
then
if
[
"
$SNF_IMAGE_
OS
"
!=
"
linux
"
]
;
then
cleanup
trap
- EXIT
exit
0
...
...
snf-image-helper/tasks/40InstallUnattend.in
View file @
f6e23601
...
...
@@ -11,10 +11,10 @@ set -e
.
"@commondir@/common.sh"
if
[
-z
"
$SNF_IMAGE_TARGET
"
]
;
then
log_error
"Target dir:
\`
$SNF_IMAGE_TARGET
' is missing"
log_error
"Target dir:
\`
$SNF_IMAGE_TARGET
' is missing"
fi
if
[
"
$SNF_IMAGE_
TYPE
"
!=
"
ntfsdump
"
]
;
then
if
[
"
$SNF_IMAGE_
OS
"
!=
"
windows
"
]
;
then
exit
0
fi
...
...
snf-image-helper/tasks/40SELinuxAutorelabel.in
View file @
f6e23601
...
...
@@ -14,7 +14,7 @@ if [ ! -d "$SNF_IMAGE_TARGET" ]; then
log_error
"Target dir:
\`
$SNF_IMAGE_TARGET
' is missing"
fi
if
[
"
$SNF_IMAGE_
TYPE
"
=
"
extdump
"
]
;
then
if
[
"
$SNF_IMAGE_
OS
"
=
"
linux
"
]
;
then
distro
=
$(
get_base_distro
$SNF_IMAGE_TARGET
)
if
[
"
$distro
"
=
"redhat"
]
;
then
...
...
snf-image-helper/tasks/50AssignHostname.in
View file @
f6e23601
...
...
@@ -62,9 +62,9 @@ if [ -z "$SNF_IMAGE_HOSTNAME" ]; then
log_error
"Hostname is missing"
fi
if
[
"
$SNF_IMAGE_
TYPE
"
=
"
ntfsdump
"
]
;
then
if
[
"
$SNF_IMAGE_
OS
"
=
"
windows
"
]
;
then
windows_hostname
"
$SNF_IMAGE_TARGET
"
"
$SNF_IMAGE_HOSTNAME
"
elif
[
"
$SNF_IMAGE_
TYPE
"
=
"
extdump
"
]
;
then
elif
[
"
$SNF_IMAGE_
OS
"
=
"
linux
"
]
;
then
linux_hostname
"
$SNF_IMAGE_TARGET
"
"
$SNF_IMAGE_HOSTNAME
"
fi
...
...
snf-image-helper/tasks/50ChangePassword.in
View file @
f6e23601
...
...
@@ -66,9 +66,9 @@ if [ -z "$SNF_IMAGE_PASSWORD" ]; then
log_error
"Password is missing"
fi
if
[
"
$SNF_IMAGE_
TYPE
"
=
"
ntfsdump
"
]
;
then
if
[
"
$SNF_IMAGE_
OS
"
=
"
windows
"
]
;
then
windows_password
"
$SNF_IMAGE_TARGET
"
"
$SNF_IMAGE_PASSWORD
"
elif
[
"
$SNF_IMAGE_
TYPE
"
=
"
extdump
"
]
;
then
elif
[
"
$SNF_IMAGE_
OS
"
=
"
linux
"
]
;
then
linux_password
"
$SNF_IMAGE_TARGET
"
"
$SNF_IMAGE_PASSWORD
"
fi
...
...
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