feat(config,handler,service): add cli-tools/dms-opt-in to PostBootScripts, strip copyShellConfigs, add TTY+network to service
- commit
- 4d54bdb7b724f086bebb62c03f40cca2903a1aac
- author
- bnema · · 2026-02-26 21:16 UTC
- committer
- bnema · · 2026-02-26 21:18 UTC
- parent
- 1553a95
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +9 -33
M install/mandatory/post-boot/archup-first-boot.service +5 -2
| @@ -1,6 +1,7 @@ | |||
| 1 | 1 | [Unit] | |
| 2 | 2 | Description=ArchUp First Boot Setup | |
| 3 | - | After=local-fs.target systemd-logind.service dbus.service | |
| 3 | + | After=local-fs.target systemd-logind.service dbus.service network-online.target | |
| 4 | + | Wants=network-online.target | |
| 4 | 5 | ConditionPathExists=!/var/lib/archup-first-boot-complete | |
| 5 | 6 | ||
| 6 | 7 | [Service] | |
| @@ -9,7 +10,9 @@ Environment="ARCHUP_EMAIL=__ARCHUP_EMAIL__" | |||
| 9 | 10 | Environment="ARCHUP_USERNAME=__ARCHUP_USERNAME__" | |
| 10 | 11 | ExecStart=/usr/local/share/archup/post-boot/all.sh | |
| 11 | 12 | ExecStartPost=/usr/bin/touch /var/lib/archup-first-boot-complete | |
| 12 | - | StandardOutput=journal+console | |
| 13 | + | TTYPath=/dev/tty1 | |
| 14 | + | StandardInput=tty | |
| 15 | + | StandardOutput=tty | |
| 13 | 16 | StandardError=journal+console | |
| 14 | 17 | ||
| 15 | 18 | [Install] | |
| @@ -1,6 +1,7 @@ | |||||
| 1 | [Unit] | 1 | [Unit] | ||
| 2 | Description=ArchUp First Boot Setup | 2 | Description=ArchUp First Boot Setup | ||
| 3 | - | After=local-fs.target systemd-logind.service dbus.service | 3 | + | After=local-fs.target systemd-logind.service dbus.service network-online.target |
| 4 | + | Wants=network-online.target | |||
| 4 | ConditionPathExists=!/var/lib/archup-first-boot-complete | 5 | ConditionPathExists=!/var/lib/archup-first-boot-complete | ||
| 5 | 6 | ||||
| 6 | [Service] | 7 | [Service] | ||
| @@ -9,7 +10,9 @@ Environment="ARCHUP_EMAIL=__ARCHUP_EMAIL__" | |||||
| 9 | Environment="ARCHUP_USERNAME=__ARCHUP_USERNAME__" | 10 | Environment="ARCHUP_USERNAME=__ARCHUP_USERNAME__" | ||
| 10 | ExecStart=/usr/local/share/archup/post-boot/all.sh | 11 | ExecStart=/usr/local/share/archup/post-boot/all.sh | ||
| 11 | ExecStartPost=/usr/bin/touch /var/lib/archup-first-boot-complete | 12 | ExecStartPost=/usr/bin/touch /var/lib/archup-first-boot-complete | ||
| 12 | - | StandardOutput=journal+console | 13 | + | TTYPath=/dev/tty1 |
| 14 | + | StandardInput=tty | |||
| 15 | + | StandardOutput=tty | |||
| 13 | StandardError=journal+console | 16 | StandardError=journal+console | ||
| 14 | 17 | ||||
| 15 | [Install] | 18 | [Install] | ||
M internal/application/handlers/post_install_handler.go +2 -31
| @@ -120,14 +120,6 @@ func (h *PostInstallHandler) setupPostBoot(ctx context.Context, mountPoint, user | |||
| 120 | 120 | } | |
| 121 | 121 | } | |
| 122 | 122 | ||
| 123 | - | if err := h.copyShellConfigs(mountPoint, username); err != nil { | |
| 124 | - | return fmt.Errorf("failed to copy shell configs: %w", err) | |
| 125 | - | } | |
| 126 | - | ||
| 127 | - | if _, err := h.chrExec.ExecuteInChroot(ctx, mountPoint, "chown", "-R", fmt.Sprintf("%s:%s", username, username), filepath.Join("/home", username, ".config")); err != nil { | |
| 128 | - | return fmt.Errorf("failed to set shell config ownership: %w", err) | |
| 129 | - | } | |
| 130 | - | ||
| 131 | 123 | if err := h.chrExec.ChrootSystemctl(ctx, h.logger.LogPath(), mountPoint, "enable", config.PostBootServiceName); err != nil { | |
| 132 | 124 | return fmt.Errorf("failed to enable first-boot service: %w", err) | |
| 133 | 125 | } | |
| @@ -167,30 +159,9 @@ func (h *PostInstallHandler) installLimineLogo(mountPoint string) error { | |||
| 167 | 159 | return nil | |
| 168 | 160 | } | |
| 169 | 161 | ||
| 162 | + | // copyShellConfigs is a no-op: shell configuration is handled by | |
| 163 | + | // cli-tools.sh on first boot. No config files are copied at install time. | |
| 170 | 164 | func (h *PostInstallHandler) copyShellConfigs(mountPoint, username string) error { | |
| 171 | - | configDir := filepath.Join(mountPoint, "home", username, ".config") | |
| 172 | - | if err := h.fs.MkdirAll(configDir, 0755); err != nil { | |
| 173 | - | return fmt.Errorf("failed to create user config dir: %w", err) | |
| 174 | - | } | |
| 175 | - | ||
| 176 | - | files := []string{ | |
| 177 | - | "install/configs/shell/aliases", | |
| 178 | - | "install/configs/shell/envs", | |
| 179 | - | "install/configs/shell/init", | |
| 180 | - | "install/configs/shell/rc", | |
| 181 | - | "install/configs/shell/shell", | |
| 182 | - | "install/configs/shell/starship.toml", | |
| 183 | - | "install/configs/shell/bashrc", | |
| 184 | - | } | |
| 185 | - | ||
| 186 | - | for _, src := range files { | |
| 187 | - | _, name := filepath.Split(src) | |
| 188 | - | dst := filepath.Join(configDir, name) | |
| 189 | - | if err := h.writeFromTemplate(src, dst); err != nil { | |
| 190 | - | return err | |
| 191 | - | } | |
| 192 | - | } | |
| 193 | - | ||
| 194 | 165 | return nil | |
| 195 | 166 | } | |
| 196 | 167 | ||
| @@ -120,14 +120,6 @@ func (h *PostInstallHandler) setupPostBoot(ctx context.Context, mountPoint, user | |||||
| 120 | } | 120 | } | ||
| 121 | } | 121 | } | ||
| 122 | 122 | ||||
| 123 | - | if err := h.copyShellConfigs(mountPoint, username); err != nil { | |||
| 124 | - | return fmt.Errorf("failed to copy shell configs: %w", err) | |||
| 125 | - | } | |||
| 126 | - | ||||
| 127 | - | if _, err := h.chrExec.ExecuteInChroot(ctx, mountPoint, "chown", "-R", fmt.Sprintf("%s:%s", username, username), filepath.Join("/home", username, ".config")); err != nil { | |||
| 128 | - | return fmt.Errorf("failed to set shell config ownership: %w", err) | |||
| 129 | - | } | |||
| 130 | - | ||||
| 131 | if err := h.chrExec.ChrootSystemctl(ctx, h.logger.LogPath(), mountPoint, "enable", config.PostBootServiceName); err != nil { | 123 | if err := h.chrExec.ChrootSystemctl(ctx, h.logger.LogPath(), mountPoint, "enable", config.PostBootServiceName); err != nil { | ||
| 132 | return fmt.Errorf("failed to enable first-boot service: %w", err) | 124 | return fmt.Errorf("failed to enable first-boot service: %w", err) | ||
| 133 | } | 125 | } | ||
| @@ -167,30 +159,9 @@ func (h *PostInstallHandler) installLimineLogo(mountPoint string) error { | |||||
| 167 | return nil | 159 | return nil | ||
| 168 | } | 160 | } | ||
| 169 | 161 | ||||
| 162 | + | // copyShellConfigs is a no-op: shell configuration is handled by | |||
| 163 | + | // cli-tools.sh on first boot. No config files are copied at install time. | |||
| 170 | func (h *PostInstallHandler) copyShellConfigs(mountPoint, username string) error { | 164 | func (h *PostInstallHandler) copyShellConfigs(mountPoint, username string) error { | ||
| 171 | - | configDir := filepath.Join(mountPoint, "home", username, ".config") | |||
| 172 | - | if err := h.fs.MkdirAll(configDir, 0755); err != nil { | |||
| 173 | - | return fmt.Errorf("failed to create user config dir: %w", err) | |||
| 174 | - | } | |||
| 175 | - | ||||
| 176 | - | files := []string{ | |||
| 177 | - | "install/configs/shell/aliases", | |||
| 178 | - | "install/configs/shell/envs", | |||
| 179 | - | "install/configs/shell/init", | |||
| 180 | - | "install/configs/shell/rc", | |||
| 181 | - | "install/configs/shell/shell", | |||
| 182 | - | "install/configs/shell/starship.toml", | |||
| 183 | - | "install/configs/shell/bashrc", | |||
| 184 | - | } | |||
| 185 | - | ||||
| 186 | - | for _, src := range files { | |||
| 187 | - | _, name := filepath.Split(src) | |||
| 188 | - | dst := filepath.Join(configDir, name) | |||
| 189 | - | if err := h.writeFromTemplate(src, dst); err != nil { | |||
| 190 | - | return err | |||
| 191 | - | } | |||
| 192 | - | } | |||
| 193 | - | ||||
| 194 | return nil | 165 | return nil | ||
| 195 | } | 166 | } | ||
| 196 | 167 | ||||
M internal/config/config.go +2 -0
| @@ -192,6 +192,8 @@ var PostBootScripts = []string{ | |||
| 192 | 192 | "ssh-keygen.sh", | |
| 193 | 193 | "archup-cli.sh", | |
| 194 | 194 | "blesh.sh", | |
| 195 | + | "cli-tools.sh", | |
| 196 | + | "dms-opt-in.sh", | |
| 195 | 197 | } | |
| 196 | 198 | ||
| 197 | 199 | // Post-boot service template URL path | |
| @@ -192,6 +192,8 @@ var PostBootScripts = []string{ | |||||
| 192 | "ssh-keygen.sh", | 192 | "ssh-keygen.sh", | ||
| 193 | "archup-cli.sh", | 193 | "archup-cli.sh", | ||
| 194 | "blesh.sh", | 194 | "blesh.sh", | ||
| 195 | + | "cli-tools.sh", | |||
| 196 | + | "dms-opt-in.sh", | |||
| 195 | } | 197 | } | ||
| 196 | 198 | ||||
| 197 | // Post-boot service template URL path | 199 | // Post-boot service template URL path | ||