-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add install helper scripts #1459
Conversation
Alternatively, I agree that |
I would be in favour of a brew package but the reason for the |
I'm in the middle on this. There seems to be a good amount of value in easily spinning up code-server without effort. If we did something like |
Also-- it'd be nice to have it independent of node and npm, which is easy considering it's already packaged with its compatible node runtime. The ability to install code-server on a bare ubuntu vm seems useful. |
I think most would just use |
@cmoog we don't need a separate Mac/linux script, we can easily detect in a single script. |
As kyle suggested, we'd probably want to add a proxy for |
install_helper.sh
Outdated
} | ||
|
||
linux_install() { | ||
bin_path=$HOME/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be installing it in ~/bin. It should be going into /usr/local/bin
. Or just the current directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking it'd be nice to not require sudo
perms... although requiring sudo
seems better than installing everything into the current dir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also use /opt which does not require sudo iirc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to create a new hidden dir ~/.code-server
and put everything there. Then we could either tell the user to add it to their path or just do it ourselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets do whatever fzf does.
Also, not sure if we should be using wget or curl. |
install_helper.sh
Outdated
bin_path=$HOME/bin | ||
lib_path=$HOME/lib | ||
bin_path=$HOME/.local/bin | ||
lib_path=$HOME/.local/lib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use ~/.local/share here instead as it's the XDG_DATA_HOME directory.
grep '"browser_download_url":\|"tag_name":' | ||
} | ||
|
||
linux_install() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mac and linux install functions are pretty much duplicates. Let's have a single one that uses the values of bin_path and lib_path to install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The subtle differences make me think it'll be error-prone if we mix the logic. .tar
vs a .zip
, the backup for mac, the release URL itself, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can easily check for the extension and what command to use to extract.
I think we shouldn't worry about Mac. A home-brew formula is pretty simple and will be a much better option. Linux's 100 package systems is our only problem. Let's remove the Mac install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed 👍
install_helper.sh
Outdated
|
||
set -euo pipefail | ||
|
||
RED=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put this into a function instead of a variable just so you don't have to remember tput setaf
everywhere else.
install_helper.sh
Outdated
DETECTED_PROFILE="$(detect_profile)" | ||
SOURCE_STR="\nexport PATH=\"\$HOME/.code-server/bin:\$PATH\"\n" | ||
|
||
if [ -z "${DETECTED_PROFIL}" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be DETECTED_PROFILE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! Nice catch.
|
||
get_releases() { | ||
curl --silent "https://api.github.com/repos/cdr/code-server/releases/latest" | | ||
grep '"browser_download_url":\|"tag_name":' | ||
} | ||
|
||
bin_dir=$HOME/.code-server/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the switch back to ~/.code-server
over the XDG directories.
Closes #1396
I'm in agreement that a simple one-line install command would greatly improve the user experience of getting started. A transparent bash script seems better than depending on npm for the reasons stated in the issue.