diff --git a/README.md b/README.md index 18e5249..42b88e4 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ Use the following `curl`, `wget`, or `git` command:
-git (>=2.35.0 recommended) +git >= 2.35.0
 git clone --depth=1 https://github.com/irichu/dotfiles.git && cd dotfiles && ./install.sh
diff --git a/assets/scripts/completions/generate-zsh-completions.sh b/assets/scripts/completions/generate-zsh-completions.sh
index 47efe1f..5448d81 100755
--- a/assets/scripts/completions/generate-zsh-completions.sh
+++ b/assets/scripts/completions/generate-zsh-completions.sh
@@ -4,10 +4,6 @@ CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
 ZSH_COMPLETIONS_DIR="${ZSH_COMPLETIONS_DIR:-${CONFIG_HOME}/zsh/completions}"
 mkdir -p "$ZSH_COMPLETIONS_DIR"
 
-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-
-cd "${SCRIPT_DIR}" || exit 1
-
 cmd_exists() {
   command -v "$1" &>/dev/null
 }
@@ -74,5 +70,3 @@ fi
 if cmd_exists zsh; then
   zsh -c 'autoload -Uz compinit && compinit' >/dev/null 2>&1
 fi
-
-cd - || exit 1
diff --git a/assets/scripts/desktop/autoinstall.yaml b/assets/scripts/desktop/autoinstall.yaml
new file mode 100644
index 0000000..7f15e80
--- /dev/null
+++ b/assets/scripts/desktop/autoinstall.yaml
@@ -0,0 +1,64 @@
+autoinstall:
+  version: 1
+  identity:
+    hostname: ubuntu-desktop
+    realname: "User"
+    username: user
+    password: "$6$EXAMPLE$ABCDEFGHIJKLMNOPQRSTUVWXzyxwvutsrqponmlkjihgfedcba1234567890abcdEFGH" # REPLACE with a real SHA-512 hash, e.g. from: openssl passwd -6 'your-password' (do NOT commit real passwords)
+  locale: "en_US.UTF-8"
+  #locale: "ja_JP.UTF-8"
+  keyboard:
+    layout: us
+    variant: ""
+    toggle: null
+  source:
+    id: ubuntu-desktop-minimal # ubuntu-server-minimal
+  #interactive-sections:
+  #  - network
+  #network:
+  #  # network configuration (e.g., interfaces, wifi, etc.)
+  #  version: 2
+  #  ethernets:
+  #    enp0s31f6:
+  #      dhcp6: true
+  #proxy: http://172.16.90.1:3128
+  apt:
+    mirror-selection:
+      primary:
+        - uri: "http://jp.archive.ubuntu.com/ubuntu"
+        #- uri: "http://archive.ubuntu.com/ubuntu"
+    fallback: abort
+  storage:
+    layout:
+      name: lvm
+      sizing-policy: all
+      #password: LUKS_PASSPHRASE
+  timezone: Asia/Tokyo
+  ubuntu-pro:
+    # Enable Ubuntu-Pro using a contract token
+    # Note that the example below is an invalid contract token.
+    #token: "your-ubuntu-pro-contract-token"
+  ssh:
+    install-server: true
+    authorized-keys:
+      # replace with the contents of the public key(s) as generated by
+      # ssh-keygen or similar tools
+      - ""
+    allow-pw: false
+  codecs:
+    install: false
+  packages:
+    - build-essential
+    - curl
+    - git
+    - unzip
+    - tar
+  early-commands:
+    - /bin/true
+  late-commands:
+    - curtin in-target -- bash -c 'echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99-user'
+    - curtin in-target -- chmod 440 /etc/sudoers.d/99-user
+    - curtin in-target -- sudo -H -u user bash -c 'cd "$HOME" && curl -sL https://raw.githubusercontent.com/irichu/dotfiles/main/install.sh | bash && DEBUG=true ~/.local/bin/dots install --apt'
+  error-commands:
+    - tar -czf /installer-logs.tar.gz /var/log/installer/
+    - journalctl -b > /installer-journal.log
diff --git a/assets/scripts/desktop/set-dconf-custom-desktop.sh b/assets/scripts/desktop/set-dconf-custom-desktop.sh
index 91ddde5..d7f87c0 100755
--- a/assets/scripts/desktop/set-dconf-custom-desktop.sh
+++ b/assets/scripts/desktop/set-dconf-custom-desktop.sh
@@ -63,6 +63,7 @@ dconf write /org/gnome/shell/favorite-apps "@as [\
   'vlc.desktop',\
   'code.desktop',\
   'code-insiders.desktop',\
+  'ghostty_ghostty.desktop',\
   'alacritty_alacritty.desktop',\
   'obsidian.desktop',\
   'Waydroid.desktop',\
diff --git a/assets/scripts/main.sh b/assets/scripts/main.sh
index 24f1c08..94a2dbd 100755
--- a/assets/scripts/main.sh
+++ b/assets/scripts/main.sh
@@ -20,6 +20,24 @@ export LC_ALL=C
 ARCH="$(uname -m)"
 readonly ARCH
 
+AUTO_YES=false
+POSITIONAL=()
+
+while [[ $# -gt 0 ]]; do
+  case "$1" in
+    -y|--yes)
+      AUTO_YES=true
+      shift
+      ;;
+    *)
+      POSITIONAL+=("$1")
+      shift
+      ;;
+  esac
+done
+
+set -- "${POSITIONAL[@]}"
+
 #GITHUB_ACTIONS=1
 #readonly GITHUB_ACTIONS
 
@@ -325,6 +343,12 @@ echo_each_command_usage() {
     ((i++))
   done
 
+  info ''
+  info -ny -cg 'Generate zsh completion: '
+  info -cc 'dots completion'
+  info -ny -cg 'Generate package completions: '
+  info -cc 'dots completions'
+
   info ''
   info -ny -cg 'Test on Docker: '
   info -cc 'dots docker test {ubuntu|ubuntu-22.04|arch|fedora}'
@@ -502,6 +526,36 @@ remove_zcompdump() {
   return 0
 }
 
+confirm() {
+  local prompt="${1:-Are you sure?}"
+  local reply
+
+  if "$AUTO_YES"; then
+    echo "$prompt [Y/n]: yes (auto)"
+    return 0
+  fi
+
+  if [[ ! -t 0 ]]; then
+    return 0
+  fi
+
+  while true; do
+    read -r -p "$prompt [Y/n]: " reply
+    case "$reply" in
+      [Yy]|"" )
+        return 0
+        ;;
+      [Nn] )
+        return 1
+        ;;
+      * )
+        echo "Please answer y or n."
+        ;;
+    esac
+  done
+}
+
+
 ###################################################
 # shells
 ###################################################
@@ -2539,11 +2593,19 @@ i | install)
     remove_zcompdump
     ;;
   --ubuntu-desktop)
-    info "Start installation with apt and snap"
     check_command apt
     check_command snap
 
-    info "Start installation with apt and snap"
+    echo "This process will download and install many packages (~15 minutes)."
+    echo "Please ensure you have a stable internet connection."
+    echo
+
+    if confirm "Proceed?"; then
+      info "Starting installation for Ubuntu Desktop..."
+    else
+      exit 1
+    fi
+
     install_apt_package
     install_snap_package
     setup_zsh
@@ -2557,7 +2619,7 @@ i | install)
     remove_zcompdump
     setup_desktop
     echo_completion_message
-    info "End installation with apt and snap"
+    info "End installation for Ubuntu Desktop..."
     ;;
   #--------------------------------------------------
   # individual installation