Skip to content

Commit

Permalink
Use the dynamic example as a default configuration.
Browse files Browse the repository at this point in the history
* Makefile.am (variantsdir): New variable.
(do_subst): Use it.
(install-exec-local, uninstall-local): New targets.
* common.sh.in (DEFAULT_CONFIG): New variable.
* configure.ac: Test for MKDIR_P and LN_S.
* create: Use DEFAULT_CONFIG unless OSP_CONFIG is provided.
* verify: Don't require OSP_CONFIG.
  • Loading branch information
mbakke committed May 30, 2019
1 parent 4a77a02 commit cb926f3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
10 changes: 10 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ AUTOMAKE_OPTIONS = no-dist-gzip dist-lzip

osname=$(subst ganeti-instance-,,$(PACKAGE))
osdir=$(OS_DIR)/$(osname)
variantsdir = $(DESTDIR)$(sysconfdir)/ganeti/instance-guix

dist_os_SCRIPTS = create import export rename verify
dist_os_DATA = ganeti_api_version parameters.list
Expand All @@ -20,6 +21,7 @@ EXTRA_DIST = \

do_subst = sed \
-e 's,[@]localstatedir[@],$(localstatedir),g' \
-e 's,[@]variantsdir[@],$(variantsdir),g' \
-e 's,[@]BLOCKDEV[@],$(BLOCKDEV),g' \
-e 's,[@]GUIX[@],$(GUIX),g' \
-e 's,[@]GUIXPROFILEDIR[@],$(GUIXPROFILEDIR),g' \
Expand All @@ -28,4 +30,12 @@ do_subst = sed \
common.sh: common.sh.in Makefile
$(do_subst) < $< > $@

install-exec-local:
$(MKDIR_P) $(variantsdir)
$(LN_S) $(exampledir)/dynamic.scm $(variantsdir)/default.scm
$(MKDIR_P) $(GUIXPROFILEDIR)

uninstall-local:
test -L $(variantsdir)/default.scm && rm -f $(variantsdir)/default.scm || true

CLEANFILES = common.sh
1 change: 1 addition & 0 deletions common.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ GUIX=@GUIX@
GUIXPROFILEDIR=@GUIXPROFILEDIR@
QEMU_IMG=@QEMU_IMG@

DEFAULT_CONFIG="@variantsdir@/default.scm"
CACHE_DIR="@localstatedir@/cache/ganeti-instance-guix"

if [ $DISK_COUNT -gt 0 -a -n "$DISK_0_PATH" ]; then
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ AC_SUBST(GUIXPROFILEDIR, $guixprofiledir)

# Check common programs
AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_PROG_LN_S

# Check for the required programs
ROOT_PATH=[$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin]dnl
Expand Down
7 changes: 6 additions & 1 deletion create
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ $GUIX --version
# The 'gnt-instance' tool does not like being passed text that can
# be mistaken for commands, so gibberize it through base64.
# TODO: Support plain text for API users.
echo "${OSP_CONFIG}" | base64 -di > $CONFIG_FILE
if [ -n "$OSP_CONFIG" ]; then
echo "${OSP_CONFIG}" | base64 -di > $CONFIG_FILE
else
# If no configuration file was provided, use a default one.
cp -L $DEFAULT_CONFIG $CONFIG_FILE
fi

if [ -b $TARGET_DEVICE ]; then
DEVICE_SIZE=$($BLOCKDEV --getsize64 $TARGET_DEVICE)
Expand Down
9 changes: 0 additions & 9 deletions verify
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@

set -e

case "${OSP_CONFIG}" in
"")
echo "Configuration file is required."
exit 1
;;
*)
;;
esac

case "${OSP_COMMIT}" in
"")
;;
Expand Down

0 comments on commit cb926f3

Please sign in to comment.