Skip to content

Commit

Permalink
Merge pull request #55 from Adaptavist/feature/amazon_linux
Browse files Browse the repository at this point in the history
Feature/amazon linux
  • Loading branch information
acerezoi authored Apr 7, 2022
2 parents 1e989b9 + e2a1b4b commit 727cd14
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function build-package () {
if [[ ${pkg} == deb ]]; then
ADDITIONAL_DEPS="-d augeas-tools -d dos2unix"
else
ADDITIONAL_DEPS="-d ruby-augeas -d dos2unix"
ADDITIONAL_DEPS="-d augeas -d dos2unix"
fi
fpm \
-s dir \
Expand Down
2 changes: 2 additions & 0 deletions share/avst-app/lib/common/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ parse_installed_avst_app_version () {
INIT_HOME="${INIT_HOME:-/etc}"
if [[ -f "${INIT_HOME}/redhat-release" ]]; then
INSTALLED_AVSTAPP_CMD='rpm -qi avst-app'
elif [[ -f "${INIT_HOME}/os-release" ]] && [[ $(grep 'Amazon Linux' /etc/os-release) ]]; then
INSTALLED_AVSTAPP_CMD='rpm -qi avst-app'
elif [[ -f "${INIT_HOME}/debian_version" ]]; then
INSTALLED_AVSTAPP_CMD='dpkg -s avst-app'
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ SYSTEMD_FILE='systemd.service'

if [[ -f "${INIT_HOME}/redhat-release" ]]; then
UPSTART_FILE='upstart-redhat.conf'
elif [[ -f "${INIT_HOME}/os-release" ]] && [[ $(grep 'Amazon Linux' /etc/os-release) ]]; then
UPSTART_FILE='upstart-redhat.conf'
elif [[ -f "${INIT_HOME}/debian_version" ]]; then
UPSTART_FILE='upstart-debian.conf'
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ else
[[ -L "${INIT_HOME}/init.d/${INSTANCE_NAME}" ]] && rm -f "${INIT_HOME}/init.d/${INSTANCE_NAME}"
echo 'initctl $1 $( basename $0 )' > "${INIT_HOME}/init.d/${INSTANCE_NAME}"
chmod 755 "${INIT_HOME}/init.d/${INSTANCE_NAME}"
elif [[ -f "${INIT_HOME}/os-release" ]] && [[ $(grep 'Amazon Linux' /etc/os-release) ]]; then
debug "Upstart files for Amazon Linux"
[[ -L "${INIT_HOME}/init.d/${INSTANCE_NAME}" ]] && rm -f "${INIT_HOME}/init.d/${INSTANCE_NAME}"
echo 'initctl $1 $( basename $0 )' > "${INIT_HOME}/init.d/${INSTANCE_NAME}"
chmod 755 "${INIT_HOME}/init.d/${INSTANCE_NAME}"
elif [[ -f "${INIT_HOME}/debian_version" ]]; then
debug "Upstart files for Debian"
(
Expand Down
2 changes: 2 additions & 0 deletions share/avst-app/lib/common/modify.d/96manual_service
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ else
# if a RHEL based system use a second start on stanza as "manual" is not valid
if [[ -f /etc/redhat-release ]]; then
START_DIRECTIVE="start on never"
elif [[ -f "${INIT_HOME}/os-release" ]] && [[ $(grep 'Amazon Linux' /etc/os-release) ]]; then
START_DIRECTIVE="start on never"
else
START_DIRECTIVE="manual"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ SYSTEMD_HOME="${SYSTEMD_HOME:-/etc/systemd/system/}"
SYSTEMD_FILE='sonarqube-systemd.service'
if [[ -f "${INIT_HOME}/redhat-release" ]]; then
UPSTART_FILE='upstart-redhat.conf'
elif [[ -f "${INIT_HOME}/os-release" ]] && [[ $(grep 'Amazon Linux' /etc/os-release) ]]; then
UPSTART_FILE='upstart-redhat.conf'
elif [[ -f "${INIT_HOME}/debian_version" ]]; then
UPSTART_FILE='upstart-debian.conf'
else
Expand Down
4 changes: 3 additions & 1 deletion share/avst-app/lib/tomcat/start.d/99set_oom_on_redhat
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
# limitations under the License.

# Try hard not to be killed in Out-Of-Memory situations on RedHat,
# Ubuntu supports this setting inside .conf file
# or Amazon Linux, Ubuntu supports this setting inside .conf file
if [[ -f '/etc/redhat-release' ]]; then
pgrep -f "${INSTANCE_NAME}" | while read PID; do echo -17 > /proc/$PID/oom_adj; done
elif [[ -f "${INIT_HOME}/os-release" ]] && [[ $(grep 'Amazon Linux' /etc/os-release) ]]; then
pgrep -f "${INSTANCE_NAME}" | while read PID; do echo -17 > /proc/$PID/oom_adj; done
fi

0 comments on commit 727cd14

Please sign in to comment.