66 "path"
77
88 "github.com/FascodeNet/alterlinux/alteriso5/work/boot"
9+ "github.com/Hayao0819/nahi/cputils"
910 osutils "github.com/Hayao0819/nahi/futils"
1011)
1112
@@ -90,13 +91,34 @@ var makeCommonSystemdBootConfig *BuildTask = NewBuildTask("makeCommonSystemdBoot
9091 if err := os .MkdirAll (path .Join (workLoaderDir , "entries" ), 0755 ); err != nil {
9192 return err
9293 }
94+ profileEfibootDir := path .Join (w .profile .Base , "efiboot" )
9395
94- // cpTasks := utils.CopyTask{
96+ cpTasks := []cputils.CopyTask {
97+ {
98+ Source : path .Join (profileEfibootDir , "loader" , "loader.conf" ),
99+ Dest : path .Join (workLoaderDir , "loader.conf" ),
100+ },
101+ {
102+ Source : path .Join (profileEfibootDir , "loader" , "entries" ),
103+ Dest : path .Join (workLoaderDir , "entries" ),
104+ },
105+ }
95106
96- // }
107+ if err := cputils .CopyAll (cpTasks ... ); err != nil {
108+ return err
109+ }
97110
98111 return nil
112+ })
99113
114+ var makeCommonSystemdBootConfigIsofs * BuildTask = NewBuildTask ("makeCommonSystemdBootConfigIsofs" , func (w Work ) error {
115+ return nil
116+ })
117+
118+ var makeCommonSystemdBootConfigEsp * BuildTask = NewBuildTask ("makeCommonSystemdBootConfigEsp" , func (w Work ) error {
119+
120+ // mcopy -i "${efibootimg}" -s "${work_dir}/loader" ::/
121+ return nil
100122})
101123
102124var makeUefiX64SystemdBootEsp * BuildTask = NewBuildTask ("makeUefiX64SystemdBootEsp" , func (w Work ) error {
@@ -113,14 +135,41 @@ var makeUefiX64SystemdBootEsp *BuildTask = NewBuildTask("makeUefiX64SystemdBootE
113135 }
114136
115137 // Copy systemd-boot EFI binary to the default/fallback boot path
138+ // mcopy -i "${efibootimg}" \
139+ // "${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi" ::/EFI/BOOT/BOOTx64.EFI
116140
117141 // Copy systemd-boot configuration files
142+ if err := w .RunOnce (makeCommonSystemdBootConfigEsp ); err != nil {
143+ return err
144+ }
118145
119146 // shellx64.efi is picked up automatically when on /
120147
121148 return nil
122149})
123150
124151var makeUefiX64SystemdBootElTorito * BuildTask = NewBuildTask ("makeUefiX64SystemdBootElTorito" , func (w Work ) error {
152+ if err := w .RunOnce (makeCommonSystemdBootConfig ); err != nil {
153+ return err
154+ }
155+
156+ if err := w .RunOnce (makeUefiX64SystemdBootEsp ); err != nil {
157+ return err
158+ }
159+
160+ // Additionally set up systemd-boot in ISO 9660. This allows creating a medium for the live environment by using
161+ // manual partitioning and simply copying the ISO 9660 file system contents.
162+ // This is not related to El Torito booting and no firmware uses these files.
163+ // _msg_info "Preparing an /EFI directory for the ISO 9660 file system..."
164+ // install -d -m 0755 -- "${isofs_dir}/EFI/BOOT"
165+
166+ // Copy systemd-boot EFI binary to the default/fallback boot path
167+ // install -m 0644 -- "${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi" \
168+ // "${isofs_dir}/EFI/BOOT/BOOTx64.EFI"
169+
170+ if err := w .RunOnce (makeCommonSystemdBootConfigIsofs ); err != nil {
171+ return err
172+ }
173+
125174 return nil
126175})
0 commit comments