Repository: MokkeMeguru/dotfiles
Pull request #4: Add Ubuntu (WSL2) Support to Dotfiles
Author: login: Copilot
Created: 2025-05-25T10:06:21Z | Merged: 2025-05-25T10:52:50Z

This PR adds support for Ubuntu running in WSL2 to the dotfiles installation process.

### Changes made:

1. Created a new initialization script for Ubuntu that:
   - Installs essential packages using apt (git, curl, vim, python3, etc.)
   - Sets up development tools like lsd, fzf, direnv, GitHub CLI, and Go
   - Creates necessary cache directories

2. Modified the install.sh script to:
   - Add "ubuntu" as a valid OS option in the usage instructions
   - Update the OS validation logic to accept "ubuntu" as a valid option
   - Add a conditional to run the Ubuntu-specific initialization script

### Usage:
```bash
./install.sh -o ubuntu -l
```

This brings the dotfiles support to all three major environments:
- macOS
- Arch Linux/Manjaro
- Ubuntu (WSL2)

Fixes #3.

---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Linked issue #3: ubuntu (WSL2) 用の設定の追加
now we have a install option for mac and archilinux / manjaro linux
but recently, we will use ubunutu in WSL2.

so add whole install commands for ubuntu (WSL2)

Diff:
diff --git a/doom.d/init.el b/doom.d/init.el
index a00a73e..071445a 100644
--- a/doom.d/init.el
+++ b/doom.d/init.el
@@ -117,7 +117,7 @@
        ;;agda              ; types of types of types of types...
        ;;beancount         ; mind the GAAP
        ;;(cc +lsp)         ; C > C++ == 1
-       clojure           ; java with a lisp
+       ;;clojure           ; java with a lisp
        ;;common-lisp       ; if you've seen one lisp, you've seen them all
        ;;coq               ; proofs-as-programs
        ;;crystal           ; ruby at the speed of c
diff --git a/dotfilesDepends.sh b/dotfilesDepends.sh
index f134fbd..be2a994 100644
--- a/dotfilesDepends.sh
+++ b/dotfilesDepends.sh
@@ -24,24 +24,6 @@ if [ ! -e $HOME/.vim/bundle/Vundle.vim ]; then
 	git clone https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim
 fi
 
-echo "install babashka"
-if !(type "bb" > /dev/null 2>&1); then
-	if [ ! -d $HOME/.bbsk ]; then
-		mkdir $HOME/.bbsk
-	fi
-	curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install
-	chmod +x install
-	./install $HOME/.bbsk
-fi
-
-echo "install clj-kondo"
-if !(type "clj-kondo" > /dev/null 2>&1); then
-	curl -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo
-	chmod +x install-clj-kondo
-	./install-clj-kondo
-	fibreconfig
-fi
-
 echo "install pyenv"
 if [ ! -d $HOME/.pyenv ]; then
 	git clone git://github.com/yyuu/pyenv.git ~/.pyenv
