Commit 09fb6cc

mo khan <mo@mokhan.ca>
2021-06-30 23:48:09
refactor: extract codespace specific setup
1 parent d336cbc
Changed files (2)
script/codespaces-post-start
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -e
+
+cd "$(dirname "$0")/.."
+
+function debian_sid_sources()
+{
+  mv /etc/apt/sources.list /etc/apt/sources.list.bak
+  cp -f ./etc/apt/sources.list /etc/apt/sources.list
+}
+
+function install_pkgs()
+{
+  debian_sid_sources
+
+  apt-get update -y
+
+  # shellcheck disable=SC2046
+  apt-get install -y --no-install-recommends $(tr '\n' ' ' < ./apt.list)
+}
+
+./script/setup
+install_pkgs
+
+./vim/pack/plugins/start/fzf/install --all
+cp -f ./vim/pack/plugins/start/fzf/bin/fzf "$HOME/.local/bin/"
install.sh → script/setup
@@ -2,6 +2,8 @@
 
 set -e
 
+cd "$(dirname "$0")/.."
+
 function dotdir()
 {
   dir=$1
@@ -28,19 +30,6 @@ function dotfile()
   ln -sfn "$source" "$destination"
 }
 
-function install_pkgs()
-{
-  if [[ -n $CODESPACES ]]; then
-    mv /etc/apt/sources.list /etc/apt/sources.list.bak
-    cp -f ./etc/apt/sources.list /etc/apt/sources.list
-    apt-get update -y
-    # shellcheck disable=SC2046
-    apt-get install -y --no-install-recommends $(tr '\n' ' ' < ./apt.list)
-    ./vim/pack/plugins/start/fzf/install --all
-    cp -f ./vim/pack/plugins/start/fzf/bin/fzf "$HOME/.local/bin/"
-  fi
-}
-
 mkdir -p "$HOME/.config" "$HOME/.local/bin" "$HOME/.local/share"
 git submodule update --init
 
@@ -59,5 +48,3 @@ dotfile "profile"
 dotfile "ssh/config"
 dotfile "vimrc"
 dotfile "wgetrc"
-
-install_pkgs