Commit e2fa19d0 authored by Jeremy Frasier's avatar Jeremy Frasier Committed by cappuccinuo
Browse files

Modify rhel8-support.sh to handle Fedora as well, and rename it

I renamed the file to mangle-shebangs.sh, since it is no longer
specific to RHEL8.  I also changed Makefile to call mangle-shebangs.sh
instead of rhel8-support.sh
parent 43f98488
...@@ -45,9 +45,9 @@ specfile: clean ...@@ -45,9 +45,9 @@ specfile: clean
.PHONY: sources .PHONY: sources
sources: tarball specfile sources: tarball specfile
.PHONY: rhel8-support .PHONY: shebang-support
rhel8-support: shebang-support:
./rhel8-support.sh ./mangle-shebangs.sh
.PHONY: rpm-only .PHONY: rpm-only
rpm-only: rpm-only:
...@@ -58,7 +58,7 @@ rpm-only: ...@@ -58,7 +58,7 @@ rpm-only:
cp $(BUILD_DIR)/RPMS/*/*rpm build cp $(BUILD_DIR)/RPMS/*/*rpm build
.PHONY: rpm .PHONY: rpm
rpm: rhel8-support sources rpm-only rpm: shebang-support sources rpm-only
.PHONY: deb .PHONY: deb
deb: deb:
......
#!/bin/bash #!/bin/bash
SYSTEM_RELEASE_PATH=/etc/system-release SYSTEM_RELEASE_PATH=/etc/system-release
RHEL8_REGEX="Red Hat Enterprise Linux release 8"
FEDORA_REGEX="Fedora release"
if [ -f $SYSTEM_RELEASE_PATH ] && [[ "$(cat $SYSTEM_RELEASE_PATH)" =~ "Red Hat Enterprise Linux release 8" ]]; then # RHEL8 and Fedora30+ both treat shebangs of the form "#!/usr/bin/env python" as errors
# Replace the first line in .py to "#!/usr/bin/env python2" no matter what it was before if [ -f $SYSTEM_RELEASE_PATH ] && [[ "$(cat $SYSTEM_RELEASE_PATH)" =~ $RHEL8_REGEX|$FEDORA_REGEX ]]; then
# Replace the first line in .py to "#!/usr/bin/env python2" no
# matter what it was before
sed -i -e '1 s/^.*$/\#!\/usr\/bin\/env python2/' src/watchdog/__init__.py sed -i -e '1 s/^.*$/\#!\/usr\/bin\/env python2/' src/watchdog/__init__.py
sed -i -e '1 s/^.*$/\#!\/usr\/bin\/env python2/' src/mount_efs/__init__.py sed -i -e '1 s/^.*$/\#!\/usr\/bin\/env python2/' src/mount_efs/__init__.py
fi fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment