Skip to content

Commit 5eb6a01

Browse files
committed
packages: added support for Rocky Linux to install script
While here, package builders were adjusted to include correct version build when auto-increment feature is used. Closes #77, #82.
1 parent 3df258e commit 5eb6a01

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

packages/install.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ get_os_name () {
4848
elif cat /etc/*-release | grep '^ID="almalinux"' > /dev/null 2>&1; then
4949
os="centos"
5050
centos_flavor="almalinux"
51+
elif cat /etc/*-release | grep '^ID="rocky"' > /dev/null 2>&1; then
52+
os="centos"
53+
centos_flavor="rocky"
5154
else
5255
os=`cat /etc/*-release | grep '^ID=' | \
5356
sed 's/^ID=["]*\([a-zA-Z]*\).*$/\1/' | \
@@ -79,11 +82,11 @@ get_os_name () {
7982
tr '[:upper:]' '[:lower:]'`
8083
;;
8184
centos)
82-
codename=`cat /etc/*-release | grep -i 'almalinux\|centos.*(' | \
85+
codename=`cat /etc/*-release | grep -i 'almalinux\|rocky\|centos.*(' | \
8386
sed 's/.*(\(.*\)).*/\1/' | head -1 | \
8487
tr '[:upper:]' '[:lower:]'`
8588
# For CentOS grab release
86-
release=`cat /etc/*-release | grep -i 'almalinux\|centos.*[0-9]' | \
89+
release=`cat /etc/*-release | grep -i 'almalinux\|rocky\|centos.*[0-9]' | \
8790
sed 's/^[^0-9]*\([0-9][0-9]*\).*$/\1/' | head -1`
8891
;;
8992
rhel|ol)

tools/builders/deb.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,19 @@ def build(bumprevision=False):
6464
changelog_first_line = 'nginx-amplify-agent (%s-%s~%s) %s; urgency=low' % (version, bld, codename, codename)
6565
change_first_line('%s/debian/changelog' % debuild_root, changelog_first_line)
6666

67+
if bumprevision:
68+
# sed version_build
69+
shell_call('sed -i.bak -e "s,self.version_build =.*,self.version_build = %d," amplify/agent/common/context.py' % bld)
70+
6771
# create source tarball
6872
shell_call('cp packages/nginx-amplify-agent/setup.py ./')
6973
shell_call('tar -cz --transform "s,^,nginx-amplify-agent-%s/," -f %s/nginx-amplify-agent_%s.orig.tar.gz LICENSE MANIFEST.in amplify/agent amplify/ext amplify/__init__.py etc/ packages/ nginx-amplify-agent.py setup.py' % (version, pkg_root, version))
7074
shell_call('cd %s && tar zxf nginx-amplify-agent_%s.orig.tar.gz' % (pkg_root, version))
7175

76+
if bumprevision:
77+
# restore original version_build
78+
shell_call('mv amplify/agent/common/context.py.bak amplify/agent/common/context.py')
79+
7280
# create deb package
7381
shell_call('cd %s && debuild -us -uc' % debuild_root, terminal=True)
7482

tools/builders/rpm.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,19 @@ def build(bumprevision=False):
4141
os.makedirs(rpm_specs)
4242
os.makedirs(rpm_sources)
4343

44+
if bumprevision:
45+
# sed version_build
46+
shell_call('sed -i.bak -e "s,self.version_build =.*,self.version_build = %d," amplify/agent/common/context.py' % bld)
47+
4448
# prepare sources
4549
shell_call('cp packages/nginx-amplify-agent/setup.py ./')
4650
shell_call('tar -cz --transform "s,^,nginx-amplify-agent-%s/," -f %s/nginx-amplify-agent-%s.tar.gz LICENSE MANIFEST.in amplify/agent amplify/ext amplify/__init__.py etc/ packages/ nginx-amplify-agent.py setup.py' % (version, rpm_sources, version))
4751
shell_call('cp packages/nginx-amplify-agent/rpm/nginx-amplify-agent.service %s' % rpm_sources)
4852

53+
if bumprevision:
54+
# restore original version_build
55+
shell_call('mv amplify/agent/common/context.py.bak amplify/agent/common/context.py')
56+
4957
# prepare spec
5058
shell_call('cp packages/nginx-amplify-agent/rpm/nginx-amplify-agent.spec %s/' % rpm_specs)
5159
shell_call('sed -e "s,%%%%AMPLIFY_AGENT_VERSION%%%%,%s,g" -e "s,%%%%AMPLIFY_AGENT_RELEASE%%%%,%s,g" -e "s,%%%%REQUIREMENTS%%%%,%s,g" -i %s/nginx-amplify-agent.spec' % (version, bld, get_requirements_for_distro(), rpm_specs))

0 commit comments

Comments
 (0)