From 094d9ba564c4832bc003fbdad47f6c8fd7fd98f7 Mon Sep 17 00:00:00 2001 From: Andrei Jiroh Eugenio Halili Date: Mon, 21 Feb 2022 14:59:40 +0000 Subject: [PATCH 1/5] Update gcloud Shell bashrcs Signed-off-by: Andrei Jiroh Eugenio Halili --- bashrc/google.bashrc | 6 +++--- bashrc/googlecloudshell.bashrc | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/bashrc/google.bashrc b/bashrc/google.bashrc index f14475b..3bcfae9 100644 --- a/bashrc/google.bashrc +++ b/bashrc/google.bashrc @@ -16,9 +16,9 @@ # Avoid sourcing bashrc.google more than once for a session as some of # the commands below are not reentrant. -if [[ -n "${GOOGLE_BASHRC_SOURCED}" ]]; then - return -fi +#if [[ -n "${GOOGLE_BASHRC_SOURCED}" ]]; then +# return +#fi GOOGLE_BASHRC_SOURCED=1 START_TIME=$(date +%s%3N) diff --git a/bashrc/googlecloudshell.bashrc b/bashrc/googlecloudshell.bashrc index e9b7b37..ebe4f68 100644 --- a/bashrc/googlecloudshell.bashrc +++ b/bashrc/googlecloudshell.bashrc @@ -4,10 +4,10 @@ # for examples # If not running interactively, don't do anything -case $- in - *i*) ;; - *) return;; -esac +#case $- in +# *i*) ;; +# *) return;; +#esac # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options @@ -110,9 +110,9 @@ fi export LD_LIBRARY_PATH=/usr/local/lib # After all of these, source my customized Google Cloud Shell bahsrc. -if [ -f "/google/devshell/bashrc.google" ]; then - source "$HOME/.dotfiles/bashrc/google.bashrc" -fi +#if [ -f "/google/devshell/bashrc.google" ]; then +# source "$HOME/.dotfiles/bashrc/google.bashrc" +#fi # Instead of using Google Cloud Shell's preinstalled nvm, I manually installed it on my home directory. export NVM_DIR="$HOME/.nvm" @@ -150,3 +150,4 @@ eval $(gpg-agent --daemon) >> /dev/null 2>&1 # We still need this, just in case gpg-agent is being a dick source $DOTFILES_STUFF_BIN/source-ssh-agent export GPG_TTY=$(tty) +eval "$(direnv hook bash)" \ No newline at end of file From adb88b1ffecc908be7f939a2ddaaf64339720769 Mon Sep 17 00:00:00 2001 From: Andrei Jiroh Halili Date: Tue, 22 Feb 2022 00:21:41 +0800 Subject: [PATCH 2/5] Add SSH debugging workflow for fun and profit --- .github/workflows/ssh-debugging.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/ssh-debugging.yml diff --git a/.github/workflows/ssh-debugging.yml b/.github/workflows/ssh-debugging.yml new file mode 100644 index 0000000..639bf3a --- /dev/null +++ b/.github/workflows/ssh-debugging.yml @@ -0,0 +1,14 @@ +name: SSH Debugging Session + +on: + workflow_dispatch + +jobs: + ssh-debugging-dispatcher: + steps: + - uses: actions/checkout@v2 + - name: Start SSH session + uses: luchihoratiu/debug-via-ssh@main + with: + NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} + SSH_PASS: ${{ secrets.SSH_PASS }} From 5e04ecc7ad6bf37b132a2c91b6cab6186a28eb88 Mon Sep 17 00:00:00 2001 From: Andrei Jiroh Halili Date: Tue, 22 Feb 2022 00:22:36 +0800 Subject: [PATCH 3/5] Add some fixes and stuff --- .github/workflows/ssh-debugging.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ssh-debugging.yml b/.github/workflows/ssh-debugging.yml index 639bf3a..92ab32b 100644 --- a/.github/workflows/ssh-debugging.yml +++ b/.github/workflows/ssh-debugging.yml @@ -1,10 +1,11 @@ name: SSH Debugging Session on: - workflow_dispatch + workflow_dispatch: jobs: ssh-debugging-dispatcher: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Start SSH session From f52ce609db56b57b204804ef49d84d51cfc25999 Mon Sep 17 00:00:00 2001 From: Andrei Jiroh Eugenio Halili Date: Sun, 27 Feb 2022 15:12:17 +0000 Subject: [PATCH 4/5] Update customizeEnv scriptfor Cloud Shell and then some Signed-off-by: Andrei Jiroh Eugenio Halili --- .config/devshell.env | 31 ++++++++++++++++++++++++++++--- bashrc/googlecloudshell.bashrc | 11 +++++++++-- bin/code | 3 +++ bin/tailscaled-docker | 7 +++++++ 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100755 bin/code create mode 100755 bin/tailscaled-docker diff --git a/.config/devshell.env b/.config/devshell.env index 01088f6..a64a8ba 100644 --- a/.config/devshell.env +++ b/.config/devshell.env @@ -9,17 +9,42 @@ elif [[ "$EUID" -ne 0 ]]; then fi # update our cache stuff, but first add backports for Debian Buster +echo "===> Updating local index cache" echo -e "deb http://ftp.debian.org/debian buster-backports main\ndeb-src http://ftp.debian.org/debian buster-backports main" | tee /etc/apt/sources.list.d/buster-backports.list apt-get update +sleep 2; echo # Install HashiCorp Vault, as usual. Don't forget to update GitHub CLI and Terraform -apt-get install vault gh terraform -y +echo "===> Installing GitHub CLI, bat, Terraform and vault CLI" +apt-get install vault gh terraform bat -y +sleep 2; echo -# Install Git from Buster backports -apt-get install -t buster-backports git -y +# Install Git and Git LFS from Buster backports +echo "===> Upgrading Git and Git LFS from backports" +apt-get install -t buster-backports git git-lfs -y +sleep 2; echo # https://unix.stackexchange.com/questions/12702/no-manual-page-for-regex-in-section-3-where-is-it#12705 #apt install manpages manpages-dev manpages-posix manpages-posix-dev -y # btw we need code-server, because Cloud Code sucks. +echo "===> Installing code-server" curl -fsSL https://code-server.dev/install.sh | sh +sleep 2; echo + +# Install uuidgen magic +ech "===> Installing uuid-runtime for uuidgen" +apt-get install -yq uuid-runtime +sleep 2; echo + +echo "====> Installing direnv from GitHub" +curl -sfL https://direnv.net/install.sh | bash + +echo "====> Installing Dazzle and Buildkit from GitHub" +curl -sSL https://github.com/moby/buildkit/releases/download/v0.9.3/buildkit-v0.9.3.linux-amd64.tar.gz | sudo tar xvz -C /usr +curl -sSL https://github.com/gitpod-io/dazzle/releases/download/v0.1.6/dazzle_0.1.6_Linux_x86_64.tar.gz | tar -xvz -C /usr/local/bin +chmod +x /usr/local/bin/dazzle +rm /usr/local/bin/README.md /usr/local/bin/LICENSE + +echo "====> Installing zsh stuf" +apt-get install -y zsh diff --git a/bashrc/googlecloudshell.bashrc b/bashrc/googlecloudshell.bashrc index ebe4f68..4ccd886 100644 --- a/bashrc/googlecloudshell.bashrc +++ b/bashrc/googlecloudshell.bashrc @@ -148,6 +148,13 @@ export DEBEMAIL="andreijiroh@madebythepins.tk" # Summon our gpg-agent and ssh-agent eval $(gpg-agent --daemon) >> /dev/null 2>&1 # We still need this, just in case gpg-agent is being a dick -source $DOTFILES_STUFF_BIN/source-ssh-agent +#source $DOTFILES_STUFF_BIN/source-ssh-agent export GPG_TTY=$(tty) -eval "$(direnv hook bash)" \ No newline at end of file +eval "$(direnv hook bash)" + +# Setup stuff then for Tailscale +if command -v tailscaled >/dev/null; then + ~/.dotfiles/bin/tailscaled-docker +else + echo "Tailscale isn't yet installed! Try again!" +fi diff --git a/bin/code b/bin/code new file mode 100755 index 0000000..50a8112 --- /dev/null +++ b/bin/code @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Work in progres on rewrite..." diff --git a/bin/tailscaled-docker b/bin/tailscaled-docker new file mode 100755 index 0000000..709b8ea --- /dev/null +++ b/bin/tailscaled-docker @@ -0,0 +1,7 @@ +#!/bin/bash + +if [[ $GOOGLE_CLOUD_SHELL = "" ]]; then + nohup sudo tailscaled --statedir=~/.config/tailscaled >/dev/null & +else + nohup sudo tailscaled --tun=userspace-networking --socks5-server=localhost:1088 >/dev/null & +fi From 2533caea4d83d68f5d8ef727936032c1e4834d9f Mon Sep 17 00:00:00 2001 From: Andrei Jiroh Eugenio Halili Date: Sun, 27 Feb 2022 15:28:07 +0000 Subject: [PATCH 5/5] Update bootstrap script to make some symlinks Signed-off-by: Andrei Jiroh Eugenio Halili --- bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap b/bootstrap index 919aee3..da7550e 100755 --- a/bootstrap +++ b/bootstrap @@ -350,7 +350,7 @@ customizeCloudShell() { rm -fv ~/.customize_environment fi - cp ~/.dotfiles/.config/devshell.env ~/.customize_environment && chmod +x ~/.customize_environment + ln -s ~/.dotfiles/.config/devshell.env ~/.customize_environment && chmod +x ~/.customize_environment if [ ! -d "$HOME/.cloudshell" ]; then mkdir "$HOME/.cloudshell" fi