Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessarily using sudo when logging as root #1331

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tanducmai
Copy link

No description provided.

@amark
Copy link
Owner

amark commented Jun 1, 2023

Will merge - tho willing to help me out? Is there a way to get this script to work in non-root shells? I don't want to assume I am/only root.

@draeder
Copy link
Contributor

draeder commented Jun 1, 2023

#debian/ubuntu
if [ $(id -u) -ne 0 ]; then
    SUDO='sudo'
else
    SUDO=''
fi

${SUDO} apt-get install sudo -y
${SUDO} apt-get update -y
${SUDO} apt-get install curl git git-core screen -y

#fedora/openSUSE
${SUDO} yum check-update -y
${SUDO} yum install curl git git-core screen -y

@tanducmai
Copy link
Author

Will merge - tho willing to help me out? Is there a way to get this script to work in non-root shells? I don't want to assume I am/only root.

Does the commit 67aad7e solve your problem? @amark

@amark
Copy link
Owner

amark commented Jul 19, 2023

Oh forgot about this. I need to test it against the various hosts but haven't had time. I'm really really really really dumb when it comes to CLI so I'm scared about stuff. I've gotten GUN to run on $0.83/mo shared hosts. However, some more expensive ones (not listed) $2/mo it won't let me install node or yum/apt-get, I'm not root, if I try to install NodeJS from scratch/make (not prebuilt) it takes hours & the hosts kills it. I think that machine/host I need to give up on, but I am trying to get it to work with most any shared/cpanel/would-be-PHP type hosts. Are the sudos necessary there? Or is apt-get/yum disallowed no matter what? Or?

@mblaney
Copy link
Contributor

mblaney commented Aug 8, 2023

It might be worth rethinking this, the README section in install.sh says: "Copy paste and run each line into your terminal.", and this change makes that a bit more complicated.

Maybe just a section before each os to simplify it?

# Log in as root if you need to install sudo
su -
apt-get install sudo -y
logout

@amark
Copy link
Owner

amark commented Aug 12, 2023

In README tho, most users are Mac/Windows no? apt-get doesn't work either those places.

@mblaney
Copy link
Contributor

mblaney commented Aug 25, 2023

yeah the README section mentions what to do on Windows though, so this is specifically aimed at Linux? I missed that you want people to be able to run this via curl -o- https://raw.githubusercontent.com/amark/gun/master/examples/install.sh | bash, it's probably safe to assume sudo is already installed so removing these two lines makes sense:

su -
apt-get install sudo -y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants