Skip to content

Commit

Permalink
Merge pull request #668 from fsat/rpm-fixes-1.0.5-M2
Browse files Browse the repository at this point in the history
Fixes for RPM related functionality in 1.0.5-M2
  • Loading branch information
muuki88 committed Sep 11, 2015
2 parents 1305e89 + d3ae71f commit 1f946ac
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,12 @@ then
addUser ${{daemon_user}} "${{daemon_user_uid}}" ${{daemon_group}} "${{app_name}} user-daemon" "${{daemon_shell}}"
fi

[ -e /etc/sysconfig/${{app_name}} ] && sed -i 's/PACKAGE_PREFIX\=.*//g' /etc/sysconfig/${{app_name}}
[ -n "$RPM_INSTALL_PREFIX" ] && echo "PACKAGE_PREFIX=${RPM_INSTALL_PREFIX}" >> /etc/sysconfig/${{app_name}}
if [ -e /etc/sysconfig/${{app_name}} ] ;
then
sed -i 's/PACKAGE_PREFIX\=.*//g' /etc/sysconfig/${{app_name}}
fi

if [ -n "$RPM_INSTALL_PREFIX" ] ;
then
echo "PACKAGE_PREFIX=${RPM_INSTALL_PREFIX}" >> /etc/sysconfig/${{app_name}}
fi
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

INSTALL_DIR="${{chdir}}"
[ -n "${PACKAGE_PREFIX}" ] && INSTALL_DIR="${PACKAGE_PREFIX}/${{app_name}}"
cd $INSTALL_DIR

exec="$INSTALL_DIR/bin/${{exec}}"
prog="${{app_name}}"
Expand Down
17 changes: 15 additions & 2 deletions src/sbt-test/rpm/sysvinit-rpm/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ TaskKey[Unit]("unzipAndCheck") <<= (baseDirectory, packageBin in Rpm, streams) m
assert(scriptlets contains "deleteUser rpm-test", "deleteUser rpm not present in \n" + scriptlets)

val startupScript = IO.read(baseDir / "etc" / "init.d" / "rpm-test")
assert(startupScript contains
"""
|INSTALL_DIR="/usr/share/rpm-test"
|[ -n "${PACKAGE_PREFIX}" ] && INSTALL_DIR="${PACKAGE_PREFIX}/rpm-test"
|cd $INSTALL_DIR
|""".stripMargin, "Ensuring application is running on the install directory is not present in \n" + startupScript)
assert(startupScript contains """RUN_CMD="$exec >> /var/log/rpm-test/test.log 2>&1 &"""", "Setting key rpmDaemonLogFile not present in \n" + startupScript)

// TODO check symlinks
Expand All @@ -46,8 +52,15 @@ TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) =>
assert(spec contains "deleteUser rpm-test", "deleteUser rpm not present in \n" + spec)
assert(spec contains
"""
|[ -e /etc/sysconfig/rpm-test ] && sed -i 's/PACKAGE_PREFIX\=.*//g' /etc/sysconfig/rpm-test
|[ -n "$RPM_INSTALL_PREFIX" ] && echo "PACKAGE_PREFIX=${RPM_INSTALL_PREFIX}" >> /etc/sysconfig/rpm-test
|if [ -e /etc/sysconfig/rpm-test ] ;
|then
| sed -i 's/PACKAGE_PREFIX\=.*//g' /etc/sysconfig/rpm-test
|fi
|
|if [ -n "$RPM_INSTALL_PREFIX" ] ;
|then
| echo "PACKAGE_PREFIX=${RPM_INSTALL_PREFIX}" >> /etc/sysconfig/rpm-test
|fi
|""".stripMargin, "Persisting $RPM_INSTALL_PREFIX not present in \n" + spec)
()
}

0 comments on commit 1f946ac

Please sign in to comment.