feat(post-install): add email support and service file templating
- Add UserEmail field to PostInstallCommand for git config and SSH key generation - Update PostInstallHandler to accept and use rawURL parameter for service file templates - Add string import for placeholder replacement in service files - Pass UserEmail to setupPostBoot function for downstream processing - Remove bluetooth enable step (firewalld will handle service management) - Update tests to reflect new PostInstallCommand signature
- commit
- 9ecc46f2f113ee920511215216ce676e436bcdf7
- author
- brice · · 2026-01-25 18:00 UTC
- parent
- c456b6d
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +34 -16
M internal/application/commands/post_install.go +1 -0
| @@ -4,6 +4,7 @@ package commands | |||
| 4 | 4 | type PostInstallCommand struct { | |
| 5 | 5 | MountPoint string // Root mount point | |
| 6 | 6 | Username string // Standard user username | |
| 7 | + | UserEmail string // User email for git config and SSH key (optional) | |
| 7 | 8 | RunPostBootScripts bool // Whether to run post-boot scripts | |
| 8 | 9 | PlymouthTheme string // Plymouth theme to install (optional) | |
| 9 | 10 | } | |
| @@ -4,6 +4,7 @@ package commands | |||||
| 4 | type PostInstallCommand struct { | 4 | type PostInstallCommand struct { | ||
| 5 | MountPoint string // Root mount point | 5 | MountPoint string // Root mount point | ||
| 6 | Username string // Standard user username | 6 | Username string // Standard user username | ||
| 7 | + | UserEmail string // User email for git config and SSH key (optional) | |||
| 7 | RunPostBootScripts bool // Whether to run post-boot scripts | 8 | RunPostBootScripts bool // Whether to run post-boot scripts | ||
| 8 | PlymouthTheme string // Plymouth theme to install (optional) | 9 | PlymouthTheme string // Plymouth theme to install (optional) | ||
| 9 | } | 10 | } | ||
M internal/application/handlers/post_install_handler.go +29 -12
| @@ -5,6 +5,7 @@ import ( | |||
| 5 | 5 | "fmt" | |
| 6 | 6 | "path/filepath" | |
| 7 | 7 | "regexp" | |
| 8 | + | "strings" | |
| 8 | 9 | ||
| 9 | 10 | "github.com/bnema/archup/internal/application/commands" | |
| 10 | 11 | "github.com/bnema/archup/internal/application/dto" | |
| @@ -19,16 +20,18 @@ type PostInstallHandler struct { | |||
| 19 | 20 | chrExec ports.ChrootExecutor | |
| 20 | 21 | scriptExec ports.ScriptExecutor | |
| 21 | 22 | logger ports.Logger | |
| 23 | + | rawURL string | |
| 22 | 24 | } | |
| 23 | 25 | ||
| 24 | 26 | // NewPostInstallHandler creates a new post-installation handler | |
| 25 | - | func NewPostInstallHandler(fs ports.FileSystem, httpClient ports.HTTPClient, chrExec ports.ChrootExecutor, scriptExec ports.ScriptExecutor, logger ports.Logger) *PostInstallHandler { | |
| 27 | + | func NewPostInstallHandler(fs ports.FileSystem, httpClient ports.HTTPClient, chrExec ports.ChrootExecutor, scriptExec ports.ScriptExecutor, logger ports.Logger, rawURL string) *PostInstallHandler { | |
| 26 | 28 | return &PostInstallHandler{ | |
| 27 | 29 | fs: fs, | |
| 28 | 30 | httpClient: httpClient, | |
| 29 | 31 | chrExec: chrExec, | |
| 30 | 32 | scriptExec: scriptExec, | |
| 31 | 33 | logger: logger, | |
| 34 | + | rawURL: rawURL, | |
| 32 | 35 | } | |
| 33 | 36 | } | |
| 34 | 37 | ||
| @@ -47,7 +50,7 @@ func (h *PostInstallHandler) Handle(ctx context.Context, cmd commands.PostInstal | |||
| 47 | 50 | h.logger.Info("Running post-boot scripts") | |
| 48 | 51 | result.TasksRun = append(result.TasksRun, "post-boot-scripts") | |
| 49 | 52 | ||
| 50 | - | if err := h.setupPostBoot(ctx, cmd.MountPoint, cmd.Username); err != nil { | |
| 53 | + | if err := h.setupPostBoot(ctx, cmd.MountPoint, cmd.Username, cmd.UserEmail); err != nil { | |
| 51 | 54 | h.logger.Error("Failed to setup post-boot scripts", "error", err) | |
| 52 | 55 | result.ErrorDetail = fmt.Sprintf("Failed to setup post-boot scripts: %v", err) | |
| 53 | 56 | return result, err | |
| @@ -87,12 +90,6 @@ func (h *PostInstallHandler) Handle(ctx context.Context, cmd commands.PostInstal | |||
| 87 | 90 | h.logger.Warn("Failed to install Limine logo", "error", err) | |
| 88 | 91 | } | |
| 89 | 92 | ||
| 90 | - | if err := h.chrExec.ChrootSystemctl(ctx, h.logger.LogPath(), cmd.MountPoint, "enable", "bluetooth"); err != nil { | |
| 91 | - | h.logger.Error("Failed to enable bluetooth", "error", err) | |
| 92 | - | result.ErrorDetail = fmt.Sprintf("Failed to enable bluetooth: %v", err) | |
| 93 | - | return result, err | |
| 94 | - | } | |
| 95 | - | ||
| 96 | 93 | // Final cleanup and verification | |
| 97 | 94 | h.logger.Info("Post-installation tasks completed") | |
| 98 | 95 | result.Success = true | |
| @@ -100,14 +97,15 @@ func (h *PostInstallHandler) Handle(ctx context.Context, cmd commands.PostInstal | |||
| 100 | 97 | return result, nil | |
| 101 | 98 | } | |
| 102 | 99 | ||
| 103 | - | func (h *PostInstallHandler) setupPostBoot(ctx context.Context, mountPoint, username string) error { | |
| 100 | + | func (h *PostInstallHandler) setupPostBoot(ctx context.Context, mountPoint, username, email string) error { | |
| 104 | 101 | postBootPath := filepath.Join(mountPoint, "usr", "local", "share", "archup", "post-boot") | |
| 105 | 102 | if err := h.fs.MkdirAll(postBootPath, 0755); err != nil { | |
| 106 | 103 | return fmt.Errorf("failed to create post-boot directory: %w", err) | |
| 107 | 104 | } | |
| 108 | 105 | ||
| 106 | + | // Write service file with placeholder replacement for email and username | |
| 109 | 107 | serviceDest := filepath.Join(mountPoint, "etc", "systemd", "system", "archup-first-boot.service") | |
| 110 | - | if err := h.writeFromTemplate("install/mandatory/post-boot/archup-first-boot.service", serviceDest); err != nil { | |
| 108 | + | if err := h.writeServiceFile("install/mandatory/post-boot/archup-first-boot.service", serviceDest, username, email); err != nil { | |
| 111 | 109 | return fmt.Errorf("failed to write service file: %w", err) | |
| 112 | 110 | } | |
| 113 | 111 | ||
| @@ -208,6 +206,24 @@ func (h *PostInstallHandler) writeFromTemplate(src string, dst string) error { | |||
| 208 | 206 | return h.fs.WriteFile(dst, content, 0644) | |
| 209 | 207 | } | |
| 210 | 208 | ||
| 209 | + | // writeServiceFile writes the systemd service file with placeholder replacement | |
| 210 | + | func (h *PostInstallHandler) writeServiceFile(src, dst, username, email string) error { | |
| 211 | + | content, err := h.tryReadLocal(src) | |
| 212 | + | if err != nil { | |
| 213 | + | content, err = h.downloadTemplate(src) | |
| 214 | + | if err != nil { | |
| 215 | + | return err | |
| 216 | + | } | |
| 217 | + | } | |
| 218 | + | ||
| 219 | + | // Replace placeholders with actual values | |
| 220 | + | serviceContent := string(content) | |
| 221 | + | serviceContent = strings.ReplaceAll(serviceContent, "__ARCHUP_USERNAME__", username) | |
| 222 | + | serviceContent = strings.ReplaceAll(serviceContent, "__ARCHUP_EMAIL__", email) | |
| 223 | + | ||
| 224 | + | return h.fs.WriteFile(dst, []byte(serviceContent), 0644) | |
| 225 | + | } | |
| 226 | + | ||
| 211 | 227 | func (h *PostInstallHandler) tryReadLocal(path string) ([]byte, error) { | |
| 212 | 228 | localPath := filepath.Join(config.DefaultInstallDir, path) | |
| 213 | 229 | if exists, err := h.fs.Exists(localPath); err == nil && exists { | |
| @@ -220,7 +236,8 @@ func (h *PostInstallHandler) tryReadLocal(path string) ([]byte, error) { | |||
| 220 | 236 | } | |
| 221 | 237 | ||
| 222 | 238 | func (h *PostInstallHandler) downloadTemplate(path string) ([]byte, error) { | |
| 223 | - | url := fmt.Sprintf("https://raw.githubusercontent.com/bnema/archup/main/%s", path) | |
| 239 | + | url := fmt.Sprintf("%s/%s", h.rawURL, path) | |
| 240 | + | h.logger.Info("Downloading template", "url", url) | |
| 224 | 241 | resp, err := h.httpClient.Get(url) | |
| 225 | 242 | if err != nil { | |
| 226 | 243 | return nil, err | |
| @@ -231,7 +248,7 @@ func (h *PostInstallHandler) downloadTemplate(path string) ([]byte, error) { | |||
| 231 | 248 | } | |
| 232 | 249 | }() | |
| 233 | 250 | if resp.StatusCode() < 200 || resp.StatusCode() > 299 { | |
| 234 | - | return nil, fmt.Errorf("unexpected status %d", resp.StatusCode()) | |
| 251 | + | return nil, fmt.Errorf("unexpected status %d from %s", resp.StatusCode(), url) | |
| 235 | 252 | } | |
| 236 | 253 | return resp.Body(), nil | |
| 237 | 254 | } | |
| @@ -5,6 +5,7 @@ import ( | |||||
| 5 | "fmt" | 5 | "fmt" | ||
| 6 | "path/filepath" | 6 | "path/filepath" | ||
| 7 | "regexp" | 7 | "regexp" | ||
| 8 | + | "strings" | |||
| 8 | 9 | ||||
| 9 | "github.com/bnema/archup/internal/application/commands" | 10 | "github.com/bnema/archup/internal/application/commands" | ||
| 10 | "github.com/bnema/archup/internal/application/dto" | 11 | "github.com/bnema/archup/internal/application/dto" | ||
| @@ -19,16 +20,18 @@ type PostInstallHandler struct { | |||||
| 19 | chrExec ports.ChrootExecutor | 20 | chrExec ports.ChrootExecutor | ||
| 20 | scriptExec ports.ScriptExecutor | 21 | scriptExec ports.ScriptExecutor | ||
| 21 | logger ports.Logger | 22 | logger ports.Logger | ||
| 23 | + | rawURL string | |||
| 22 | } | 24 | } | ||
| 23 | 25 | ||||
| 24 | // NewPostInstallHandler creates a new post-installation handler | 26 | // NewPostInstallHandler creates a new post-installation handler | ||
| 25 | - | func NewPostInstallHandler(fs ports.FileSystem, httpClient ports.HTTPClient, chrExec ports.ChrootExecutor, scriptExec ports.ScriptExecutor, logger ports.Logger) *PostInstallHandler { | 27 | + | func NewPostInstallHandler(fs ports.FileSystem, httpClient ports.HTTPClient, chrExec ports.ChrootExecutor, scriptExec ports.ScriptExecutor, logger ports.Logger, rawURL string) *PostInstallHandler { |
| 26 | return &PostInstallHandler{ | 28 | return &PostInstallHandler{ | ||
| 27 | fs: fs, | 29 | fs: fs, | ||
| 28 | httpClient: httpClient, | 30 | httpClient: httpClient, | ||
| 29 | chrExec: chrExec, | 31 | chrExec: chrExec, | ||
| 30 | scriptExec: scriptExec, | 32 | scriptExec: scriptExec, | ||
| 31 | logger: logger, | 33 | logger: logger, | ||
| 34 | + | rawURL: rawURL, | |||
| 32 | } | 35 | } | ||
| 33 | } | 36 | } | ||
| 34 | 37 | ||||
| @@ -47,7 +50,7 @@ func (h *PostInstallHandler) Handle(ctx context.Context, cmd commands.PostInstal | |||||
| 47 | h.logger.Info("Running post-boot scripts") | 50 | h.logger.Info("Running post-boot scripts") | ||
| 48 | result.TasksRun = append(result.TasksRun, "post-boot-scripts") | 51 | result.TasksRun = append(result.TasksRun, "post-boot-scripts") | ||
| 49 | 52 | ||||
| 50 | - | if err := h.setupPostBoot(ctx, cmd.MountPoint, cmd.Username); err != nil { | 53 | + | if err := h.setupPostBoot(ctx, cmd.MountPoint, cmd.Username, cmd.UserEmail); err != nil { |
| 51 | h.logger.Error("Failed to setup post-boot scripts", "error", err) | 54 | h.logger.Error("Failed to setup post-boot scripts", "error", err) | ||
| 52 | result.ErrorDetail = fmt.Sprintf("Failed to setup post-boot scripts: %v", err) | 55 | result.ErrorDetail = fmt.Sprintf("Failed to setup post-boot scripts: %v", err) | ||
| 53 | return result, err | 56 | return result, err | ||
| @@ -87,12 +90,6 @@ func (h *PostInstallHandler) Handle(ctx context.Context, cmd commands.PostInstal | |||||
| 87 | h.logger.Warn("Failed to install Limine logo", "error", err) | 90 | h.logger.Warn("Failed to install Limine logo", "error", err) | ||
| 88 | } | 91 | } | ||
| 89 | 92 | ||||
| 90 | - | if err := h.chrExec.ChrootSystemctl(ctx, h.logger.LogPath(), cmd.MountPoint, "enable", "bluetooth"); err != nil { | |||
| 91 | - | h.logger.Error("Failed to enable bluetooth", "error", err) | |||
| 92 | - | result.ErrorDetail = fmt.Sprintf("Failed to enable bluetooth: %v", err) | |||
| 93 | - | return result, err | |||
| 94 | - | } | |||
| 95 | - | ||||
| 96 | // Final cleanup and verification | 93 | // Final cleanup and verification | ||
| 97 | h.logger.Info("Post-installation tasks completed") | 94 | h.logger.Info("Post-installation tasks completed") | ||
| 98 | result.Success = true | 95 | result.Success = true | ||
| @@ -100,14 +97,15 @@ func (h *PostInstallHandler) Handle(ctx context.Context, cmd commands.PostInstal | |||||
| 100 | return result, nil | 97 | return result, nil | ||
| 101 | } | 98 | } | ||
| 102 | 99 | ||||
| 103 | - | func (h *PostInstallHandler) setupPostBoot(ctx context.Context, mountPoint, username string) error { | 100 | + | func (h *PostInstallHandler) setupPostBoot(ctx context.Context, mountPoint, username, email string) error { |
| 104 | postBootPath := filepath.Join(mountPoint, "usr", "local", "share", "archup", "post-boot") | 101 | postBootPath := filepath.Join(mountPoint, "usr", "local", "share", "archup", "post-boot") | ||
| 105 | if err := h.fs.MkdirAll(postBootPath, 0755); err != nil { | 102 | if err := h.fs.MkdirAll(postBootPath, 0755); err != nil { | ||
| 106 | return fmt.Errorf("failed to create post-boot directory: %w", err) | 103 | return fmt.Errorf("failed to create post-boot directory: %w", err) | ||
| 107 | } | 104 | } | ||
| 108 | 105 | ||||
| 106 | + | // Write service file with placeholder replacement for email and username | |||
| 109 | serviceDest := filepath.Join(mountPoint, "etc", "systemd", "system", "archup-first-boot.service") | 107 | serviceDest := filepath.Join(mountPoint, "etc", "systemd", "system", "archup-first-boot.service") | ||
| 110 | - | if err := h.writeFromTemplate("install/mandatory/post-boot/archup-first-boot.service", serviceDest); err != nil { | 108 | + | if err := h.writeServiceFile("install/mandatory/post-boot/archup-first-boot.service", serviceDest, username, email); err != nil { |
| 111 | return fmt.Errorf("failed to write service file: %w", err) | 109 | return fmt.Errorf("failed to write service file: %w", err) | ||
| 112 | } | 110 | } | ||
| 113 | 111 | ||||
| @@ -208,6 +206,24 @@ func (h *PostInstallHandler) writeFromTemplate(src string, dst string) error { | |||||
| 208 | return h.fs.WriteFile(dst, content, 0644) | 206 | return h.fs.WriteFile(dst, content, 0644) | ||
| 209 | } | 207 | } | ||
| 210 | 208 | ||||
| 209 | + | // writeServiceFile writes the systemd service file with placeholder replacement | |||
| 210 | + | func (h *PostInstallHandler) writeServiceFile(src, dst, username, email string) error { | |||
| 211 | + | content, err := h.tryReadLocal(src) | |||
| 212 | + | if err != nil { | |||
| 213 | + | content, err = h.downloadTemplate(src) | |||
| 214 | + | if err != nil { | |||
| 215 | + | return err | |||
| 216 | + | } | |||
| 217 | + | } | |||
| 218 | + | ||||
| 219 | + | // Replace placeholders with actual values | |||
| 220 | + | serviceContent := string(content) | |||
| 221 | + | serviceContent = strings.ReplaceAll(serviceContent, "__ARCHUP_USERNAME__", username) | |||
| 222 | + | serviceContent = strings.ReplaceAll(serviceContent, "__ARCHUP_EMAIL__", email) | |||
| 223 | + | ||||
| 224 | + | return h.fs.WriteFile(dst, []byte(serviceContent), 0644) | |||
| 225 | + | } | |||
| 226 | + | ||||
| 211 | func (h *PostInstallHandler) tryReadLocal(path string) ([]byte, error) { | 227 | func (h *PostInstallHandler) tryReadLocal(path string) ([]byte, error) { | ||
| 212 | localPath := filepath.Join(config.DefaultInstallDir, path) | 228 | localPath := filepath.Join(config.DefaultInstallDir, path) | ||
| 213 | if exists, err := h.fs.Exists(localPath); err == nil && exists { | 229 | if exists, err := h.fs.Exists(localPath); err == nil && exists { | ||
| @@ -220,7 +236,8 @@ func (h *PostInstallHandler) tryReadLocal(path string) ([]byte, error) { | |||||
| 220 | } | 236 | } | ||
| 221 | 237 | ||||
| 222 | func (h *PostInstallHandler) downloadTemplate(path string) ([]byte, error) { | 238 | func (h *PostInstallHandler) downloadTemplate(path string) ([]byte, error) { | ||
| 223 | - | url := fmt.Sprintf("https://raw.githubusercontent.com/bnema/archup/main/%s", path) | 239 | + | url := fmt.Sprintf("%s/%s", h.rawURL, path) |
| 240 | + | h.logger.Info("Downloading template", "url", url) | |||
| 224 | resp, err := h.httpClient.Get(url) | 241 | resp, err := h.httpClient.Get(url) | ||
| 225 | if err != nil { | 242 | if err != nil { | ||
| 226 | return nil, err | 243 | return nil, err | ||
| @@ -231,7 +248,7 @@ func (h *PostInstallHandler) downloadTemplate(path string) ([]byte, error) { | |||||
| 231 | } | 248 | } | ||
| 232 | }() | 249 | }() | ||
| 233 | if resp.StatusCode() < 200 || resp.StatusCode() > 299 { | 250 | if resp.StatusCode() < 200 || resp.StatusCode() > 299 { | ||
| 234 | - | return nil, fmt.Errorf("unexpected status %d", resp.StatusCode()) | 251 | + | return nil, fmt.Errorf("unexpected status %d from %s", resp.StatusCode(), url) |
| 235 | } | 252 | } | ||
| 236 | return resp.Body(), nil | 253 | return resp.Body(), nil | ||
| 237 | } | 254 | } | ||
M internal/application/handlers/post_install_handler_test.go +4 -4
| @@ -39,7 +39,7 @@ func TestPostInstallHandler_Handle_NoScripts(t *testing.T) { | |||
| 39 | 39 | mockHTTP.EXPECT().Get(gomock.Any()).Return(newMockResponse(ctrl, http.StatusOK, []byte("content")), nil).AnyTimes() | |
| 40 | 40 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | |
| 41 | 41 | ||
| 42 | - | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger) | |
| 42 | + | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger, "https://raw.githubusercontent.com/bnema/archup/dev") | |
| 43 | 43 | ||
| 44 | 44 | cmd := commands.PostInstallCommand{ | |
| 45 | 45 | MountPoint: "/mnt", | |
| @@ -85,7 +85,7 @@ func TestPostInstallHandler_Handle_WithScripts(t *testing.T) { | |||
| 85 | 85 | mockChrExec.EXPECT().ExecuteInChroot(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, nil).AnyTimes() | |
| 86 | 86 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | |
| 87 | 87 | ||
| 88 | - | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger) | |
| 88 | + | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger, "https://raw.githubusercontent.com/bnema/archup/dev") | |
| 89 | 89 | ||
| 90 | 90 | cmd := commands.PostInstallCommand{ | |
| 91 | 91 | MountPoint: "/mnt", | |
| @@ -134,7 +134,7 @@ func TestPostInstallHandler_Handle_WithPlymouth(t *testing.T) { | |||
| 134 | 134 | mockChrExec.EXPECT().ExecuteInChroot(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, nil).AnyTimes() | |
| 135 | 135 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | |
| 136 | 136 | ||
| 137 | - | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger) | |
| 137 | + | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger, "https://raw.githubusercontent.com/bnema/archup/dev") | |
| 138 | 138 | ||
| 139 | 139 | cmd := commands.PostInstallCommand{ | |
| 140 | 140 | MountPoint: "/mnt", | |
| @@ -184,7 +184,7 @@ func TestPostInstallHandler_Handle_Everything(t *testing.T) { | |||
| 184 | 184 | mockChrExec.EXPECT().ExecuteInChroot(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, nil).AnyTimes() | |
| 185 | 185 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | |
| 186 | 186 | ||
| 187 | - | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger) | |
| 187 | + | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger, "https://raw.githubusercontent.com/bnema/archup/dev") | |
| 188 | 188 | ||
| 189 | 189 | cmd := commands.PostInstallCommand{ | |
| 190 | 190 | MountPoint: "/mnt", | |
| @@ -39,7 +39,7 @@ func TestPostInstallHandler_Handle_NoScripts(t *testing.T) { | |||||
| 39 | mockHTTP.EXPECT().Get(gomock.Any()).Return(newMockResponse(ctrl, http.StatusOK, []byte("content")), nil).AnyTimes() | 39 | mockHTTP.EXPECT().Get(gomock.Any()).Return(newMockResponse(ctrl, http.StatusOK, []byte("content")), nil).AnyTimes() | ||
| 40 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | 40 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | ||
| 41 | 41 | ||||
| 42 | - | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger) | 42 | + | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger, "https://raw.githubusercontent.com/bnema/archup/dev") |
| 43 | 43 | ||||
| 44 | cmd := commands.PostInstallCommand{ | 44 | cmd := commands.PostInstallCommand{ | ||
| 45 | MountPoint: "/mnt", | 45 | MountPoint: "/mnt", | ||
| @@ -85,7 +85,7 @@ func TestPostInstallHandler_Handle_WithScripts(t *testing.T) { | |||||
| 85 | mockChrExec.EXPECT().ExecuteInChroot(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, nil).AnyTimes() | 85 | mockChrExec.EXPECT().ExecuteInChroot(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, nil).AnyTimes() | ||
| 86 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | 86 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | ||
| 87 | 87 | ||||
| 88 | - | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger) | 88 | + | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger, "https://raw.githubusercontent.com/bnema/archup/dev") |
| 89 | 89 | ||||
| 90 | cmd := commands.PostInstallCommand{ | 90 | cmd := commands.PostInstallCommand{ | ||
| 91 | MountPoint: "/mnt", | 91 | MountPoint: "/mnt", | ||
| @@ -134,7 +134,7 @@ func TestPostInstallHandler_Handle_WithPlymouth(t *testing.T) { | |||||
| 134 | mockChrExec.EXPECT().ExecuteInChroot(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, nil).AnyTimes() | 134 | mockChrExec.EXPECT().ExecuteInChroot(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, nil).AnyTimes() | ||
| 135 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | 135 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | ||
| 136 | 136 | ||||
| 137 | - | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger) | 137 | + | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger, "https://raw.githubusercontent.com/bnema/archup/dev") |
| 138 | 138 | ||||
| 139 | cmd := commands.PostInstallCommand{ | 139 | cmd := commands.PostInstallCommand{ | ||
| 140 | MountPoint: "/mnt", | 140 | MountPoint: "/mnt", | ||
| @@ -184,7 +184,7 @@ func TestPostInstallHandler_Handle_Everything(t *testing.T) { | |||||
| 184 | mockChrExec.EXPECT().ExecuteInChroot(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, nil).AnyTimes() | 184 | mockChrExec.EXPECT().ExecuteInChroot(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, nil).AnyTimes() | ||
| 185 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | 185 | mockChrExec.EXPECT().ChrootSystemctl(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() | ||
| 186 | 186 | ||||
| 187 | - | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger) | 187 | + | handler := NewPostInstallHandler(mockFS, mockHTTP, mockChrExec, mockScriptExec, mockLogger, "https://raw.githubusercontent.com/bnema/archup/dev") |
| 188 | 188 | ||||
| 189 | cmd := commands.PostInstallCommand{ | 189 | cmd := commands.PostInstallCommand{ | ||
| 190 | MountPoint: "/mnt", | 190 | MountPoint: "/mnt", | ||