| |
| /pliant/fullpliant/computer.page |
| |
| 1 |
module "/pliant/language/context.pli" | |
| 2 |
module "rules.pli" | |
| 3 |
module "install.pli" | |
| 4 |
module "embedded/install.pli" | |
| 5 |
module "embedded/compile.pli" | |
| 6 |
module "computer.pli" | |
| 7 |
module "debian.pli" | |
| 8 |
| |
| 9 |
module "/pliant/admin/file.pli" | |
| 10 |
module "/pliant/admin/execute.pli" | |
| 11 |
module "/pliant/protocol/dns/name.pli" | |
| 12 |
module "/pliant/linux/kernel/module.pli" | |
| 13 |
module "/pliant/linux/storage/cdrom.pli" | |
| 14 |
module "/pliant/linux/storage/partition.pli" | |
| 15 |
module "/pliant/linux/storage/filesystem.pli" | |
| 16 |
module "/pliant/linux/storage/raid.pli" | |
| 17 |
| |
| 18 |
module "/pliant/language/stream.pli" | |
| 19 |
module "/pliant/appli/forum/difference.pli" | |
| 20 |
| |
| 21 |
requires "browse_configuration" | |
| 22 |
| |
| 23 |
| |
| 24 |
title "Computers administration" | |
| 25 |
| |
| 26 |
para | |
| 27 |
link "defining computer components (for experts only)" "/pliant/fullpliant/component" | |
| 28 |
| |
| 29 |
[List of currently defined computers:] | |
| 30 |
| |
| 31 |
table columns 2 | |
| 32 |
cell header | |
| 33 |
[Computer name] | |
| 34 |
cell | |
| 35 |
void | |
| 36 |
each c computer | |
| 37 |
cell | |
| 38 |
fixed (text keyof:c) | |
| 39 |
cell | |
| 40 |
page button "Edit" | |
| 41 |
read_only not allowed:"administrator" | |
| 42 |
title "Computer '"+keyof:c+"'" | |
| 43 |
| |
| 44 |
text_input "Comments: " c:comment columns 80 rows 5 | |
| 45 |
| |
| 46 |
header "'"+keyof:c+"' definition" | |
| 47 |
| |
| 48 |
table columns 4 | |
| 49 |
cell header | |
| 50 |
[Line ID] | |
| 51 |
cell header | |
| 52 |
[Component] | |
| 53 |
cell header | |
| 54 |
[Instance] | |
| 55 |
cell header | |
| 56 |
[Extra parameters] | |
| 57 |
each cc c:content | |
| 58 |
cell | |
| 59 |
fixed (text keyof:cc) | |
| 60 |
cell | |
| 61 |
input "" cc:component length 25 | |
| 62 |
cell | |
| 63 |
input "" cc:instance length 8 | |
| 64 |
cell | |
| 65 |
if not (exists computer_database:data:component:(cc component)) | |
| 66 |
highlight "not defined" | |
| 67 |
display_variables c cc:component cc:instance | |
| 68 |
| |
| 69 |
if allowed:"administrator" | |
| 70 |
input "Line ID: " (var Str ccid) noeol | |
| 71 |
button "Add a line" noeol | |
| 72 |
c:content create ccid | |
| 73 |
reload_page | |
| 74 |
button "Remove the line" | |
| 75 |
c:content delete ccid | |
| 76 |
reload_page | |
| 77 |
| |
| 78 |
button "Update, then back to computers list" | |
| 79 |
goto_backward | |
| 80 |
| |
| 81 |
header "Prepare '"+keyof:c+"'" | |
| 82 |
| |
| 83 |
button "Upgrade Debian packages list" noeol | |
| 84 |
if allowed:"administrator" | |
| 85 |
[Are you sure that you want to download load new lists of Packages ? ] | |
| 86 |
button "yes" noeol | |
| 87 |
if debian_upgrade:c=success | |
| 88 |
goto_backward | |
| 89 |
else | |
| 90 |
[Failed to download the new Packages list.] | |
| 91 |
button "no" | |
| 92 |
goto_backward | |
| 93 |
else | |
| 94 |
[Only the administrator can do that !] | |
| 95 |
button "Check for software updates" noeol | |
| 96 |
if allowed:"administrator" | |
| 97 |
each sw c:env:"software" | |
| 98 |
console "check " keyof:sw | |
| 99 |
var Str v := sw "version" | |
| 100 |
if ((v (v search_last "." -1)+1 v:len) parse (var Int index)) and (sw:"download" search "*" -1)<>(-1) | |
| 101 |
var Str ok := v | |
| 102 |
part try_next_release | |
| 103 |
index += 1 | |
| 104 |
v := (v 0 (v search_last "." -1)+1)+string:index | |
| 105 |
var Str url := replace sw:"download" "*" v | |
| 106 |
(var Stream test) open url in+safe | |
| 107 |
if test=success | |
| 108 |
console " yes" | |
| 109 |
ok := v | |
| 110 |
restart try_next_release | |
| 111 |
console eol | |
| 112 |
if ok<>sw:"version" | |
| 113 |
text keyof:sw+" can be upgraded from "+sw:"version"+" to "+ok ; eol | |
| 114 |
else | |
| 115 |
[Only the administrator can do that !] | |
| 116 |
button "Download packages" | |
| 117 |
if allowed:"administrator" | |
| 118 |
var Status status := success | |
| 119 |
if (debian_download c false)=failure | |
| 120 |
[Failed to download some packages.] | |
| 121 |
status := failure | |
| 122 |
if embedded_download:c=failure | |
| 123 |
[Failed to download some applications.] | |
| 124 |
status := failure | |
| 125 |
if status=success | |
| 126 |
reload_page | |
| 127 |
else | |
| 128 |
[Only the administrator can do that !] | |
| 129 |
button "Reset and compute settings" noeol | |
| 130 |
if allowed:"administrator" | |
| 131 |
[Are you sure that you want to reset settings ? ] | |
| 132 |
button "yes" noeol | |
| 133 |
c compute true "file:/tmp/rules.log" | |
| 134 |
goto_backward | |
| 135 |
button "no" | |
| 136 |
goto_backward | |
| 137 |
[It's generally no problem to reset settings, but if you had forced some settings in the computer definition input fields, then you will have to redo since the default values will be restored.] | |
| 138 |
else | |
| 139 |
[Only the administrator can do that !] | |
| 140 |
button "Recompute settings" | |
| 141 |
if allowed:"administrator" | |
| 142 |
var ExtendedStatus status := c compute false "file:/tmp/rules.log" | |
| 143 |
if status=success | |
| 144 |
reload_page | |
| 145 |
else | |
| 146 |
[Failed to compute computer settings:] ; eol | |
| 147 |
fixed (text status:message) | |
| 148 |
else | |
| 149 |
[Only the administrator can do that !] | |
| 150 |
| |
| 151 |
button "Display settings" noeol | |
| 152 |
title "Computer '"+keyof:c+"' settings" | |
| 153 |
each category c:env | |
| 154 |
header keyof:category | |
| 155 |
each instance category | |
| 156 |
para | |
| 157 |
bold (text keyof:instance) ; eol | |
| 158 |
each id instance | |
| 159 |
italic (text keyof:id+":") ; fixed (text " "+id) ; eol | |
| 160 |
button "Smart display kernel settings" noeol | |
| 161 |
display_kernel_settings c | |
| 162 |
button "Display raw settings database" | |
| 163 |
var Str temp := file_temporary | |
| 164 |
var (Link Database:Computer) target_database :> new Database:Computer | |
| 165 |
target_database load temp | |
| 166 |
data_copy c target_database:data | |
| 167 |
target_database store | |
| 168 |
data_store | |
| 169 |
reset_http_answer | |
| 170 |
http_request send_static_file temp "mime [dq]text/plain[dq]" | |
| 171 |
file_delete temp | |
| 172 |
| |
| 173 |
var Str name := keyof c ; name := name 0 (name search "." name:len) | |
| 174 |
| |
| 175 |
header "Build an install medium for '"+keyof:c+"'" | |
| 176 |
| |
| 177 |
if c:env:"pliant":"system":"medium"="cdrom" | |
| 178 |
| |
| 179 |
page button "Engrave a recovery CD" | |
| 180 |
if c:env:"partition":"root":"device"="" | |
| 181 |
[You cannot engrave the CD without a root partition defined, specifying the CD device.] | |
| 182 |
eif allowed:"administrator" | |
| 183 |
title "Engrave a recovery CD" | |
| 184 |
table columns 4 border 0 | |
| 185 |
cell | |
| 186 |
highlight "warning:" | |
| 187 |
cell | |
| 188 |
[Selecting yes will eraze your] ; eol | |
| 189 |
cell | |
| 190 |
fixed [file:/usr/src/linux/] ; eol | |
| 191 |
fixed [file:/usr/src/pcmcia-cs/] ; eol | |
| 192 |
fixed [file:/usr/src/alsa-driver-xxx/] ; eol | |
| 193 |
fixed [file:/mnt/target/] ; eol | |
| 194 |
cell | |
| 195 |
[directories.] | |
| 196 |
input "Name of the computers you want to recover from the CD: " (var Str target_names) length 40 | |
| 197 |
select "Kind of CD: " (var Str rw) | |
| 198 |
option "Write only" "" | |
| 199 |
option "Read write" " rw" | |
| 200 |
option "store image to embedded:/tmp/recover.cd" "store" | |
| 201 |
var Bool isolinux := true | |
| 202 |
select "CD boot loader: " isolinux | |
| 203 |
option "isolinux" "true" | |
| 204 |
option "GRUB" "false" | |
| 205 |
[Do you really want to engrave the CD ? ] | |
| 206 |
page button "yes" noeol | |
| 207 |
part engrave_cd | |
| 208 |
var Str all := target_names | |
| 209 |
while all<>"" | |
| 210 |
if not (all parse any:(var Str first) _ any:(var Str remain)) | |
| 211 |
first := all ; remain := "" | |
| 212 |
if (file_query "file:/fullpliant/archive/"+first+".tgz" standard)=failure | |
| 213 |
if not (exists computer:first) | |
| 214 |
text "There is no '"+first+"' in the database !" | |
| 215 |
else | |
| 216 |
text "The target system archive for '"+first+"' is not built yet !" | |
| 217 |
leave engrave_cd | |
| 218 |
all := remain | |
| 219 |
var ExtendedStatus status := install_tree c "file:/mnt/target/" "generate_site_key" | |
| 220 |
if status=success | |
| 221 |
var Str all := target_names | |
| 222 |
while all<>"" | |
| 223 |
if not (all parse any:(var Str first) _ any:(var Str remain)) | |
| 224 |
first := all ; remain := "" | |
| 225 |
file_copy "file:/fullpliant/archive/"+first+".tgz" "file:/mnt/target/fullpliant/archive/"+first+".tgz" | |
| 226 |
var Str embedded := computer:first:env:"pliant":"system":"embedded" | |
| 227 |
if embedded<>"" | |
| 228 |
file_copy "file:/fullpliant/archive/embedded/"+embedded+".tgz" "file:/mnt/target/fullpliant/archive/embedded/"+embedded+".tgz" extended+lazy | |
| 229 |
each partition computer:first:env:"partition" | |
| 230 |
if partition:"disk_image"<>"" | |
| 231 |
file_copy "file:/fullpliant/archive/partition/"+partition:"disk_image"+".gz" "file:/mnt/target/fullpliant/archive/partition/"+partition:"disk_image"+".gz" extended+lazy | |
| 232 |
all := remain | |
| 233 |
if false | |
| 234 |
console "Building CD the embedded boot floppy" eol | |
| 235 |
status := install_floppy c "file:/mnt/target/boot/floppy" c:env:"partition":"root":"device" "" | |
| 236 |
else | |
| 237 |
status := success | |
| 238 |
if status=success | |
| 239 |
var Str boot := "boot [dq]boot/floppy[dq]" | |
| 240 |
if isolinux | |
| 241 |
(var Stream cfg) open "file:/mnt/target/boot/isolinux/isolinux.cfg" out+safe | |
| 242 |
# cfg writeline "default /boot/kernel root="+(file_os_name c:env:"partition":"root":"device") | |
| 243 |
cfg writeline "default /boot/kernel initrd=/boot/initrd.img root=/dev/ram0" | |
| 244 |
cfg close | |
| 245 |
boot := "boot [dq]boot/isolinux/isolinux.bin[dq] mkisofs_extra_options [dq]-c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table[dq]" | |
| 246 |
else | |
| 247 |
(var Stream cfg) open "file:/mnt/target/boot/grub/menu.lst" out+safe | |
| 248 |
cfg writeline "timeout 2" | |
| 249 |
cfg writeline "title FullPliant" | |
| 250 |
cfg writeline "kernel /boot/kernel root="+(file_os_name c:env:"partition":"root":"device") | |
| 251 |
cfg close | |
| 252 |
boot := "boot [dq]boot/grub/stage2_eltorito[dq] mkisofs_extra_options [dq]-c boot/grub/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table[dq]" | |
| 253 |
if rw="store" | |
| 254 |
console "storing CD image" eol | |
| 255 |
status := cdrom_image (var List:FileInfo empty_list) "path [dq]file:/mnt/target/[dq] title [dq]pliant_cdrom[dq] "+boot "embedded:/tmp/recover.cd" | |
| 256 |
else | |
| 257 |
console "Engraving the CD" eol | |
| 258 |
status := cdrom_engrave "file:/mnt/target/" "title [dq]pliant_cdrom[dq] "+boot+rw+" indirect" | |
| 259 |
file_tree_delete "file:/mnt/target/" | |
| 260 |
console "done." eol | |
| 261 |
if status=success | |
| 262 |
goto_backward | |
| 263 |
else | |
| 264 |
text "failed: "+status:message | |
| 265 |
else | |
| 266 |
console "failed." eol | |
| 267 |
[Failed to engrave the bootable CD for ] ; text keyof:c ; eol | |
| 268 |
[Error message is: ] ; eol | |
| 269 |
fixed (text status:message) | |
| 270 |
button "no" | |
| 271 |
goto_backward | |
| 272 |
else | |
| 273 |
[Only the administrator can do that !] | |
| 274 |
| |
| 275 |
if c:env:"pliant":"system":"medium"="usb" | |
| 276 |
| |
| 277 |
page button "Build the bootable USB key" noeol | |
| 278 |
if allowed:"administrator" | |
| 279 |
var Str device | |
| 280 |
part scan | |
| 281 |
for (var Int i) 7 0 step -1 | |
| 282 |
device := "device:/sd"+(character "a":number+i) | |
| 283 |
if filesystem_bus:device="usb" | |
| 284 |
leave scan | |
| 285 |
[Could not find USB key device.] | |
| 286 |
return | |
| 287 |
title "Build a bootable USB key" | |
| 288 |
table columns 1 border 0 | |
| 289 |
cell color (color hsl 0 50 75) | |
| 290 |
text "This will eraze all your datas on "+device+" device, so you should absolutely not do that if it is one of your SCSI or SATA disks." | |
| 291 |
table columns 4 border 0 | |
| 292 |
cell | |
| 293 |
highlight "warning:" | |
| 294 |
cell | |
| 295 |
[Selecting yes will eraze your] ; eol | |
| 296 |
cell | |
| 297 |
fixed [embedded:/usr/src/linux/] ; eol | |
| 298 |
fixed [embedded:/usr/src/pcmcia-cs/] ; eol | |
| 299 |
fixed [embedded:/usr/src/alsa-driver-xxx/] ; eol | |
| 300 |
fixed (text "embedded:/export/diskless/"+name+"/") ; eol | |
| 301 |
cell | |
| 302 |
[directories.] | |
| 303 |
if (file_query "file:/fullpliant/archive/"+keyof:c+".tgz" standard)=success or (c:env:"pliant":"http":"site_key_bits" parse (var Int bits)) | |
| 304 |
var Str key := shunt (file_query "file:/fullpliant/archive/"+keyof:c+".tgz" standard)=success "keep_site_key" "generate_site_key" | |
| 305 |
select "What about the site key ? " (var Str key) | |
| 306 |
option "do nothing" "" | |
| 307 |
if key="keep_site_key" | |
| 308 |
option "keep existing one" "keep_site_key" | |
| 309 |
option "generate a new one" "generate_site_key" | |
| 310 |
input "USB key device: " device | |
| 311 |
var Str format := "yes" | |
| 312 |
select "Do you want to format USB key: " (var Str format) | |
| 313 |
option "yes" "yes" | |
| 314 |
option "no" "no" | |
| 315 |
[Do you really want to build the USB key] | |
| 316 |
page button "yes" noeol | |
| 317 |
kernel_load_module "scsi_mod" | |
| 318 |
kernel_load_module "sd_mod" | |
| 319 |
kernel_load_module "uscore" | |
| 320 |
kernel_load_module "usb-uhci" # 2.4 | |
| 321 |
kernel_load_module "usb-ohci" # 2.4 | |
| 322 |
kernel_load_module "ehci-hcd" # 2.4 | |
| 323 |
kernel_load_module "uhci_hcd" # 2.6 | |
| 324 |
kernel_load_module "ohci_hcd" # 2.6 | |
| 325 |
kernel_load_module "ehci_hcd" # 2.6 | |
| 326 |
kernel_load_module "usb-storage" # 2.4 | |
| 327 |
kernel_load_module "usb_storage" # 2.6 | |
| 328 |
sleep 1 | |
| 329 |
if format="yes" | |
| 330 |
partition_format device "ext2" "name [dq]pliant_usb[dq]" | |
| 331 |
var ExtendedStatus status := filesystem_mount device "file:/mnt/target/" "" | |
| 332 |
if status=success | |
| 333 |
status := install_tree c "file:/mnt/target/" key | |
| 334 |
if status=success | |
| 335 |
update_rights c "file:/mnt/target/" | |
| 336 |
status := lilo_install c "file:/mnt/target/" device c:env:"partition":"root":"device" c:env:"kernel":"constant":"options" "" | |
| 337 |
filesystem_dismount "file:/mnt/target/" | |
| 338 |
if status=success | |
| 339 |
goto_backward | |
| 340 |
else | |
| 341 |
[Failed to record USB key] ; eol | |
| 342 |
[Error message is: ] ; eol | |
| 343 |
fixed (text status:message) | |
| 344 |
button "no" | |
| 345 |
goto_backward | |
| 346 |
else | |
| 347 |
[Only the administrator can do that !] | |
| 348 |
button "and the boot floppy" | |
| 349 |
if allowed:"administrator" | |
| 350 |
title "Build the boot floppy for '"+keyof:c+"'" | |
| 351 |
para | |
| 352 |
[Please insert a floppy in this computer drive, then clic on the button.] ; eol | |
| 353 |
para | |
| 354 |
highlight "warning: " ; [The floppy content will be erased.] ; eol | |
| 355 |
select "Mode: " (var Str mode) | |
| 356 |
option "Physical floppy" "physical" | |
| 357 |
option "store image to embedded:/tmp/floppy.dd" "store" | |
| 358 |
button "Build the floppy" | |
| 359 |
var ExtendedStatus status := install_floppy c (shunt mode="store" "embedded:/tmp/floppy.dd" "device:/fd0") "device:/sda" "" | |
| 360 |
if status=success | |
| 361 |
goto_backward | |
| 362 |
else | |
| 363 |
[Failed to build the boot floppy for ] ; text keyof:c | |
| 364 |
para | |
| 365 |
fixed (text status:message) | |
| 366 |
else | |
| 367 |
[Only the administrator can do that !] | |
| 368 |
| |
| 369 |
if c:env:"pliant":"system":"medium"="nfs" | |
| 370 |
| |
| 371 |
button "Build the tree for installing through NFS" noeol | |
| 372 |
if allowed:"administrator" | |
| 373 |
title "Build the tree for installing '"+name+"' through NFS" | |
| 374 |
table columns 4 border 0 | |
| 375 |
cell | |
| 376 |
highlight "warning:" | |
| 377 |
cell | |
| 378 |
[Selecting yes will eraze your] ; eol | |
| 379 |
cell | |
| 380 |
fixed [embedded:/usr/src/linux/] ; eol | |
| 381 |
fixed [embedded:/usr/src/pcmcia-cs/] ; eol | |
| 382 |
fixed [embedded:/usr/src/alsa-driver-xxx/] ; eol | |
| 383 |
fixed (text "embedded:/export/diskless/"+name+"/") ; eol | |
| 384 |
cell | |
| 385 |
[directories.] | |
| 386 |
input "Name of the computer you want to install through NFS root: " (var Str target_name) | |
| 387 |
[Do you really want to build the] ; fixed (text " embedded:/export/diskless/"+name+"/ ") ; [tree ? ] | |
| 388 |
button "yes" noeol | |
| 389 |
var ExtendedStatus status := install_tree c "embedded:/export/diskless/"+name+"/" "" | |
| 390 |
if status=success | |
| 391 |
if target_name<>"" | |
| 392 |
file_copy "file:/fullpliant/archive/"+target_name+".tgz" "embedded:/export/diskless/"+name+"/fullpliant/archive/"+target_name+".tgz" | |
| 393 |
var Str embedded := computer:target_name:env:"pliant":"system":"embedded" | |
| 394 |
if embedded<>"" | |
| 395 |
file_copy "file:/fullpliant/archive/embedded/"+embedded+".tgz" "embedded:/export/diskless/"+name+"/fullpliant/archive/embedded/"+embedded+".tgz" | |
| 396 |
goto_backward | |
| 397 |
else | |
| 398 |
[Failed to build the NFS root tree for ] ; text keyof:c ; eol | |
| 399 |
[Error message is: ] ; eol | |
| 400 |
fixed (text status:message) | |
| 401 |
button "no" | |
| 402 |
goto_backward | |
| 403 |
else | |
| 404 |
[Only the administrator can do that !] | |
| 405 |
| |
| 406 |
button "and the boot floppy" | |
| 407 |
if allowed:"administrator" | |
| 408 |
title "Build the boot floppy for '"+keyof:c+"'" | |
| 409 |
var Str client_ip := name_ip keyof:c | |
| 410 |
input "IP address of the target computer: " client_ip | |
| 411 |
var Str server_ip := name_ip computer_fullname | |
| 412 |
input "IP address of the NFS server: " server_ip | |
| 413 |
var Str net_mask := name_mask keyof:c | |
| 414 |
input "Net mask: " net_mask | |
| 415 |
para | |
| 416 |
[Please insert a floppy in this computer drive, then clic on the button.] ; eol | |
| 417 |
para | |
| 418 |
highlight "warning: " ; [The floppy content will be erased.] ; eol | |
| 419 |
button "Build the floppy" | |
| 420 |
var Str options := "rw nfsroot=/export/diskless/"+name | |
| 421 |
options += " ip="+client_ip+":"+server_ip+"::"+net_mask+":"+name+":eth0" | |
| 422 |
var ExtendedStatus status := install_floppy c "device:/fd0" "device:/nfs" options | |
| 423 |
if status=success | |
| 424 |
goto_backward | |
| 425 |
else | |
| 426 |
[Failed to build the boot floppy for ] ; text keyof:c | |
| 427 |
para | |
| 428 |
fixed (text status:message) | |
| 429 |
else | |
| 430 |
[Only the administrator can do that !] | |
| 431 |
| |
| 432 |
button "Build the target system archive" noeol | |
| 433 |
if allowed:"administrator" | |
| 434 |
var Str distrib := c:env:"pliant":"system":"distribution" | |
| 435 |
title "Build file:/fullpliant/archive/"+keyof:c+".tgz" | |
| 436 |
table columns 4 border 0 | |
| 437 |
cell | |
| 438 |
highlight "warning:" | |
| 439 |
cell | |
| 440 |
[Selecting yes will eraze your] ; eol | |
| 441 |
cell | |
| 442 |
fixed [file:/usr/src/linux/] ; eol | |
| 443 |
fixed [file:/usr/src/pcmcia-cs/] ; eol | |
| 444 |
fixed [file:/usr/src/alsa-driver-xxx/] ; eol | |
| 445 |
fixed [file:/mnt/target/] ; eol | |
| 446 |
cell | |
| 447 |
[directories.] | |
| 448 |
if (file_query "file:/fullpliant/archive/"+keyof:c+".tgz" standard)=success or (c:env:"pliant":"http":"site_key_bits" parse (var Int bits)) | |
| 449 |
var Str key := shunt (file_query "file:/fullpliant/archive/"+keyof:c+".tgz" standard)=success "keep_site_key" "" | |
| 450 |
select "What about the site key ? " (var Str key) | |
| 451 |
option "do nothing" "" | |
| 452 |
if key="keep_site_key" | |
| 453 |
option "keep existing one" "keep_site_key" | |
| 454 |
option "generate a new one" "generate_site_key" | |
| 455 |
var Str embedded := c:env:"pliant":"system":"embedded" | |
| 456 |
var Str keep_emb := shunt embedded<>"" and (file_query "file:/fullpliant/archive/embedded/"+embedded+".tgz" standard)=success "yes" "no" | |
| 457 |
if keep_emb="yes" | |
| 458 |
select "Do you want to keep the old embedded computer ? " keep_emb | |
| 459 |
option "yes" "yes" | |
| 460 |
option "no" "no" | |
| 461 |
[Do you really want to build the system archive in] ; fixed [ file:/fullpliant/archive/ ] ; [? ] | |
| 462 |
button "yes" noeol | |
| 463 |
var ExtendedStatus status := install_tree c "file:/mnt/target/" key | |
| 464 |
if status=success | |
| 465 |
file_tree_create "file:/fullpliant/archive/" | |
| 466 |
execute "tar -zc -f "+(file_os_name "file:/fullpliant/archive/"+keyof:c+".tgz")+" ." path "file:/mnt/target/" | |
| 467 |
file_tree_delete "file:/mnt/target/" | |
| 468 |
if embedded<>"" | |
| 469 |
if keep_emb<>"yes" or (file_query "file:/fullpliant/archive/embedded/"+embedded+".tgz" standard)=undefined | |
| 470 |
console "Building the embedded system." eol | |
| 471 |
embedded_install c "file:/mnt/target/" | |
| 472 |
file_tree_create "file:/fullpliant/archive/embedded/" | |
| 473 |
console "Recording the embedded system archive." eol | |
| 474 |
execute "tar -zc -f "+(file_os_name "file:/fullpliant/archive/embedded/"+embedded+".tgz")+" ." path "file:/mnt/target/" | |
| 475 |
file_tree_delete "file:/mnt/target/" | |
| 476 |
goto_backward | |
| 477 |
else | |
| 478 |
[Failed to build the target system archive for ] ; text keyof:c ; eol | |
| 479 |
[Error message is:] ; eol | |
| 480 |
fixed (text status:message) | |
| 481 |
button "no" | |
| 482 |
goto_backward | |
| 483 |
else | |
| 484 |
[Only the administrator can do that !] | |
| 485 |
| |
| 486 |
button "Removed all precompiled computers" | |
| 487 |
if allowed:"administrator" | |
| 488 |
table columns 4 border 0 | |
| 489 |
cell | |
| 490 |
highlight "warning:" | |
| 491 |
cell | |
| 492 |
[Selecting yes will eraze your] ; eol | |
| 493 |
cell | |
| 494 |
fixed [embedded:/usr/src/linux/] ; eol | |
| 495 |
fixed [embedded:/export/diskless/] ; eol | |
| 496 |
fixed [embedded:/mnt/target/] ; eol | |
| 497 |
fixed [file:/fullpliant/archive/] ; eol | |
| 498 |
fixed [file:/fullpliant/kernel/bin/] ; eol | |
| 499 |
fixed [file:/fullpliant/unix/bin/] ; eol | |
| 500 |
cell | |
| 501 |
[directories.] | |
| 502 |
[Are you sure that you want to remove all precompiled computers ? ] | |
| 503 |
button "yes" noeol | |
| 504 |
file_tree_delete "embedded:/usr/src/linux/" | |
| 505 |
file_tree_delete "embedded:/export/diskless/" | |
| 506 |
file_tree_delete "embedded:/mnt/target/" | |
| 507 |
file_tree_delete "file:/fullpliant/archive/" | |
| 508 |
file_tree_delete "file:/fullpliant/kernel/bin/" | |
| 509 |
file_tree_delete "file:/fullpliant/unix/bin/" | |
| 510 |
goto_backward | |
| 511 |
button "no" | |
| 512 |
goto_backward | |
| 513 |
else | |
| 514 |
[Only the administrator can do that !] | |
| 515 |
| |
| 516 |
if allowed:"administrator" and c:env:"pliant":"system":"embedded"<>"" | |
| 517 |
button "Manually compile embedded applications" | |
| 518 |
title "Embedded applications" | |
| 519 |
para | |
| 520 |
[All emmbedded applications should be compiled automatically. ] | |
| 521 |
[This page is provided so that, in case of trouble, you can manually compile one without all others, and it is usefull only because since most applications are C and C++, compiling is very long.] | |
| 522 |
var CBool unpacked := (file_list "embedded:/mnt/target/" standard+directories):size<>0 | |
| 523 |
para | |
| 524 |
if unpacked | |
| 525 |
button "Reunpack embedded computer" | |
| 526 |
var Str embedded := c:env:"pliant":"system":"embedded" | |
| 527 |
title "Reunpacking embedded computer" | |
| 528 |
table columns 4 border 0 | |
| 529 |
cell | |
| 530 |
highlight "warning:" | |
| 531 |
cell | |
| 532 |
[Selecting yes will eraze your] ; eol | |
| 533 |
cell | |
| 534 |
fixed [embedded:/mnt/target/] ; eol | |
| 535 |
cell | |
| 536 |
[directories.] | |
| 537 |
[Are you sure that you want to reunpack the embedded computer ? ] | |
| 538 |
button "yes" noeol | |
| 539 |
file_tree_delete "embedded:/mnt/target/" | |
| 540 |
file_extract "file:/fullpliant/archive/embedded/"+embedded+".tgz" "embedded:/mnt/target/" | |
| 541 |
goto_backward | |
| 542 |
button "no" | |
| 543 |
goto_backward | |
| 544 |
button "Repack embedded computer" | |
| 545 |
var Str embedded := c:env:"pliant":"system":"embedded" | |
| 546 |
title "Repacking embedded computer" | |
| 547 |
para | |
| 548 |
[Repacking the embedded compter will replace the packed embedded computer in] | |
| 549 |
fixed (text " file:/fullpliant/archive/embedded/"+embedded+".tgz ") | |
| 550 |
[with the tree in] ; fixed [ embedded:/mnt/target/] ; eol | |
| 551 |
[Are you sure that you want to repack the embedded computer ? ] | |
| 552 |
button "yes" noeol | |
| 553 |
file_tree_delete "embedded:/mnt/target/usr/src/" | |
| 554 |
file_tree_create "embedded:/mnt/target/usr/src/" | |
| 555 |
execute "tar -zc -f "+(file_os_name "file:/fullpliant/archive/embedded/"+embedded+".tgz")+" ." path "embedded:/mnt/target/" | |
| 556 |
file_tree_delete "embedded:/mnt/target/" | |
| 557 |
goto_backward | |
| 558 |
button "no" | |
| 559 |
goto_backward | |
| 560 |
else | |
| 561 |
highlight "warning: " ; [Embedded computer is currently not unpacked, so you cannot try to compile applications.] ; eol | |
| 562 |
button "Unpack embedded computer" | |
| 563 |
var Str embedded := c:env:"pliant":"system":"embedded" | |
| 564 |
file_extract "file:/fullpliant/archive/embedded/"+embedded+".tgz" "embedded:/mnt/target/" | |
| 565 |
reload_page | |
| 566 |
table columns 3 | |
| 567 |
cell header [Application] | |
| 568 |
cell header [Status] | |
| 569 |
cell void | |
| 570 |
var Int done := 0 ; var Int total := 0 | |
| 571 |
each sw c:env:"software" | |
| 572 |
cell (text keyof:sw) | |
| 573 |
cell (text sw:"status") | |
| 574 |
cell | |
| 575 |
if unpacked | |
| 576 |
button "compile" | |
| 577 |
embedded_force_compile c keyof:sw "embedded:/mnt/target/" | |
| 578 |
reload_page | |
| 579 |
if sw:"status"="success" | |
| 580 |
done += 1 | |
| 581 |
total += 1 | |
| 582 |
para | |
| 583 |
text string:done+"/"+string:total+" already compiled packages[lf]" | |
| 584 |
if unpacked and done<total | |
| 585 |
button (shunt total-done>1 "try to compile the "+(string total-done)+" remaining packages" "try to compile the single remaining package") | |
| 586 |
embedded_force_compile c "" "embedded:/mnt/target/" | |
| 587 |
reload_page | |
| 588 |
para | |
| 589 |
[Last compile report:] ; eol | |
| 590 |
(var Stream log) open "file:/tmp/compile.log" in+safe | |
| 591 |
fixed | |
| 592 |
while not log:atend | |
| 593 |
text log:readline ; eol | |
| 594 |
para | |
| 595 |
link "more detailed report" "/pliant/browse/system_file/tmp/compile2.log" options "view" | |
| 596 |
| |
| 597 |
var Str kernel_file := "file:/fullpliant/kernel/bin/kernel-"+c:env:"kernel":"constant":"linux_version"+"-"+c:env:"kernel":"constant":"signature"+".tgz" | |
| 598 |
if allowed:"administrator" | |
| 599 |
if (file_query kernel_file standard)=defined | |
| 600 |
link "kernel.tgz" "computer/"+keyof:c+"/kernel.tgz" ; fixed [ ] | |
| 601 |
if (file_query "file:/fullpliant/archive/"+keyof:c+".tgz" standard)=defined | |
| 602 |
link "fullpliant.tgz" "computer/"+keyof:c+"/fullpliant.tgz" ; fixed [ ] | |
| 603 |
if c:env:"pliant":"system":"embedded"<>"" and (file_query "file:/fullpliant/archive/embedded/"+c:env:"pliant":"system":"embedded"+".tgz" standard)=defined | |
| 604 |
link c:env:"pliant":"system":"embedded"+".tgz" "computer/"+keyof:c+"/"+c:env:"pliant":"system":"embedded"+".tgz" ; fixed [ ] | |
| 605 |
link keyof:c "http://"+keyof:c+"/pliant/browse/system_file/boot/" | |
| 606 |
| |
| 607 |
header "Install '"+keyof:c+"'" | |
| 608 |
| |
| 609 |
if (file_query "file:/proc/mdstat" standard)=success | |
| 610 |
button "Stop RAID" noeol | |
| 611 |
if allowed:"administrator" | |
| 612 |
var CBool noraidtab := (file_query "file:/etc/raidtab" standard)=failure | |
| 613 |
if noraidtab | |
| 614 |
(var Stream raidtab) open "file:/etc/raidtab" out+mkdir+safe | |
| 615 |
raidtab close | |
| 616 |
for (var Int i) 0 15 | |
| 617 |
execute "raidstop /dev/md"+string:i quiet | |
| 618 |
if noraidtab | |
| 619 |
file_delete "file:/etc/raidtab" | |
| 620 |
file_delete "file:/etc/" | |
| 621 |
reload_page | |
| 622 |
else | |
| 623 |
[Only the administrator can do that !] | |
| 624 |
| |
| 625 |
enumerate_partitions c (var Dictionary partitions) (var Dictionary disks) | |
| 626 |
each d disks type Str | |
| 627 |
var Str disk := d | |
| 628 |
button "Partition "+disk+" disk" noeol | |
| 629 |
if allowed:"administrator" | |
| 630 |
title "Partitioning "+disk | |
| 631 |
table columns 1 border 0 | |
| 632 |
cell color (color hsl 0 50 75) | |
| 633 |
[This will eraze all your datas on disk] ; fixed (text " "+disk) | |
| 634 |
[Are you sure you want to do that ? ] | |
| 635 |
button "yes" noeol | |
| 636 |
install_partition c disk | |
| 637 |
goto_backward | |
| 638 |
button "no" | |
| 639 |
goto_backward | |
| 640 |
else | |
| 641 |
[Only the administrator can do that !] | |
| 642 |
eol | |
| 643 |
each p partitions type DiskPartition | |
| 644 |
var Str partition := p name | |
| 645 |
var Str device := p device | |
| 646 |
var Str devices := p raid_devices | |
| 647 |
if partition<>"" and p:filesystem<>"raid" | |
| 648 |
button "Format "+partition+" partition" noeol | |
| 649 |
if allowed:"administrator" | |
| 650 |
title "Formating "+partition+" partition" | |
| 651 |
table columns 1 border 0 | |
| 652 |
cell color (color hsl 0 50 75) | |
| 653 |
[This will eraze all your datas on the] ; fixed (text " "+device+" ") ; [ partition] | |
| 654 |
if devices<>"" | |
| 655 |
eol ; [and also on the] ; fixed (text " "+devices+" ") ; [partitions.] | |
| 656 |
[Are you sure you want to do that ? ] | |
| 657 |
button "yes" noeol | |
| 658 |
install_format c partition | |
| 659 |
goto_backward | |
| 660 |
button "no" | |
| 661 |
goto_backward | |
| 662 |
else | |
| 663 |
[Only the administrator can do that !] | |
| 664 |
eol | |
| 665 |
button "Install the system" | |
| 666 |
if allowed:"administrator" | |
| 667 |
var Str root := c:env:"partition":"root":"device" | |
| 668 |
var Str distrib := c:env:"pliant":"system":"distribution" | |
| 669 |
if (file_query "file:/fullpliant/archive/"+keyof:c+".tgz" standard)=defined | |
| 670 |
title "Installing the system" | |
| 671 |
[Install the ] ; text distrib ; [ system on ] ; input "" root noeol ; [ partition.] ; eol | |
| 672 |
var Str embedded := c:env:"pliant":"system":"embedded" | |
| 673 |
if embedded<>"" | |
| 674 |
select "Do you want to install the embedded computer also: " embedded | |
| 675 |
option "yes" embedded | |
| 676 |
option "no" "" | |
| 677 |
[Do you really want to do it now ? ] | |
| 678 |
button "yes" noeol | |
| 679 |
if (filesystem_mount root "file:/mnt/target/" "")=success | |
| 680 |
var Status status := success | |
| 681 |
if embedded<>"" | |
| 682 |
if (file_extract "file:/fullpliant/archive/embedded/"+embedded+".tgz" "file:/mnt/target/"+embedded+"/")=failure | |
| 683 |
status := failure | |
| 684 |
if (file_extract "file:/fullpliant/archive/"+keyof:c+".tgz" "file:/mnt/target/")=failure | |
| 685 |
status := failure | |
| 686 |
filesystem_dismount "file:/mnt/target/" | |
| 687 |
if status=success | |
| 688 |
goto_backward | |
| 689 |
else | |
| 690 |
[Failed to extract some files.] | |
| 691 |
else | |
| 692 |
text "Failed to mount "+root+" partition." | |
| 693 |
button "no" | |
| 694 |
goto_backward | |
| 695 |
else | |
| 696 |
[The image of the system is not available in file:/fullpliant/archive/] | |
| 697 |
else | |
| 698 |
[Only the administrator can do that !] | |
| 699 |
| |
| 700 |
button "Make the new system bootable" | |
| 701 |
if allowed:"administrator" | |
| 702 |
var Str root := c:env:"partition":"root":"device" | |
| 703 |
var Str distrib := c:env:"pliant":"system":"distribution" | |
| 704 |
title "Make the system bootable" | |
| 705 |
para | |
| 706 |
var Str sroot := root | |
| 707 |
[The ] ; text distrib ; [ system is installed on ] ; input "" sroot noeol ; [ partition.] | |
| 708 |
para | |
| 709 |
var Str lbd := "device:/hda" | |
| 710 |
var Str raid := c:env:"partition":"root":"raid_devices" | |
| 711 |
if (root parse "device:/sd" any) or (root parse "device:/md" any) and ((raid parse "device:/sd" any) or (raid parse "sd" any)) | |
| 712 |
lbd := "device:/sda" | |
| 713 |
var Str boot := c:env:"hardware":"disk":"boot" | |
| 714 |
if boot<>"" | |
| 715 |
lbd := boot | |
| 716 |
input "Lilo boot drive: " lbd | |
| 717 |
var Str geometry := "lba32" | |
| 718 |
select "Lilo drive access mode: " geometry | |
| 719 |
option "auto select" "" | |
| 720 |
option "32 bits linear" "lba32" | |
| 721 |
option "24 bits linear" "linear" | |
| 722 |
option "old bios mode" "chs" | |
| 723 |
para | |
| 724 |
var Str gbd := "hd0" | |
| 725 |
input "GRUB boot drive: " gbd | |
| 726 |
var Str gbp := "hd0,0" | |
| 727 |
input "GRUB boot partition: " gbp | |
| 728 |
var Str options := c:env:"kernel":"constant":"options" | |
| 729 |
input "Extra Linux kernel options: " options | |
| 730 |
table columns 2 border 0 | |
| 731 |
cell (highlight "warning:") | |
| 732 |
cell [If you had a working operating system somewhere else on the disk or on another disk, it will not be possible to boot it anymore.] | |
| 733 |
para | |
| 734 |
[You are going to set the disk boot sector so that it will start the system on ] ; fixed (text " "+root+" ") ; [partition.] | |
| 735 |
[Now install: ] | |
| 736 |
button "LILO" noeol | |
| 737 |
var Str lilo_options := "" | |
| 738 |
if geometry<>"" | |
| 739 |
lilo_options += " geometry "+string:geometry | |
| 740 |
if true # this_computer:env:"pliant":"system":"medium"="nfs" or this_computer:env:"pliant":"system":"medium"="cdrom" or this_computer:env:"pliant":"system":"medium"="usb" | |
| 741 |
filesystem_mount sroot "file:/mnt/target/" "nocheck" | |
| 742 |
update_rights c "file:/mnt/target/" | |
| 743 |
var Status status := lilo_install c "file:/mnt/target/" lbd root options lilo_options | |
| 744 |
filesystem_dismount "file:/mnt/target/" | |
| 745 |
else | |
| 746 |
update_rights c "file:/" | |
| 747 |
var Status status := lilo_install c "file:/" lbd root options lilo_options | |
| 748 |
if status=success | |
| 749 |
goto_backward | |
| 750 |
else | |
| 751 |
[Failed to make the system bootable through Lilo] | |
| 752 |
button "GRUB" noeol | |
| 753 |
var Str grub_options := "" | |
| 754 |
if true # this_computer:env:"pliant":"system":"medium"="nfs" or this_computer:env:"pliant":"system":"medium"="cdrom" | |
| 755 |
grub_install "file:/mnt/target/" gbd gbp | |
| 756 |
filesystem_mount sroot "file:/mnt/target/" "nocheck" | |
| 757 |
update_rights c "file:/mnt/target/" | |
| 758 |
grub_configure c "file:/mnt/target/" gbd gbp root options grub_options | |
| 759 |
filesystem_dismount "file:/mnt/target/" | |
| 760 |
else | |
| 761 |
grub_install "file:/" gbd gbp | |
| 762 |
update_rights c "file:/" | |
| 763 |
grub_configure c "file:/" gbd gbp root options grub_options | |
| 764 |
goto_backward | |
| 765 |
button "none" | |
| 766 |
goto_backward | |
| 767 |
else | |
| 768 |
[Only the administrator can do that !] | |
| 769 |
| |
| 770 |
if keyof:c=computer_fullname | |
| 771 |
page button "Update settings" | |
| 772 |
if allowed:"administrator" | |
| 773 |
title "Update computer settings" | |
| 774 |
var Str temp1 := file_temporary ; var Str temp2 := file_temporary | |
| 775 |
var (Link Database:Computer) target_database :> new Database:Computer | |
| 776 |
target_database load temp1 | |
| 777 |
data_copy c target_database:data | |
| 778 |
target_database store | |
| 779 |
data_store | |
| 780 |
file_difference "security:/this_computer.pdb" temp1 temp2 | |
| 781 |
fixed | |
| 782 |
(var Stream s) open temp2 in+safe | |
| 783 |
while not s:atend | |
| 784 |
var Str l := s readline | |
| 785 |
if (l parse "-" any) or (l parse "+" any) | |
| 786 |
text l ; eol | |
| 787 |
file_delete temp1 ; file_delete temp2 | |
| 788 |
button "Apply changes" noeol | |
| 789 |
data_copy c this_computer | |
| 790 |
goto_backward | |
| 791 |
button "Cancel" | |
| 792 |
goto_backward | |
| 793 |
else | |
| 794 |
[Only the administrator can do that !] | |
| 795 |
| |
| 796 |
| |
| 797 |
if allowed:"administrator" | |
| 798 |
input "Computer name: " (var Str sid) noeol | |
| 799 |
var Str cid := "" | |
| 800 |
button "Create the new computer" noeol | |
| 801 |
if not (exists computer:sid) | |
| 802 |
computer create sid | |
| 803 |
if cid<>"" | |
| 804 |
data_copy computer:cid computer:sid | |
| 805 |
reload_page | |
| 806 |
button "Delete the computer" | |
| 807 |
computer delete sid | |
| 808 |
reload_page | |
| 809 |
input "... as a copy of: " cid | |
| |