Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

scripts/adminHelper.sh does not work on RHEL 6.5 #35

Closed
jtrutwin-zz opened this issue May 28, 2014 · 17 comments
Closed

scripts/adminHelper.sh does not work on RHEL 6.5 #35

jtrutwin-zz opened this issue May 28, 2014 · 17 comments

Comments

@jtrutwin-zz
Copy link

The OS detection for this script is flawed:

if [ -f "/usr/bin/lsb_release" ]; then

ubuntuVersion=lsb_release -s -d

case $ubuntuVersion in
Ubuntu\ 12.04)
detectedOS="Ubuntu"
;;
Ubuntu\ 10.04)
detectedOS="Ubuntu"
;;
esac

elif [ -f "/etc/system-release" ]; then

I have a RHEL 6.5 box which also has /usr/bin/lsb_release as part of the redhat-lsb-core package, so I never get to the elif in this code block and detectedOS is left blank.

There is a fix already for this in base/testOSRequirements.sh but it hasn't been applied here. I'm not sure how people are even using NetSUS 3.0 on a RHEL box with this bug?

I worked around this by manually setting detectedOS in this adminHelper.sh but I'm wondering if there are other places where this OS detection isn't working?

Josh

@loisfredrickson
Copy link

I've seen the same issue.
This is what I'm using for a work around:

In /var/www/html/webadmin/scripts
cp adminHelper.sh adminHelper.ORG
nano or vi adminHelper.sh
At the beginning of the file add
umask 0000
At the end of the file add
umask 0022
chmod 644 /etc/dhcpd.conf

@macmule
Copy link
Member

macmule commented Jan 26, 2015

Couldn't the below if statements from the adminHelper.sh be swapped around?

if [ -f "/usr/bin/lsb_release" ]; then

ubuntuVersion=lsb_release -s -d

case $ubuntuVersion in
Ubuntu\ 14.04)
detectedOS="Ubuntu"
;;
Ubuntu\ 12.04)
detectedOS="Ubuntu"
;;
Ubuntu\ 10.04)
detectedOS="Ubuntu"
;;
esac

elif [ -f "/etc/system-release" ]; then

case "$(readlink /etc/system-release)" in
"centos-release")
detectedOS="CentOS"
;;
"redhat-release")
detectedOS="RedHat"
;;
esac

else
echo "Error detecting OS"
fi

@jtrutwin-zz
Copy link
Author

Just installed 3.0.2 on RHEL 6.6 - still an issue

cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.6 (Santiago)

/usr/bin/lsb_release -s -d
"Red Hat Enterprise Linux Server release 6.6 (Santiago)"

The if statement in line 5 of adminHelper.sh causes $detectedOS to be empty for my system...

Josh

@andyincali
Copy link

You can work around this issue like so:

cd /etc
touch centos-release
ln -sf centos-release system-release

Then, perform the installation. When finished, restore the original config:

cd /etc
ln -sf redhat-release system-release
rm centos-release

@jtrutwin-zz
Copy link
Author

jtrutwin-zz commented Jul 20, 2016

Two plus years and this is STILL an issue - I just had to manually fix adminHelper.sh again for a RHEL 6.8 server.

rpm -qf /usr/bin/lsb_release

redhat-lsb-core-4.0-7.el6.x86_64

And andy's fix above doesn't matter because the script still tests for the existence of /usr/bin/lsb_release to assume it's a Ubuntu system.

I either have to manually remove redhat-lsb-core from my server (which is installed by default) or hack this adminHelper.sh to just hardcode the detectedOS...

@manicslothpdx
Copy link

If I am reading this correctly, a possible solution is to take the top section of the base/testOSRequirements.sh script and copy/paste that into the existing adminHelper.sh? And, this would be the adminHelper.sh in /var/www/html/webadmin/scripts and not /var/www/html/scripts, correct?

@jtrutwin-zz
Copy link
Author

I'm not sure what the best solution for this is, I'm sure there's a decent way to detect between RHEL, CentOS and Ubuntu...

Until there's a solution posted by JAMF I just set:

detectedOS="RedHat"

after all the logic on top. and have to remember to do that when I upgrade. i only have one location for adminHelper.sh on my system - it's in /var/www/html/webadmin/scripts/

@manicslothpdx
Copy link

It does not appear that setting the variable to RedHat makes any difference. The scripts are running, they just don't appear to be able to save the results.

@jtrutwin-zz
Copy link
Author

Line 35 - right after the "fi" and before the "case $1 in"

@jtrutwin-zz
Copy link
Author

You said you had selinux disabled? I'd also check /var/log/httpd/ error logs. I recall having to make a permission change as well. I think it was chown apache /var/www/appliance maybe

@manicslothpdx
Copy link

I take that back. I had modified the adminHelper.sh in a different way and I guess I didn't do it right the first time. By doing the exact step above "Line 35 - right after the "fi" and before the "case $1 in" and then restarting httpd, the issue appears to be resolved.

@jtrutwin-zz
Copy link
Author

glad to hear it!

@manicslothpdx
Copy link

One thing that still doesn't work is enabling the LDAP configuration. On the Ubuntu test appliance, it works fine but with the exact same settings on my RHEL VM, it doesn't do anything.

@manicslothpdx
Copy link

Otherwise, it looks like i can save everything else which means, for us, it's 95% functional.

@manicslothpdx
Copy link

As far as the LDAP proxy, I can save the settings, I just can't enable the LDAP proxy.

@jtrutwin-zz
Copy link
Author

Sorry can't help there, don't use it. Might want to create a new ticket or update your existing other one...

@macmule
Copy link
Member

macmule commented Nov 9, 2017

Hi folks,

The current (4.2.1) adminHelper.sh (https://github.com/jamf/NetSUS/blob/master/webadmin/var/www/webadmin/scripts/adminHelper.sh) looks quite different, so either this commit or another that was subsequent to this issue look to have fixed this.

As such, I'll close this off for now.

@macmule macmule closed this as completed Nov 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants