| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fa96dee commit 61a414f
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -596,6 +596,7 @@ fi | |||
| 596 | 596 | %{_sysconfdir}/%{name}/management/components-premium.xml | |
| 597 | 597 | %{_datadir}/%{name}/setup/create-database-premium.sql | |
| 598 | 598 | %{_datadir}/%{name}/setup/create-schema-premium.sql | |
| 599 | + %{_libdir}/%{name}/agent/vms/premium-systemvm.zip | ||
| 599 | 600 | ||
| 600 | 601 | %files usage | |
| 601 | 602 | %defattr(0644,root,root,0775) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,3 +6,4 @@ | |||
| 6 | 6 | /usr/share/cloud/setup/create-database-premium.sql | |
| 7 | 7 | /usr/share/cloud/setup/create-schema-premium.sql | |
| 8 | 8 | /usr/lib/cloud/agent/premium-scripts/* | |
| 9 | + /usr/lib/cloud/agent/vms/premium-systemvm.zip | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,54 @@ | |||
| 1 | + #!/bin/bash | ||
| 2 | + # Copies premium stuff to systemvm.iso | ||
| 3 | + | ||
| 4 | + #set -x | ||
| 5 | + | ||
| 6 | + TMP=${HOME}/tmp | ||
| 7 | + MOUNTPATH=/mnt/cloud/systemvm | ||
| 8 | + TMPDIR=${TMP}/cloud/systemvm | ||
| 9 | + ISOPATH=`dirname $0`/../../../vms/systemvm.iso | ||
| 10 | + STUFFPATH=`dirname $0`/../../../vms/premium-systemvm.zip | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + clean_up() { | ||
| 15 | + sudo umount $MOUNTPATH | ||
| 16 | + rm -rf $TMPDIR | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + inject_into_iso() { | ||
| 20 | + local isofile=${ISOPATH} | ||
| 21 | + local backup=${isofile}.bak | ||
| 22 | + local tmpiso=${TMP}/$1 | ||
| 23 | + [ ! -f $isofile ] && echo "$(basename $0): Could not find systemvm iso patch file $isofile" && return 1 | ||
| 24 | + sudo mount -o loop $isofile $MOUNTPATH | ||
| 25 | + [ $? -ne 0 ] && echo "$(basename $0): Failed to mount original iso $isofile" && clean_up && return 1 | ||
| 26 | + sudo cp -b $isofile $backup | ||
| 27 | + [ $? -ne 0 ] && echo "$(basename $0): Failed to backup original iso $isofile" && clean_up && return 1 | ||
| 28 | + rm -rf $TMPDIR | ||
| 29 | + mkdir -p $TMPDIR | ||
| 30 | + [ ! -d $TMPDIR ] && echo "$(basename $0): Could not find/create temporary dir $TMPDIR" && clean_up && return 1 | ||
| 31 | + sudo cp -fr $MOUNTPATH/* $TMPDIR/ | ||
| 32 | + [ $? -ne 0 ] && echo "$(basename $0): Failed to copy from original iso $isofile" && clean_up && return 1 | ||
| 33 | + sudo cp -f $STUFFPATH $TMPDIR/systemvm.zip | ||
| 34 | + [ $? -ne 0 ] && echo "$(basename $0): Failed to copy sutff $STUFFPATH from to new iso " && clean_up && return 1 | ||
| 35 | + mkisofs -quiet -r -o $tmpiso $TMPDIR | ||
| 36 | + [ $? -ne 0 ] && echo "$(basename $0): Failed to create new iso $tmpiso from $TMPDIR" && clean_up && return 1 | ||
| 37 | + sudo umount $MOUNTPATH | ||
| 38 | + [ $? -ne 0 ] && echo "$(basename $0): Failed to unmount old iso from $MOUNTPATH" && return 1 | ||
| 39 | + sudo cp -f $tmpiso $isofile | ||
| 40 | + [ $? -ne 0 ] && echo "$(basename $0): Failed to overwrite old iso $isofile with $tmpiso" && return 1 | ||
| 41 | + rm -rf $TMPDIR | ||
| 42 | + return $? | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + sudo mkdir -p $MOUNTPATH | ||
| 46 | + | ||
| 47 | + [ ! -f $STUFFPATH ] && echo "$(basename $0): Could not find $STUFFPATH" && exit 3 | ||
| 48 | + command -v mkisofs > /dev/null || (echo "$(basename $0): mkisofs not found, please install or ensure PATH is accurate" ; exit 4) | ||
| 49 | + | ||
| 50 | + inject_into_iso systemvm.iso | ||
| 51 | + | ||
| 52 | + [ $? -ne 0 ] && exit 5 | ||
| 53 | + | ||
| 54 | + exit 0 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -123,6 +123,29 @@ public ConfigurationServerImpl() { | |||
| 123 | 123 | _ipAddressDao = locator.getDao(IPAddressDao.class); | |
| 124 | 124 | } | |
| 125 | 125 | ||
| 126 | + private void updatePremiumStuff() { | ||
| 127 | + if (!_configDao.isPremium()) { | ||
| 128 | + return; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + String injectScript = "scripts/vm/systemvm/inject_premium_stuff.sh"; | ||
| 132 | + String scriptPath = Script.findScript("", injectScript); | ||
| 133 | + if (scriptPath == null) { | ||
| 134 | + throw new CloudRuntimeException("Unable to find key inject script " | ||
| 135 | + + injectScript); | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + final Script command = new Script(scriptPath, s_logger); | ||
| 139 | + final String result = command.execute(); | ||
| 140 | + if (result != null) { | ||
| 141 | + s_logger.warn("Failed to inject premium stuff into systemvm iso " | ||
| 142 | + + result); | ||
| 143 | + throw new CloudRuntimeException( | ||
| 144 | + "Failed to inject premium stuff into systemvm iso " | ||
| 145 | + + result); | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + | ||
| 126 | 149 | @Override @DB | |
| 127 | 150 | public void persistDefaultValues() throws InvalidParameterValueException, InternalErrorException { | |
| 128 | 151 | ||
@@ -243,6 +266,8 @@ public void persistDefaultValues() throws InvalidParameterValueException, Intern | |||
| 243 | 266 | } | |
| 244 | 267 | } | |
| 245 | 268 | ||
| 269 | + updatePremiumStuff(); | ||
| 270 | + | ||
| 246 | 271 | // store the public and private keys in the database | |
| 247 | 272 | updateKeyPairs(); | |
| 248 | 273 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -158,6 +158,8 @@ def build_systemvm_patch (): | |||
| 158 | 158 | bld.install_files ("${AGENTLIBDIR}/vms", "%s/systemvm.zip" % distdir) | |
| 159 | 159 | # ISO creation | |
| 160 | 160 | bld.install_as("${AGENTLIBDIR}/vms/systemvm.iso", "%s/systemvm.iso" % distdir) | |
| 161 | + if buildpremium: | ||
| 162 | + bld.install_as("${AGENTLIBDIR}/vms/premium-systemvm.zip", "%s/premium-systemvm.zip" % distdir) | ||
| 161 | 163 | ||
| 162 | 164 | def build_systemvm_iso (): | |
| 163 | 165 | if buildpremium: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments