From d9283511a3e64adee644837d63774901ee795c23 Mon Sep 17 00:00:00 2001 From: Andrejus Date: Fri, 8 Mar 2024 00:04:34 +0000 Subject: [PATCH] feat: debian setup, codepsaces install --- README.md | 6 +++--- install | 1 + script/install | 3 +++ script/install.d/02-brew.sh | 2 ++ script/install.d/03-apt.sh | 7 ++++--- script/install.d/05-zsh.sh | 6 ++++++ script/install.d/10-pyenv.sh | 5 +++-- script/install.d/20-docker.sh | 2 -- script/install.d/80-neofetch.sh | 2 +- script/install_config.json | 6 ------ script/{setup => setup-new} | 2 +- 11 files changed, 24 insertions(+), 18 deletions(-) create mode 120000 install rename script/{setup => setup-new} (98%) diff --git a/README.md b/README.md index ebfde60..ccc38b5 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,10 @@ A local repository can be installed by running: ### Automated setup This repository can be installed without a local copy -by invoking the `setup` script directly via `curl`: +by invoking the `setup-new` script directly via `curl`: # Inspect source - curl -s https://raw.githubusercontent.com/andrejusk/dotfiles/HEAD/script/setup | less + curl -s https://raw.githubusercontent.com/andrejusk/dotfiles/HEAD/script/setup-new | less # Run - curl -s https://raw.githubusercontent.com/andrejusk/dotfiles/HEAD/script/setup | bash + curl -s https://raw.githubusercontent.com/andrejusk/dotfiles/HEAD/script/setup-new | bash diff --git a/install b/install new file mode 120000 index 0000000..3f86b29 --- /dev/null +++ b/install @@ -0,0 +1 @@ +script/install \ No newline at end of file diff --git a/script/install b/script/install index 6e254a4..41058a1 100755 --- a/script/install +++ b/script/install @@ -5,6 +5,9 @@ set -eo pipefail # Script to run all install scripts contained in install.d # +printf "\n\t <<< dots installer >>>\n" +printf "\t========================\n\n\n" + # Prevent running as root if [[ $EUID -eq 0 ]]; then echo "Failed: Running as sudo. Please run as user" diff --git a/script/install.d/02-brew.sh b/script/install.d/02-brew.sh index 6b32c1a..36c3a0c 100644 --- a/script/install.d/02-brew.sh +++ b/script/install.d/02-brew.sh @@ -16,4 +16,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then brew --version unset NONINTERACTIVE +else + echo "Skipping: Not macOS" fi diff --git a/script/install.d/03-apt.sh b/script/install.d/03-apt.sh index 6fca0f8..97cd0cc 100644 --- a/script/install.d/03-apt.sh +++ b/script/install.d/03-apt.sh @@ -12,9 +12,7 @@ if command -v apt-get &> /dev/null; then gnupg2 ) - sudo apt-get update - - apt_packages=($(comm -13 <(printf "%s\n" "${apt_packages[@]}" | sort) <(dpkg --get-selections | awk '{print $1}' | sort))) + sudo apt-get update -qq if [ ${#apt_packages[@]} -gt 0 ]; then sudo apt-get install -qq "${apt_packages[@]}" fi @@ -23,3 +21,6 @@ if command -v apt-get &> /dev/null; then else echo "Skipping: apt-get not found" fi + +apt --version +echo "Last updated: $(ls -l /var/lib/apt/periodic/update-success-stamp | awk '{print $6" "$7" "$8}')" diff --git a/script/install.d/05-zsh.sh b/script/install.d/05-zsh.sh index 7644f04..15220ab 100644 --- a/script/install.d/05-zsh.sh +++ b/script/install.d/05-zsh.sh @@ -40,3 +40,9 @@ export POWERLEVEL10K="$ZSH/custom/themes/powerlevel10k" if [ ! -d "$POWERLEVEL10K" ]; then git clone -q --depth=1 https://github.com/romkatv/powerlevel10k.git $POWERLEVEL10K fi + +# change default shell to zsh +if [[ "$SHELL" != *zsh ]]; then + sudo chsh -s "$(command -v zsh)" "$(whoami)" + sudo usermod -s "$(command -v zsh)" "$(whoami)" +fi diff --git a/script/install.d/10-pyenv.sh b/script/install.d/10-pyenv.sh index 0ab4823..d02334a 100644 --- a/script/install.d/10-pyenv.sh +++ b/script/install.d/10-pyenv.sh @@ -25,7 +25,6 @@ if ! command -v "pyenv" &> /dev/null; then liblzma-dev zlib1g-dev ) - pyenv_packages=($(comm -13 <(printf "%s\n" "${pyenv_packages[@]}" | sort) <(dpkg --get-selections | awk '{print $1}' | sort))) if [ ${#pyenv_packages[@]} -gt 0 ]; then sudo apt-get install -qq "${pyenv_packages[@]}" fi @@ -50,6 +49,8 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then unset virtualenv_path fi -eval "$(pyenv init --path)" +export PYENV_ROOT="$HOME/.pyenv" +[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init -)" pyenv --version diff --git a/script/install.d/20-docker.sh b/script/install.d/20-docker.sh index a068a4d..bfc40d1 100644 --- a/script/install.d/20-docker.sh +++ b/script/install.d/20-docker.sh @@ -18,6 +18,4 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then echo "Adding user to docker group" sudo usermod -aG docker "$USER" fi - - unset docker_group fi diff --git a/script/install.d/80-neofetch.sh b/script/install.d/80-neofetch.sh index f97c76f..3a5bd10 100644 --- a/script/install.d/80-neofetch.sh +++ b/script/install.d/80-neofetch.sh @@ -7,7 +7,7 @@ if ! command -v "neofetch" &>/dev/null; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then - sudo apt-get install -qq neofetch + sudo apt-get install neofetch -qq elif [[ "$OSTYPE" == "darwin"* ]]; then brew install neofetch fi diff --git a/script/install_config.json b/script/install_config.json index 2db25d7..25d746b 100644 --- a/script/install_config.json +++ b/script/install_config.json @@ -18,12 +18,6 @@ "repository": "https://packages.cloud.google.com/apt", "components": "cloud-sdk main" }, - { - "key": "google-k8s", - "signingKey": "https://packages.cloud.google.com/apt/doc/apt-key.gpg", - "repository": "https://apt.kubernetes.io/", - "components": "kubernetes-xenial main" - }, { "key": "docker", "signingKey": "https://download.docker.com/linux/debian/gpg", diff --git a/script/setup b/script/setup-new similarity index 98% rename from script/setup rename to script/setup-new index 57e1fa4..5f56256 100755 --- a/script/setup +++ b/script/setup-new @@ -39,7 +39,7 @@ fi # Read GitHub repository and branch from environment variables author=${GITHUB_AUTHOR:-andrejusk} -repository=${GITHUB_REPOSITORY:-dotfiles} +repository=${GITHUB_REPO:-dotfiles} branch=${GITHUB_BRANCH:-master} # Check if repository and branch exists