diff --git a/etc/init/ubuntu/init.sh b/etc/init/ubuntu/init.sh
new file mode 100755
index 0000000..05dcf39
--- /dev/null
+++ b/etc/init/ubuntu/init.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+
+# Update package lists
+sudo apt update
+
+# Install basic packages
+sudo apt install -y git curl vim python3 build-essential cmake libtool
+
+# Install Emacs
+sudo apt install -y emacs
+
+# Install lsd (modern ls alternative)
+LSD_VERSION="1.0.0"
+if ! command -v lsd &> /dev/null; then
+    LSD_DEB="lsd_${LSD_VERSION}_amd64.deb"
+    curl -sLO "https://github.com/Peltoche/lsd/releases/download/${LSD_VERSION}/${LSD_DEB}"
+    sudo dpkg -i "${LSD_DEB}"
+    rm "${LSD_DEB}"
+fi
+
+# Install fzf (fuzzy finder)
+sudo apt install -y fzf
+
+# Install direnv
+sudo apt install -y direnv
+
+# Install GitHub CLI
+if ! command -v gh &> /dev/null; then
+    curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
+    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
+    sudo apt update
+    sudo apt install -y gh
+fi
+
+# Install Go
+if ! command -v go &> /dev/null; then
+    GO_VERSION="1.23"
+    curl -sLO "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz"
+    sudo tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz"
+    rm "go${GO_VERSION}.linux-amd64.tar.gz"
+fi
+
+# Create cache directory
+mkdir -p $HOME/.cache/tmp
\ No newline at end of file
diff --git a/install-clj-kondo b/install-clj-kondo
deleted file mode 100755
index e4e17f8..0000000
--- a/install-clj-kondo
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/env bash
-
-# install script inspired by scripts for clojure and CircleCI CLI tool
-# install latest version of clj-kondo or upgrades existing one
-
-set -euo pipefail
-
-default_install_dir="/usr/local/bin"
-install_dir=$default_install_dir
-default_download_dir="/tmp"
-download_dir=$default_download_dir
-version=""
-
-print_help() {
-    echo "Installs latest version of clj-kondo."
-    echo -e
-    echo "Usage:"
-    echo "install [--dir <dir>] [--download-dir <download-dir>] [--version <version>]"
-    echo -e
-    echo "Defaults:"
-    echo " * Installation directory: ${default_install_dir}"
-    echo " * Download directory: ${default_download_dir}"
-    echo " * Version: <Latest release on github>"
-    exit 1
-}
-
-while [[ $# -gt 0 ]]
-do
-    key="$1"
-    if [[ -z "${2:-}" ]]; then
-        print_help
-    fi
-
-    case $key in
-        --dir)
-            install_dir="$2"
-            shift
-            shift
-            ;;
-        --download-dir)
-            download_dir="$2"
-            shift
-            shift
-            ;;
-        --version|--release-version)
-            version="$2"
-            shift
-            shift
-            ;;
-        *)    # unknown option
-            print_help
-            shift
-            ;;
-    esac
-done
-
-if [[ "$version" == "" ]]; then
-  version="$(curl -s https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/resources/CLJ_KONDO_RELEASED_VERSION)"
-fi
-
-static_suffix=""
-
-case "$(uname -s)" in
-    Linux*)     platform=linux
-                ;;
-    Darwin*)    platform=macos
-                ;;
-esac
-
-case "$(uname -m)" in
-    aarch64) arch=aarch64
-             ;;
-    arm64) arch="aarch64"
-           ;;
-    *) arch=amd64
-       # always use static image on linux
-       if [[ "$platform" == "linux" ]]; then
-          static_suffix="-static"
-       fi
-       ;;
-esac
-
-download_url="https://github.com/clj-kondo/clj-kondo/releases/download/v$version/clj-kondo-$version-$platform$static_suffix-$arch.zip"
-
-mkdir -p "$download_dir"
-pushd "$download_dir" > /dev/null
-echo -e "Downloading $download_url to $download_dir"
-
-filename="clj-kondo-$version-$platform$static_suffix-$arch.zip"
-
-rm -rf "$filename"
-rm -rf "clj-kondo"
-curl -o "$filename" -sL "$download_url"
-unzip -qqo "$filename"
-rm "$filename"
-popd > /dev/null
-
-if [ "$download_dir" != "$install_dir" ]
-then
-    mkdir -p "$install_dir"
-    pushd "$install_dir" > /dev/null
-    if [ -f clj-kondo ]; then
-        echo -e "Moving $install_dir/clj-kondo to $install_dir/clj-kondo.old"
-        mv -f "clj-kondo" "clj-kondo.old"
-    fi
-    pushd > /dev/null
-    mv -f "$download_dir/clj-kondo" "$install_dir/clj-kondo"
-fi
-
-echo -e "Successfully installed clj-kondo in $install_dir"
diff --git a/install.sh b/install.sh
index fc169d5..b40ad93 100755
--- a/install.sh
+++ b/install.sh
@@ -7,7 +7,7 @@ function usage {
 Usage: $(basename "$0") [OPTION] ...
 please input the argument
     --help/-h  Display help
-    -o VALUE   os [arch, osx]
+    -o VALUE   os [arch, osx, ubuntu]
     -l         load dotfile's bashrc/bash_profile
 EOM
     exit 2
@@ -47,10 +47,10 @@ if [ $no_args == "true" ]; then
     exit 1
 fi
 
-if [ $OS == "arch" ] || [ $OS == "osx" ]; then
+if [ $OS == "arch" ] || [ $OS == "osx" ] || [ $OS == "ubuntu" ]; then
     echo "--os = ${OS}"
 else
-    echo "os is choices from [arch, osx]"
+    echo "os is choices from [arch, osx, ubuntu]"
     exit 1
 fi
 
@@ -64,6 +64,8 @@ if [ "$OS" = "arch" ]; then
     sh $DOTPATH/etc/init/arch/init.sh
 elif [ "$OS" = "osx" ]; then
     sh $DOTPATH/etc/init/osx/init.sh
+elif [ "$OS" = "ubuntu" ]; then
+    sh $DOTPATH/etc/init/ubuntu/init.sh
 fi
 
 OS=${OS} sh $DOTPATH/dotfilesDepends.sh


Reviews:
user: login: MokkeMeguru
state: COMMENTED
author_association: OWNER
submitted_at: 2025-05-25T10:18:29Z
user: login: copilot-swe-agent[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-25T10:19:31Z

Review comments:
diff_hunk: @@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+
+# Update package lists
+sudo apt update
+
+# Install basic packages
+sudo apt install -y git curl vim python3 build-essential cmake libtool
+
+# Install Emacs
+sudo apt install -y emacs
+
+# Install lsd (modern ls alternative)
+LSD_VERSION="1.0.0"
+if ! command -v lsd &> /dev/null; then
+    LSD_DEB="lsd_${LSD_VERSION}_amd64.deb"
+    curl -sLO "https://github.com/Peltoche/lsd/releases/download/${LSD_VERSION}/${LSD_DEB}"
+    sudo dpkg -i "${LSD_DEB}"
+    rm "${LSD_DEB}"
+fi
+
+# Install fzf (fuzzy finder)
+sudo apt install -y fzf
+
+# Install direnv
+sudo apt install -y direnv
+
+# Install GitHub CLI
+if ! command -v gh &> /dev/null; then
+    curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
+    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
+    sudo apt update
+    sudo apt install -y gh
+fi
+
+# Install Go
+if ! command -v go &> /dev/null; then
+    GO_VERSION="1.19"
path: etc/init/ubuntu/init.sh
user: login: MokkeMeguru
body: current latest go is 1.23 
so update it @copilot 
created_at: 2025-05-25T10:18:28Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+
+# Update package lists
+sudo apt update
+
+# Install basic packages
+sudo apt install -y git curl vim python3 build-essential cmake libtool
+
+# Install Emacs
+sudo apt install -y emacs
+
+# Install lsd (modern ls alternative)
+LSD_VERSION="1.0.0"
+if ! command -v lsd &> /dev/null; then
+    LSD_DEB="lsd_${LSD_VERSION}_amd64.deb"
+    curl -sLO "https://github.com/Peltoche/lsd/releases/download/${LSD_VERSION}/${LSD_DEB}"
+    sudo dpkg -i "${LSD_DEB}"
+    rm "${LSD_DEB}"
+fi
+
+# Install fzf (fuzzy finder)
+sudo apt install -y fzf
+
+# Install direnv
+sudo apt install -y direnv
+
+# Install GitHub CLI
+if ! command -v gh &> /dev/null; then
+    curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
+    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
+    sudo apt update
+    sudo apt install -y gh
+fi
+
+# Install Go
+if ! command -v go &> /dev/null; then
+    GO_VERSION="1.19"
path: etc/init/ubuntu/init.sh
user: login: Copilot
body: I've updated the Go version from 1.19 to 1.23 in the Ubuntu initialization script. Commit: d581d16
created_at: 2025-05-25T10:19:31Z
author_association: CONTRIBUTOR

PR comments:
user: login: MokkeMeguru
created_at: 2025-05-25T10:11:21Z
body: @copilot please rebase and follow the latest main branch
author_association: OWNER
user: login: Copilot
created_at: 2025-05-25T10:13:52Z
body: 
> @copilot please rebase and follow the latest main branch

I've rebased the branch onto the latest main branch. The branch is now up-to-date with all changes from main while preserving the Ubuntu (WSL2) support. Commit: 36c77e2
author_association: CONTRIBUTOR