From c4447efbc92cac1c7ead9dd764649f4e0293ce2f Mon Sep 17 00:00:00 2001 From: Nikos Skalkotos Date: Fri, 30 Sep 2011 13:12:02 +0300 Subject: [PATCH] Add commondir variable to helper's building system --- helper/Makefile.am | 11 +++++++---- helper/tasks/10ResizeUnmounted.in | 2 +- helper/tasks/30MountImage.in | 2 +- helper/tasks/40AddDeleteUnattendScript.in | 2 +- helper/tasks/40DeleteSSHKeys.in | 2 +- helper/tasks/40InstallUnattend.in | 2 +- helper/tasks/40ResizeMounted.in | 2 +- helper/tasks/40SELinuxAutorelabel.in | 2 +- helper/tasks/50AssignHostname.in | 2 +- helper/tasks/50ChangePassword.in | 4 ++-- helper/tasks/80UmountImage.in | 2 +- helper/tasks/Makefile.am | 5 ++--- 12 files changed, 20 insertions(+), 18 deletions(-) diff --git a/helper/Makefile.am b/helper/Makefile.am index 64b5bb6..8b71f28 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -1,23 +1,26 @@ -base_name=$(subst -helper,,$(PACKAGE)) - SUBDIRS = tasks +base_name=$(subst -helper,,$(PACKAGE)) initdir=$(sysconfdir) commondir=$(datarootdir)/$(base_name) +export base_name +export commondir dist_doc_DATA = COPYING AUTHORS ChangeLog dist_init_SCRIPTS = rc.local snf-passtohash.py -dist_init_DATA = common.sh +dist_common_SCRIPTS= snf-passtohash.py +dist_common_DATA = common.sh edit = sed \ -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ -e 's|@localstatedir[@]|$(localstatedir)|g' \ -e 's|@datarootdir[@]|$(datarootdir)|g' \ - -e 's|@base_name[@]|$(base_name)|g' + -e 's|@base_name[@]|$(base_name)|g'\ -e 's|@RESIZE2FS[@]|$(RESIZE2FS)|g' \ -e 's|@XMLSTARLET[@]|$(XMLSTARLET)|g' %:%.in Makefile + @echo "Real Path is: $(rootdir)" rm -f $@ $@.tmp srcdir=''; \ test -f ./$@.in || srcdir=$(srcdir)/; \ diff --git a/helper/tasks/10ResizeUnmounted.in b/helper/tasks/10ResizeUnmounted.in index fbabeb9..0755641 100644 --- a/helper/tasks/10ResizeUnmounted.in +++ b/helper/tasks/10ResizeUnmounted.in @@ -7,7 +7,7 @@ ### END TAST INFO set -e -. @datarootdir@/@base_name@/common.sh +. @commondir@/common.sh if [ ! -b "$SNF_IMAGE_DEV" ]; then log_error "Device file:\`${SNF_IMAGE_DEV}' is not a block device" diff --git a/helper/tasks/30MountImage.in b/helper/tasks/30MountImage.in index 5c74f9b..46865af 100644 --- a/helper/tasks/30MountImage.in +++ b/helper/tasks/30MountImage.in @@ -7,7 +7,7 @@ ### END TAST INFO set -e -. @datarootdir@/@base_name@/common.sh +. @commondir@/common.sh if [ ! -d "$SNF_IMAGE_TARGET" ]; then log_error "Target dir:\`$SNF_IMAGE_TARGET' is missing" diff --git a/helper/tasks/40AddDeleteUnattendScript.in b/helper/tasks/40AddDeleteUnattendScript.in index 32cb336..6dfc585 100644 --- a/helper/tasks/40AddDeleteUnattendScript.in +++ b/helper/tasks/40AddDeleteUnattendScript.in @@ -8,7 +8,7 @@ ### END TAST INFO set -e -. @datarootdir@/@base_name@/common.sh +. @commondir@/common.sh if [ ! -d "$SNF_IMAGE_TARGET" ]; then log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing" diff --git a/helper/tasks/40DeleteSSHKeys.in b/helper/tasks/40DeleteSSHKeys.in index bd2d005..7072843 100644 --- a/helper/tasks/40DeleteSSHKeys.in +++ b/helper/tasks/40DeleteSSHKeys.in @@ -7,7 +7,7 @@ ### END TAST INFO set -e -. @datarootdir@/@base_name@/common.sh +. @commondir@/common.sh if [ ! -d "$SNF_IMAGE_TARGET" ]; then log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing." diff --git a/helper/tasks/40InstallUnattend.in b/helper/tasks/40InstallUnattend.in index 8273ae9..a2fb02b 100644 --- a/helper/tasks/40InstallUnattend.in +++ b/helper/tasks/40InstallUnattend.in @@ -8,7 +8,7 @@ ### END TAST INFO set -e -. @datarootdir@/@base_name@/common.sh +. @commondir@/common.sh if [ -z "$SNF_IMAGE_TARGET" ]; then log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing" diff --git a/helper/tasks/40ResizeMounted.in b/helper/tasks/40ResizeMounted.in index fdd3d04..9e52350 100644 --- a/helper/tasks/40ResizeMounted.in +++ b/helper/tasks/40ResizeMounted.in @@ -8,7 +8,7 @@ ### END TAST INFO set -e -. @datarootdir@/@base_name@/common.sh +. @commondir@/common.sh if [ ! -d "$SNF_IMAGE_TARGET" ]; then log_error "Target directory \`$SNF_IMAGE_TARGET' is missing" diff --git a/helper/tasks/40SELinuxAutorelabel.in b/helper/tasks/40SELinuxAutorelabel.in index 6937a53..a327169 100644 --- a/helper/tasks/40SELinuxAutorelabel.in +++ b/helper/tasks/40SELinuxAutorelabel.in @@ -8,7 +8,7 @@ ### END TAST INFO set -e -. @datarootdir@/@base_name@/common.sh +. @commondir@/common.sh if [ ! -d "$SNF_IMAGE_TARGET" ]; then log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing" diff --git a/helper/tasks/50AssignHostname.in b/helper/tasks/50AssignHostname.in index 44dcc0e..fb28478 100644 --- a/helper/tasks/50AssignHostname.in +++ b/helper/tasks/50AssignHostname.in @@ -8,7 +8,7 @@ ### END TAST INFO set -e -. @datarootdir@/@base_name@/common.sh +. @commondir@/common.sh windows_hostname() { local target=$1 diff --git a/helper/tasks/50ChangePassword.in b/helper/tasks/50ChangePassword.in index 608a9d2..55abea7 100644 --- a/helper/tasks/50ChangePassword.in +++ b/helper/tasks/50ChangePassword.in @@ -8,7 +8,7 @@ ### END TAST INFO set -e -. @datarootdir@/@base_name@/common.sh +. @commondir@/common.sh windows_password() { local target=$1 @@ -31,7 +31,7 @@ linux_password() { local target=$1 local password=$2 - local hash=$(/usr/share/snf-image/snf-passtohash.py $password) + local hash=$(@commondir@/snf-passtohash.py $password) if [ ! -e ${target}/etc/shadow ]; then log_error "No /etc/shadow found!" fi diff --git a/helper/tasks/80UmountImage.in b/helper/tasks/80UmountImage.in index a06873a..2467929 100644 --- a/helper/tasks/80UmountImage.in +++ b/helper/tasks/80UmountImage.in @@ -8,7 +8,7 @@ ### END TAST INFO set -e -. @datarootdir@/@base_name@/common.sh +. @commondir@/common.sh if [ ! -d "$SNF_IMAGE_TARGET" ]; then log_error "Target dir:\`$SNF_IMAGE_TARGET' is missing" diff --git a/helper/tasks/Makefile.am b/helper/tasks/Makefile.am index b7fee12..40a3a7b 100644 --- a/helper/tasks/Makefile.am +++ b/helper/tasks/Makefile.am @@ -1,6 +1,5 @@ -base_name=$(subst -helper,,$(PACKAGE)) - tasksdir=${libdir}/$(base_name)/tasks + dist_tasks_SCRIPTS = \ 10ResizeUnmounted \ 30MountImage \ @@ -18,7 +17,7 @@ edit = sed \ -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ -e 's|@localstatedir[@]|$(localstatedir)|g' \ -e 's|@datarootdir[@]|$(datarootdir)|g' \ - -e 's|@base_name[@]|$(base_name)|g' + -e 's|@commondir[@]|$(commondir)|g' %:%.in Makefile rm -f $@ $@.tmp -- 1.7.10.4