Commit 3d888d6

mo khan <mo@mokhan.ca>
2021-11-25 23:19:54
refactor: merge codespaces-post-start into setup
1 parent 3b8bd2a
Changed files (2)
script/codespaces-post-start
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-set -e
-
-cd "$(dirname "$0")/.."
-
-./script/setup
-
-apt-get update -y
-
-# shellcheck disable=SC2046
-apt-get install -y --no-install-recommends $(tr '\n' ' ' < ./apt.list)
script/setup
@@ -30,6 +30,11 @@ function dotfile()
   ln -sfn "$source" "$destination"
 }
 
+function try()
+{
+  $@ 2>/dev/null || sudo $@
+}
+
 mkdir -p "$HOME/.config" "$HOME/.local/bin" "$HOME/.local/share"
 git submodule update --init
 
@@ -50,3 +55,10 @@ dotfile "ssh/config"
 dotfile "tmux.conf"
 dotfile "vimrc"
 dotfile "wgetrc"
+
+if [ -n "$CODESPACES" ]; then
+  try apt-get update -y
+
+  # shellcheck disable=SC2046
+  try apt-get install -y --no-install-recommends $(tr '\n' ' ' < ./apt.list)
+fi