summaryrefslogtreecommitdiffstats
path: root/encap/bcfg2-0.8.2.ep
diff options
context:
space:
mode:
Diffstat (limited to 'encap/bcfg2-0.8.2.ep')
-rw-r--r--encap/bcfg2-0.8.2.ep83
1 files changed, 60 insertions, 23 deletions
diff --git a/encap/bcfg2-0.8.2.ep b/encap/bcfg2-0.8.2.ep
index 09208eccf..37e94d692 100644
--- a/encap/bcfg2-0.8.2.ep
+++ b/encap/bcfg2-0.8.2.ep
@@ -77,25 +77,51 @@ url="http://www.pobox.com/users/dclark/mirror/bcfg/bcfg2-0.8.2.tar.gz
</source>
<prepackage type="set"><![CDATA[
-mkdir bin 2>/dev/null || exit 0
-ln -sf ../lib/bcfg2/bin/GenerateHostInfo bin/GenerateHostInfo
-ln -sf ../lib/bcfg2/bin/GenerateHostInfo bin/b2GenerateHostInfo
-ln -sf ../lib/bcfg2/bin/StatReports bin/StatReports
-ln -sf ../lib/bcfg2/bin/StatReports bin/b2StatReports
-ln -sf ../lib/bcfg2/bin/bcfg2 bin/
-ln -sf ../lib/bcfg2/bin/bcfg2-info bin/
-ln -sf ../lib/bcfg2/bin/bcfg2-repo-validate bin/
-ln -sf ../lib/bcfg2/bin/bcfg2-server bin/
-mkdir share 2>/dev/null || exit 0
-mkdir share/bcfg2 2>/dev/null || exit 0
-(cp ${builddir}/doc/manual.pdf share/bcfg2/ || true)
-cp -r ${builddir}/examples share/bcfg2/
-mkdir var 2>/dev/null || exit 0
-mkdir var/encap 2>/dev/null || exit 0
+# Make binaries available from /usr/local/bin
+mkdir bin 2>/dev/null || exit 1
+for FILE in `ls lib/bcfg2/bin`; do \
+ ln -sf ../lib/bcfg2/bin/${FILE} bin/${FILE}; \
+ if [ ! "`printf "${FILE}" | cut -c 1-5`x" = "bcfg2x" ]; then \
+ ln -sf ../lib/bcfg2/bin/${FILE} bin/b2-${FILE}; \
+ fi; \
+done
+# Make doc available from /usr/local/share/doc/bcfg2
+mkdir share 2>/dev/null || exit 1
+mkdir share/doc 2>/dev/null || exit 1
+mkdir share/doc/bcfg2 2>/dev/null || exit 1
+(cp ${builddir}/doc/manual.pdf share/doc/bcfg2/ || true)
+cp -r ${builddir}/examples share/doc/bcfg2/
+# Make man pages available from /usr/local/man
+mv lib/bcfg2/share/man .
+# Make tools dirs and copy over tools
+mkdir lib/bcfg2/tools || exit 1
+cp ${builddir}/tools/* lib/bcfg2/tools/
+mkdir sbin 2>/dev/null || exit 1
+mkdir share/doc/bcfg2/tools 2>/dev/null || exit 1
+# Makes tools with #! line executable
+for FILE in `ls lib/bcfg2/tools`; do \
+ F="lib/bcfg2/tools/${FILE}"; \
+ if [ "`head -1 ${F} | grep ^#\!/`x" != "x" ]; then \
+ chmod 755 ${F} ; \
+ fi; \
+done
+# Make executable tools available from /usr/local/sbin, and nonexecutable
+# tools/tools doc available from /usr/local/share/doc/bcfg2/tools
+for FILE in `ls lib/bcfg2/tools`; do \
+ F="lib/bcfg2/tools/${FILE}"; \
+ if [ -x ${F} ]; then \
+ ln -sf ../lib/bcfg2/tools/${FILE} sbin/b2-example-tool-${FILE}; \
+ else \
+ ln -sf ../../../../lib/bcfg2/tools/${FILE} share/doc/bcfg2/tools/${FILE}; \
+ fi; \
+done
+# Make "this encap is installed" sentinal file available in /usr/local/var/encap
+mkdir var 2>/dev/null || exit 1
+mkdir var/encap 2>/dev/null || exit 1
touch var/encap/${ENCAP_PKGNAME}
]]></prepackage>
-<include_file name="b2regexplace.py" mode="0755"><![CDATA[
+<include_file name="b2-regexplace.py" mode="0755"><![CDATA[
#!/usr/local/lib/bcfg2/bin/python
# regexplace: regular expression search and replace
@@ -127,7 +153,7 @@ def make_files_list(dir, regx):
# don't include symbolic links
for root, dirs, files in os.walk(dir):
for name in files:
- if cregex.search(name) and name not in ("b2regexplace.sh", "b2regexplace.py", "postinstall", "postinstall.log", "bcfg2-0.8.2.ep"):
+ if cregex.search(name) and name not in ("b2-regexplace.sh", "b2-regexplace.py", "postinstall", "postinstall.log", "bcfg2-0.8.2.ep"):
path = os.path.join(root, name)
if not os.path.islink(path):
fileslist.append(path)
@@ -217,14 +243,14 @@ if __name__ == '__main__':
main()
]]></include_file>
-<include_file name="b2regexplace.sh" mode="0755"><![CDATA[
+<include_file name="b2-regexplace.sh" mode="0755"><![CDATA[
#!/bin/sh
# This fixes paths for the bcfg2 encap packaging.
# Do not run more than once; it does not converge.
BASEDIR="`echo ${0} | xargs -n1 dirname`"
-REGEXPLACE="${BASEDIR}/b2regexplace.py"
+REGEXPLACE="${BASEDIR}/b2-regexplace.py"
PYTHON="/usr/local/lib/bcfg2/bin/python"
BINARIES="${REGEXPLACE} ${PYTHON}"
COMPILEALL="/usr/local/lib/bcfg2/lib/python2.4/compileall.py"
@@ -261,8 +287,19 @@ ${REGEXPLACE} ${BASEDIR} .\* \/usr\/share\/bcfg2\/ \/usr\/local\/lib\/bcfg2\/sha
printf "\nReplacing \"prefix = '/usr'\" with \"prefix = '/usr/local/lib/bcfg2'\"...\n"
${REGEXPLACE} ${BASEDIR} .\* prefix\ =\ \'\/usr\' prefix\ =\ \'/usr/local/lib/bcfg2\'
-printf "\nReplacing \"xmllint\" with \"/usr/local/bin/b2xmllint\"...\n"
-${REGEXPLACE} ${BASEDIR} .\* xmllint \/usr\/local\/bin\/b2xmllint
+printf "\nReplacing \"xmllint\" with \"/usr/local/bin/b2-xmllint\"...\n"
+${REGEXPLACE} ${BASEDIR} .\* xmllint \/usr\/local\/bin\/b2-xmllint
+
+printf "\nReplacing \"#!/usr/bin/env python\" with "
+printf "\"#!/usr/local/lib/bcfg2/bin/python\"...\n"
+${REGEXPLACE} ${BASEDIR} .\* \#\!\/usr\/bin\/env\ python \#\!\/usr\/local\/lib\/bcfg2\/bin\/python
+
+printf "\nReplacing \"#!/usr/bin/perl\" with \"#!/usr/bin/env perl\"...\n"
+${REGEXPLACE} ${BASEDIR} .\* \#\!\/usr\/bin\/perl \#\!\/usr\/bin\/env\ perl
+
+printf "\nReplacing \"#!/usr/bin/python\" with "
+printf "\"#!/usr/local/lib/bcfg2/bin/python\"...\n"
+${REGEXPLACE} ${BASEDIR} .\* \#\!\/usr\/bin\/python \#\!\/usr\/local\/lib\/bcfg2\/bin\/python
printf "\nCreating bcfg2 .pyc files...\n"
${PYTHON} ${COMPILEALL} ${BASEDIR}
@@ -273,8 +310,8 @@ exit 0
<include_file name="postinstall" mode="0755"><![CDATA[
#!/bin/sh
BASEDIR="`echo ${0} | xargs -n1 dirname`"
-test -x ${BASEDIR}/b2regexplace.sh || exit 1
-${BASEDIR}/b2regexplace.sh > ${BASEDIR}/postinstall.log 2>&1 3>&1
+test -x ${BASEDIR}/b2-regexplace.sh || exit 1
+${BASEDIR}/b2-regexplace.sh > ${BASEDIR}/postinstall.log 2>&1 3>&1
]]></include_file>