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

install.sh: Add remote install support #1996

Closed
wants to merge 2 commits into from
Closed

Conversation

nhooyr
Copy link
Contributor

@nhooyr nhooyr commented Aug 25, 2020

Closes coder/sshcode#185, #1996, and pretty much archives that repository.

See also #1991

@nhooyr nhooyr requested a review from code-asher August 25, 2020 19:04
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave this a few test runs and it's working great!

install.sh Outdated
@@ -303,7 +311,7 @@ install_aur() {
sh_c mkdir -p "$CACHE_DIR/code-server-aur"
sh_c "curl -#fsSL https://aur.archlinux.org/cgit/aur.git/snapshot/code-server.tar.gz | tar -xzC $CACHE_DIR/code-server-aur --strip-components 1"
echo "+ cd $CACHE_DIR/code-server-aur"
if [ ! "${DRY_RUN-}" ]; then
if sh_f [ ! "${DRY_RUN-}" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sh_f isn't needed here I think since DRY_RUN is a local flag.

install.sh Outdated
@@ -319,11 +327,11 @@ install_standalone() {
"$CACHE_DIR/code-server-$VERSION-$OS-$ARCH.tar.gz"

sh_c="sh_c"
if [ ! -w "$STANDALONE_INSTALL_PREFIX" ]; then
if sh-f [ ! -w "$STANDALONE_INSTALL_PREFIX" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if sh-f [ ! -w "$STANDALONE_INSTALL_PREFIX" ]; then
if sh_f [ ! -w "$STANDALONE_INSTALL_PREFIX" ]; then

-h | --h | -help | --help)
usage
exit 0
;;
*)
SSH_ARGS="$1"
;;
-*)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think -* needs to come before * since * will match everything.

install.sh Outdated

# Always runs.
sh_f() {
if [ "$SSH_ARGS" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be unbound here.

install.sh Outdated
humanpath() {
sed "s# $HOME# ~#g; s#\"$HOME#\"\$HOME#g"
sed "s# $RHOME# ~#g; s#\"$RHOME#\"\$RHOME#g"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use HOME (or ~) for the literal instead of RHOME? In the standalone case it'll output instructions that won't work as-is:

Please extend your path to use code-server:
  PATH="$RHOME/.local/bin:$PATH"
Then you can run:
  code-server

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~ is not supported in early init scripts before the shell started. $HOME is preferred.

@nhooyr
Copy link
Contributor Author

nhooyr commented Aug 26, 2020

Yea I think I'ma update all the docs/messages when installing remotely and modify fetch to fetch locally and then copy over ssh so that it works in closed off environments.

@nhooyr nhooyr force-pushed the remote-install-0e27 branch 5 times, most recently from 7b3b988 to bcf032e Compare August 28, 2020 20:09
install.sh Show resolved Hide resolved
install.sh Outdated
# Always runs.
sh_f() {
if [ "$SSH_ARGS" ]; then
mkdir -p ~/.ssh/sockets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ~/.ssh directory requires to have 700 for openssh to accept it. It should probably be chmoded to that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@code-asher code-asher removed this from the v3.5.1 milestone Sep 30, 2020
@nhooyr
Copy link
Contributor Author

nhooyr commented Oct 9, 2020

This got messy quickly, opening a follow up PR without --start and no support for hosts without internet which I think is fine for now.

@nhooyr nhooyr closed this Oct 9, 2020
@nhooyr nhooyr deleted the remote-install-0e27 branch October 21, 2020 21:21
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.

Hold on any future development
4 participants