Skip to content

Commit 08818c3

Browse files
committed
Fix: Fix IsNotExist error on the first time start
1 parent 883f0bb commit 08818c3

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

alteriso5/cmd/build/work/airootfs/chroot.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ func GetChrootDir(dir, arch string) (*Chroot, error) {
2424

2525
entry, err := os.ReadDir(dir)
2626
if err != nil {
27-
return nil, err
28-
27+
if os.IsNotExist(err) {
28+
env.initilized = false
29+
return &env, nil
30+
} else {
31+
return nil, err
32+
}
2933
}
3034

3135
if len(entry) > 0 {
@@ -57,7 +61,7 @@ func (e *Chroot) Init() error {
5761
}
5862

5963
type kernel struct {
60-
Linux string
64+
Linux string
6165
Initrd string
6266
}
6367

@@ -88,7 +92,7 @@ func (e *Chroot) FindKernels() ([]kernel, error) {
8892

8993
if ker != "" && initrd != "" {
9094
kernels = append(kernels, kernel{
91-
Linux: ker,
95+
Linux: ker,
9296
Initrd: initrd,
9397
})
9498
}

0 commit comments

Comments
 (0)