2 Copyright © 2003-2007, The AROS Development Team. All rights reserved.
6 #define INTUITION_NO_INLINE_STDARG
10 #include <aros/debug.h>
12 #include <libraries/mui.h>
14 #include <exec/types.h>
19 #include <clib/alib_protos.h>
21 #include <intuition/gadgetclass.h>
22 #include <intuition/icclass.h>
23 #include <gadgets/colorwheel.h>
25 #include <libraries/asl.h>
26 #include <libraries/expansionbase.h>
28 #include <devices/trackdisk.h>
29 #include <devices/scsidisk.h>
31 #include <proto/exec.h>
32 #include <proto/intuition.h>
33 #include <proto/dos.h>
34 #include <proto/partition.h>
35 #include <proto/muimaster.h>
36 #include <proto/graphics.h>
37 #include <proto/utility.h>
39 #include <mui/NFloattext_mcc.h>
43 #define kBufSize (4*65536)
44 #define kExallBufSize (4096)
46 #define kDstPartVol "DH0"
47 #define kDstWorkVol "DH1"
48 #define package_Path "SYS:"
49 #define kDstPartName "AROS"
50 #define kDstWorkName "Work"
52 #define installertmp_path "T:Installer"
53 #define instalationtmp_path "T:Installer/InstallAROS"
55 #define localeFile_path "Prefs/Locale\""
56 #define inputFile_path "Prefs/Input\""
57 #define prefssrc_path "ENV:SYS"
58 #define prefs_path "Prefs/Env-Archive/SYS"
59 #define boot_path "Boot"
61 #define locale_prfs_file "locale.prefs" /* please note the suffixed \" */
62 #define input_prfs_file "input.prefs"
64 #define DEF_INSTALL_IMAGE "IMAGES:Logos/install.logo"
65 #define DEF_BACK_IMAGE "IMAGES:Logos/install.logo"
66 #define DEF_LIGHTBACK_IMAGE "IMAGES:Logos/install.logo"
68 /** Start - NEW!! this is part of the "class" change ;) **/
70 #define OPTION_PREPDRIVES 1
71 #define OPTION_FORMAT 2
72 #define OPTION_LANGUAGE 3
74 #define OPTION_EXTRAS 5
75 #define OPTION_BOOTLOADER 6
77 #define INSTV_TITLE 101001
78 #define INSTV_LOGO 101002
79 #define INSTV_PAGE 101003
81 #define INSTV_TEXT 101004
82 #define INSTV_SPACE 101005
83 #define INSTV_BOOL 101006
84 #define INSTV_RETURN 101007
86 #define INSTV_CURR 101100
88 /** End - NEW!! this is part of the "class" change ;) **/
90 struct ExpansionBase
*ExpansionBase
= NULL
;
92 char *source_Path
=NULL
; /* full path to source "tree" */
93 char *source_Name
=NULL
;
95 char *dest_Path
=NULL
; /* DOS DEVICE NAME of part used to store "aros" */
96 char *work_Path
=NULL
; /* DOS DEVICE NAME of part used to store "work" */
97 TEXT
*extras_path
= NULL
; /* DOS DEVICE NAME of part used to store extras */
99 char *boot_Device
="ata.device";
102 Object
* check_copytowork
= NULL
;
103 Object
* check_work
= NULL
;
104 Object
* show_formatsys
= NULL
;
105 Object
* show_formatwork
= NULL
;
106 Object
* check_formatsys
= NULL
;
107 Object
* check_formatwork
= NULL
;
109 Object
* dest_volume
= NULL
;
110 Object
* work_volume
= NULL
;
112 Object
* dest_device
= NULL
;
113 Object
* dest_unit
= NULL
;
114 Object
* show_sizesys
= NULL
;
115 Object
* show_sizework
= NULL
;
116 Object
* check_sizesys
= NULL
;
117 Object
* check_sizework
= NULL
;
118 Object
* check_creatework
= NULL
;
119 Object
* sys_size
= NULL
;
120 Object
* work_size
= NULL
;
122 Object
*reboot_group
= NULL
;
124 //extern ULONG InitTask(void);
125 static LONG
FindWindowsPartition(STRPTR device
, LONG unit
);
126 int CopyDirArray( Class
*CLASS
, Object
*self
, struct Install_DATA
* data
, TEXT
*copy_files
[], TEXT
*destination_Path
);
127 int CreateDestDIR( Class
*CLASS
, Object
*self
, TEXT
*dest_dir
, TEXT
*destination_Path
);
131 Class
*CLASS
, Object
*self
, struct opSet
*message
134 self
= (Object
*) DoSuperMethodA(CLASS
, self
, (Msg
) message
);
136 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
139 // if (( data->IO_IOTask = InitTask())==0) /** LAUNCH THE IO TASK! **/
143 /* We will generate this info shortly */
147 data
->IO_Always_overwrite
=IIO_Overwrite_Ask
;
151 data
->welcomeMsg
= (APTR
) GetTagData (MUIA_WelcomeMsg
, (ULONG
) NULL
, message
->ops_AttrList
);
152 data
->doneMsg
= (APTR
) GetTagData (MUIA_FinishedMsg
, (ULONG
) NULL
, message
->ops_AttrList
);
154 data
->page
= (APTR
) GetTagData (MUIA_Page
, (ULONG
) NULL
, message
->ops_AttrList
);
155 data
->gauge1
= (APTR
) GetTagData (MUIA_Gauge1
, (ULONG
) NULL
, message
->ops_AttrList
);
156 data
->gauge2
= (APTR
) GetTagData (MUIA_Gauge2
, (ULONG
) NULL
, message
->ops_AttrList
);
157 data
->label
= (APTR
) GetTagData (MUIA_Install
, (ULONG
) NULL
, message
->ops_AttrList
);
159 data
->installer
= (APTR
) GetTagData (MUIA_OBJ_Installer
, (ULONG
) NULL
, message
->ops_AttrList
);
161 data
->window
= (APTR
) GetTagData (MUIA_OBJ_Window
, (ULONG
) NULL
, message
->ops_AttrList
);
162 data
->contents
= (APTR
) GetTagData (MUIA_OBJ_WindowContent
, (ULONG
) NULL
, message
->ops_AttrList
);
164 data
->pagetitle
= (APTR
) GetTagData (MUIA_OBJ_PageTitle
, (ULONG
) NULL
, message
->ops_AttrList
);
165 data
->pageheader
= (APTR
) GetTagData (MUIA_OBJ_PageHeader
, (ULONG
) NULL
, message
->ops_AttrList
);
167 data
->actioncurrent
= (APTR
) GetTagData (MUIA_OBJ_CActionStrng
, (ULONG
) NULL
, message
->ops_AttrList
);
168 data
->back
= (APTR
) GetTagData (MUIA_OBJ_Back
, (ULONG
) NULL
, message
->ops_AttrList
);
169 data
->proceed
= (APTR
) GetTagData (MUIA_OBJ_Proceed
, (ULONG
) NULL
, message
->ops_AttrList
);
170 data
->cancel
= (APTR
) GetTagData (MUIA_OBJ_Cancel
, (ULONG
) NULL
, message
->ops_AttrList
);
172 data
->IO_RWindow
= (APTR
) GetTagData (MUIA_OBJ_IO_RWindow
, (ULONG
) NULL
, message
->ops_AttrList
);
173 data
->IO_RText
= (APTR
) GetTagData (MUIA_OBJ_IO_RText
, (ULONG
) NULL
, message
->ops_AttrList
);
174 data
->IO_ROpt1
= (APTR
) GetTagData (MUIA_OBJ_IO_ROpt1
, (ULONG
) NULL
, message
->ops_AttrList
);
175 data
->IO_ROpt2
= (APTR
) GetTagData (MUIA_OBJ_IO_ROpt2
, (ULONG
) NULL
, message
->ops_AttrList
);
176 data
->IO_ROpt3
= (APTR
) GetTagData (MUIA_OBJ_IO_ROpt3
, (ULONG
) NULL
, message
->ops_AttrList
);
178 data
->instc_lic_file
= (APTR
) GetTagData (MUIA_IC_License_File
, (ULONG
) NULL
, message
->ops_AttrList
);
179 data
->instc_lic_mandatory
= (APTR
) GetTagData (MUIA_IC_License_Mandatory
, (ULONG
) NULL
, message
->ops_AttrList
);
182 data
->instc_options_main
= (APTR
) GetTagData (MUIA_List_Options
, (ULONG
) NULL
, message
->ops_AttrList
);
183 data
->instc_options_grub
= (APTR
) GetTagData (MUIA_Grub_Options
, (ULONG
) NULL
, message
->ops_AttrList
);
185 data
->instc_undoenabled
= (APTR
) GetTagData (MUIA_IC_EnableUndo
, (ULONG
) NULL
, message
->ops_AttrList
);
187 data
->instc_options_main
->partitioned
= FALSE
;
188 data
->instc_options_main
->bootloaded
= FALSE
;
189 data
->instc_options_grub
->bootinfo
= FALSE
;
191 get( data
->window
, MUIA_Window_Width
, &data
->cur_width
);
192 get( data
->window
, MUIA_Window_Height
, &data
->cur_height
);
194 set(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgWelcome
);
195 set(data
->back
, MUIA_Disabled
, TRUE
);
197 data
->instc_stage_next
= EPartitionOptionsStage
;
199 data
->inst_success
= FALSE
;
200 data
->disable_back
= FALSE
;
202 data
->drive_set
= (BOOL
)DoMethod(self
, MUIM_FindDrives
);
204 DoMethod(data
->proceed
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
) self
, 1, MUIM_IC_NextStep
);
205 DoMethod(data
->back
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
) self
, 1, MUIM_IC_PrevStep
);
206 DoMethod(data
->cancel
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
) self
, 1, MUIM_IC_CancelInstall
);
208 DoMethod(self
, MUIM_Notify
, MUIA_InstallComplete
, TRUE
, (IPTR
) self
, 1, MUIM_Reboot
);
210 /* set up the license info */
212 if (data
->instc_lic_file
)
214 register struct FileInfoBlock
*fib
=NULL
;
218 lock
= (BPTR
) Lock(data
->instc_lic_file
, SHARED_LOCK
);
221 fib
= (void *) AllocVec(sizeof(*fib
), MEMF_PUBLIC
);
225 if((from
= Open(data
->instc_lic_file
, MODE_OLDFILE
)))
227 D(bug("[INSTALLER.i] Allocating buffer [%d] for license file '%s'!", fib
->fib_Size
, data
->instc_lic_file
));
228 data
->instc_lic_buffer
= AllocVec(fib
->fib_Size
+1, MEMF_CLEAR
| MEMF_PUBLIC
);
229 if ((s
= Read(from
, data
->instc_lic_buffer
, fib
->fib_Size
)) == -1)
231 D(bug("[INSTALLER.i] Error processing license file!"));
232 if ((BOOL
)data
->instc_lic_mandatory
)
241 set( data
->instc_options_main
->opt_lic_box
,MUIA_Floattext_Text
,data
->instc_lic_buffer
);
248 if( fib
) FreeVec( fib
);
252 if (!data
->instc_lic_mandatory
)
253 set(data
->instc_options_main
->opt_lic_mgrp
,MUIA_ShowMe
,FALSE
);
255 DoMethod(data
->instc_options_main
->opt_license
, MUIM_Notify
,
256 MUIA_Selected
, MUIV_EveryTime
, (IPTR
) data
->proceed
, 3, MUIM_Set
,
257 MUIA_Disabled
, MUIV_NotTriggerValue
);
262 if (data
->instc_undoenabled
)
265 NEWLIST((struct List
*)&data
->instc_undorecord
);
267 if ((lock
= Lock(installertmp_path
, ACCESS_READ
))!=NULL
)
269 D(bug("[INSTALLER.i] Dir '%s' Exists - no nead to create\n",installertmp_path
));
274 lock
= CreateDir(installertmp_path
);
275 if(lock
!= NULL
) UnLock(lock
);
278 D(bug("[INSTALLER.i] Failed to create %s dir!!\n",installertmp_path
));
279 data
->inst_success
= MUIV_Inst_Failed
;
284 if ((lock
= Lock(instalationtmp_path
, ACCESS_READ
))!=NULL
)
286 D(bug("[INSTALLER.i] Dir '%s' Exists - no nead to create\n",instalationtmp_path
));
291 lock
= CreateDir(instalationtmp_path
);
292 if(lock
!= NULL
) UnLock(lock
);
295 D(bug("[INSTALLER.i] Failed to create %s dir!!\n",instalationtmp_path
));
296 data
->inst_success
= MUIV_Inst_Failed
;
309 ULONG
AskRetry(Class
*CLASS
, Object
*self
, char *Message
, char *File
, char *Opt1
, char *Opt2
, char *Opt3
)
311 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
312 char *Temp_Message
=NULL
;
314 Temp_Message
= AllocVec(1000, MEMF_CLEAR
| MEMF_PUBLIC
);
316 sprintf(Temp_Message
, Message
, File
);
318 set(data
->IO_RText
, MUIA_Text_Contents
, Temp_Message
);
320 set(data
->IO_ROpt1
, MUIA_Text_Contents
, Opt1
);
321 set(data
->IO_ROpt2
, MUIA_Text_Contents
, Opt2
);
322 set(data
->IO_ROpt3
, MUIA_Text_Contents
, Opt3
);
324 set(data
->IO_ROpt1
, MUIA_Selected
, FALSE
);
325 set(data
->IO_ROpt2
, MUIA_Selected
, FALSE
);
326 set(data
->IO_ROpt3
, MUIA_Selected
, FALSE
);
328 set(data
->IO_RWindow
, MUIA_Window_Open
, TRUE
);
329 set(data
->window
,MUIA_Window_Sleep
,TRUE
);
331 DoMethod(data
->IO_ROpt1
,MUIM_Notify
,MUIA_Selected
,TRUE
, self
,3,MUIM_Set
,MUIA_IIO_Flag
,IIO_Selected_Opt1
);
332 DoMethod(data
->IO_ROpt2
,MUIM_Notify
,MUIA_Selected
,TRUE
, self
,3,MUIM_Set
,MUIA_IIO_Flag
,IIO_Selected_Opt2
);
333 DoMethod(data
->IO_ROpt3
,MUIM_Notify
,MUIA_Selected
,TRUE
, self
,3,MUIM_Set
,MUIA_IIO_Flag
,IIO_Selected_Opt3
);
337 while (data
->IO_Flags
== 0) DoMethod(data
->installer
, MUIM_Application_InputBuffered
);
339 set(data
->window
, MUIA_Window_Sleep
, FALSE
);
340 set(data
->IO_RWindow
, MUIA_Window_Open
, FALSE
);
342 set(data
->IO_RText
, MUIA_Text_Contents
, NULL
);
343 FreeVec(Temp_Message
);
345 return (data
->IO_Flags
- 1);
348 /* Return TRUE if we suspect a floppy disk */
349 BOOL
myCheckFloppy( struct DosEnvec
*DriveEnv
)
351 switch(DriveEnv
->de_HighCyl
)
354 /* Standard Floppy size
355 for PC floppies, DD = 9, HD = 18
356 for Amiga floppies, DD = 11, HD = 22
358 if ((DriveEnv
->de_BlocksPerTrack
==18) ||
359 (DriveEnv
->de_BlocksPerTrack
==9) ||
360 (DriveEnv
->de_BlocksPerTrack
==22) ||
361 (DriveEnv
->de_BlocksPerTrack
==11))
366 /* Standard Zip (95Mb) */
367 if ((DriveEnv
->de_BlocksPerTrack
==60) ||
368 (DriveEnv
->de_BlocksPerTrack
==68))
372 /* Standard Zip & LS120 sizes */
373 if (DriveEnv
->de_BlocksPerTrack
==1) return TRUE
;
377 /* OK - shouldn't be a floppy...*/
381 /* Returns the first AROS-supported filesystem's name */
382 char *FindPartition(struct PartitionHandle
*root
)
384 struct PartitionHandle
*partition
= NULL
;
385 char *success
= NULL
;
387 struct PartitionType
*type
=NULL
;
389 ForeachNode(&root
->table
->list
, partition
)
391 D(bug("[INSTALLER.fp] checking part\n"));
392 if (OpenPartitionTable(partition
) == 0)
394 D(bug("[INSTALLER.fp] checking Child Parts... \n"));
395 success
= FindPartition(partition
);
396 ClosePartitionTable(partition
);
397 D(bug("[INSTALLER.fp] Children Done...\n"));
400 D(bug("[INSTALLER.fp] Found '%s'\n",success
));
406 D(bug("[INSTALLER.fp] checking PARTITION\n"));
407 struct PartitionType pttype
;
409 name
=AllocVec( 100, MEMF_CLEAR
| MEMF_PUBLIC
);
411 GetPartitionAttrsTags
414 PT_NAME
, (IPTR
) name
,
415 PT_TYPE
, (IPTR
) &pttype
,
421 if (type
->id_len
== 4)
423 D(bug("[INSTALLER.fp] Found RDB Partition!\n"));
424 if ((type
->id
[0]==68)&&(type
->id
[1]==79)&&(type
->id
[2]==83))
426 D(bug("[INSTALLER.fp] Found AFFS Partition! '%s'\n",name
));
434 if ((!success
)&&(name
)) FreeVec(name
);
439 IPTR Install__MUIM_FindDrives
441 Class
*CLASS
, Object
*self
, Msg message
444 struct BootNode
*CurBootNode
=NULL
;
445 struct PartitionHandle
*root
;
447 struct DevInfo
*devnode
=NULL
;
448 struct FileSysStartupMsg
*StartMess
=NULL
;
449 struct DosEnvec
*DriveEnv
=NULL
;
452 BOOL founddisk
= FALSE
;
454 ForeachNode(&ExpansionBase
->MountList
, CurBootNode
)
456 devnode
= CurBootNode
->bn_DeviceNode
;
457 StartMess
= devnode
->dvi_Startup
;
458 DriveEnv
= StartMess
->fssm_Environ
;
460 if (!myCheckFloppy(DriveEnv
))
462 if((root
= OpenRootPartition(StartMess
->fssm_Device
, StartMess
->fssm_Unit
)) != NULL
)
466 /* First drive in system - save its info for grub */
467 D(bug("[INSTALLER.fd] First DRIVE found [%s unit %d]...\n",StartMess
->fssm_Device
, StartMess
->fssm_Unit
));
469 // boot_Device = StartMess->fssm_Device;
470 // boot_Unit = StartMess->fssm_Unit;
473 if (OpenPartitionTable(root
) == 0)
475 result
= FindPartition(root
);
476 D(bug("[INSTALLER.fd] Partition '%s'\n",result
));
477 ClosePartitionTable(root
);
479 CloseRootPartition(root
);
487 void w2strcpy(STRPTR name
, UWORD
*wstr
, ULONG len
)
491 *((UWORD
*)name
) = AROS_BE2WORD(*wstr
);
492 name
+= sizeof(UWORD
);
499 while ((*name
==0) || (*name
==' ')) *name
-- = 0;
502 void identify(struct IOStdReq
*ioreq
, STRPTR name
) {
503 struct SCSICmd scsicmd
;
505 UBYTE cmd
=0xEC; /* identify */
507 scsicmd
.scsi_Data
= data
;
508 scsicmd
.scsi_Length
= 512;
509 scsicmd
.scsi_Command
= &cmd
;
510 scsicmd
.scsi_CmdLength
= 1;
511 ioreq
->io_Command
= HD_SCSICMD
;
512 ioreq
->io_Data
= &scsicmd
;
513 ioreq
->io_Length
= sizeof(struct SCSICmd
);
514 if (DoIO((struct IORequest
*)ioreq
)) return;
516 w2strcpy(name
, &data
[27], 40);
519 IPTR Install__MUIM_IC_NextStep
521 Class
*CLASS
, Object
*self
, Msg message
524 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
525 IPTR this_page
=0,next_stage
=0,option
=0;
527 get(data
->page
,MUIA_Group_ActivePage
, &this_page
);
529 if ((EDoneStage
== this_page
)&&( this_page
== data
->instc_stage_next
)) set(self
, MUIA_InstallComplete
, TRUE
); //ALL DONE!!
531 set(data
->back
, MUIA_Disabled
, (BOOL
)data
->disable_back
);
533 next_stage
= data
->instc_stage_next
;
534 data
->instc_stage_prev
= this_page
;
536 set(data
->back
, MUIA_Selected
, FALSE
);
537 set(data
->proceed
, MUIA_Selected
, FALSE
);
538 set(data
->cancel
, MUIA_Selected
, FALSE
);
540 switch(data
->instc_stage_next
)
544 if (data
->instc_lic_file
)
546 if (data
->instc_lic_mandatory
)
548 /* Force acceptance of the license */
549 set(data
->instc_options_main
->opt_license
, MUIA_Selected
, FALSE
);
550 set(data
->proceed
, MUIA_Disabled
, TRUE
);
552 data
->instc_stage_next
= EInstallOptionsStage
;
553 next_stage
= ELicenseStage
;
556 /* if no license we ignore this step... and go to partition options */
558 case EPartitionOptionsStage
:
561 set(data
->instc_options_main
->opt_partmethod
, MUIA_Radio_Active
, 2);
563 data
->instc_stage_next
= EPartitioningStage
;
564 next_stage
= EPartitionOptionsStage
;
567 case EInstallOptionsStage
:
568 set(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgInstallOptions
);
569 data
->instc_stage_next
= EDestOptionsStage
;
570 next_stage
= EInstallOptionsStage
;
573 case EDestOptionsStage
:
574 if ((BOOL
)XGET(data
->instc_options_main
->opt_format
, MUIA_Selected
))
576 set(show_formatsys
,MUIA_ShowMe
,TRUE
);
577 set(show_formatwork
,MUIA_ShowMe
,TRUE
);
581 set(check_formatsys
,MUIA_Selected
,FALSE
);
582 set(check_formatwork
,MUIA_Selected
,FALSE
);
583 set(show_formatsys
,MUIA_ShowMe
,FALSE
);
584 set(show_formatwork
,MUIA_ShowMe
,FALSE
);
586 data
->instc_stage_next
= EInstallMessageStage
;
587 next_stage
= EDestOptionsStage
;
590 case EInstallMessageStage
:
591 //enum EStage theprevStage;
594 /* PARTITION DRIVES */
595 get(data
->instc_options_main
->opt_partition
, MUIA_Selected
, &option
);
598 //have we already done this?
599 if (!data
->instc_options_main
->partitioned
)
601 data
->instc_options_main
->partitioned
= TRUE
;
602 data
->instc_stage_next
= EPartitioningStage
;
603 next_stage
= EPartitionOptionsStage
;
604 data
->instc_stage_prev
= this_page
;
613 get(data
->instc_options_main
->opt_bootloader
, MUIA_Selected
, &option
);
616 //have we already done this?
617 if (!data
->instc_options_main
->bootloaded
)
619 data
->instc_options_main
->bootloaded
= TRUE
;
621 if (!data
->instc_options_grub
->bootinfo
)
623 char *tmp_drive
=NULL
;
624 char *tmp_device
=NULL
;
626 char *tmp_kernel
=NULL
;
627 struct IOStdReq
*ioreq
=NULL
;
628 struct MsgPort
*mp
=NULL
;
630 data
->instc_options_grub
->bootinfo
= TRUE
;
632 tmp_drive
=AllocVec( 100, MEMF_CLEAR
| MEMF_PUBLIC
);
633 tmp_device
=AllocVec( 100, MEMF_CLEAR
| MEMF_PUBLIC
);
634 tmp_grub
=AllocVec( 100, MEMF_CLEAR
| MEMF_PUBLIC
);
635 tmp_kernel
=AllocVec( 100, MEMF_CLEAR
| MEMF_PUBLIC
);
637 mp
= CreateMsgPort();
640 ioreq
= (struct IOStdReq
*)CreateIORequest(mp
, sizeof(struct IOStdReq
));
643 if (OpenDevice(boot_Device
, boot_Unit
, (struct IORequest
*)ioreq
, 0) == 0)
645 identify(ioreq
, tmp_drive
);
646 sprintf(tmp_device
,"%s [%s unit %d]",tmp_drive
,boot_Device
,boot_Unit
);
647 CloseDevice((struct IORequest
*)ioreq
);
649 else sprintf(tmp_device
,"Unknown Drive [%s unit %d]",boot_Device
,boot_Unit
);
650 DeleteIORequest((struct IORequest
*)ioreq
);
652 else sprintf(tmp_device
,"Unknown Drive [%s unit %d]",boot_Device
,boot_Unit
);
655 else sprintf(tmp_device
,"Unknown Drive [%s unit %d]",boot_Device
,boot_Unit
);
657 sprintf(tmp_grub
,"%s:boot/GRUB",dest_Path
);
659 set(data
->instc_options_grub
->gopt_drive
, MUIA_Text_Contents
, tmp_device
);
660 set(data
->instc_options_grub
->gopt_grub
, MUIA_Text_Contents
, tmp_grub
);
663 data
->instc_stage_next
= EInstallMessageStage
;
664 next_stage
= EGrubOptionsStage
;
665 data
->instc_stage_prev
= EInstallOptionsStage
;
670 if (XGET(check_formatsys
, MUIA_Selected
)
671 || XGET(check_formatwork
, MUIA_Selected
))
672 set(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgBeginWithPartition
);
674 set(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgBeginWithoutPartition
);
675 data
->instc_stage_next
= EInstallStage
;
676 next_stage
= EMessageStage
;
679 case EPartitioningStage
:
680 data
->disable_back
= TRUE
;
682 set(data
->page
,MUIA_Group_ActivePage
, EPartitioningStage
);
684 get(data
->instc_options_main
->opt_partmethod
,MUIA_Radio_Active
,&option
);
689 if(DoMethod(self
, MUIM_Partition
) != RETURN_OK
)
691 D(bug("[INSTALLER] Partitioning FAILED!!!!\n"));
692 data
->disable_back
= FALSE
;
693 set(data
->page
,MUIA_Group_ActivePage
, EInstallMessageStage
);
694 data
->instc_stage_next
= EPartitioningStage
;
697 next_stage
= EDoneStage
;
698 DoMethod(data
->page
, MUIM_Group_InitChange
);
699 set(data
->doneMsg
,MUIA_Text_Contents
,KMsgDoneReboot
);
700 set(reboot_group
, MUIA_ShowMe
, TRUE
);
701 set(data
->instc_options_main
->opt_reboot
, MUIA_Selected
, TRUE
);
702 DoMethod(data
->page
, MUIM_Group_ExitChange
);
703 set(data
->back
, MUIA_Disabled
, TRUE
);
704 set(data
->cancel
, MUIA_Disabled
, TRUE
);
705 data
->instc_stage_next
= EDoneStage
;
708 data
->disable_back
= FALSE
;
709 data
->instc_stage_next
= EDestOptionsStage
;
710 next_stage
= EInstallOptionsStage
;
713 D(bug("[INSTALLER] Launching QuickPart...\n"));
714 Execute("SYS:Tools/QuickPart", NULL
, NULL
);
720 data
->disable_back
= TRUE
;
721 set(data
->page
,MUIA_Group_ActivePage
, EInstallStage
);
723 DoMethod(self
, MUIM_IC_Install
);
725 next_stage
= EDoneStage
;
726 set(data
->back
, MUIA_Disabled
, TRUE
);
727 set(data
->cancel
, MUIA_Disabled
, TRUE
);
728 data
->instc_stage_next
= EDoneStage
;
735 set(data
->page
,MUIA_Group_ActivePage
, next_stage
);
739 IPTR Install__MUIM_IC_PrevStep
741 Class
*CLASS
, Object
*self
, Msg message
744 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
747 get(data
->page
,MUIA_Group_ActivePage
, &this_page
);
748 set(data
->back
, MUIA_Selected
, FALSE
);
749 set(data
->proceed
, MUIA_Selected
, FALSE
);
750 set(data
->cancel
, MUIA_Selected
, FALSE
);
752 set(data
->back
, MUIA_Disabled
, (BOOL
)data
->disable_back
);
753 data
->instc_stage_next
= this_page
;
758 /* BACK should only be possible when page != first_page */
759 if (data
->instc_stage_prev
!= EMessageStage
)
761 set(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgBeginWithPartition
);
762 if (data
->instc_stage_prev
== EDestOptionsStage
)
764 set(data
->page
,MUIA_Group_ActivePage
, EDestOptionsStage
);
766 data
->instc_stage_prev
= EInstallOptionsStage
;
770 if (!data
->instc_options_grub
->bootinfo
)
772 set(data
->page
,MUIA_Group_ActivePage
, EPartitionOptionsStage
);
776 set(data
->page
,MUIA_Group_ActivePage
, EGrubOptionsStage
);
778 data
->instc_stage_prev
= EDestOptionsStage
;
780 data
->instc_stage_next
= EInstallMessageStage
;
784 case EPartitionOptionsStage
:
785 if (data
->instc_lic_file
)
787 set(data
->instc_options_main
->opt_license
, MUIA_Selected
, FALSE
);
788 set(data
->proceed
, MUIA_Disabled
, TRUE
);
789 set(data
->page
,MUIA_Group_ActivePage
, EPartitionOptionsStage
);
790 data
->instc_stage_prev
= ELicenseStage
;
795 set(data
->proceed
, MUIA_Disabled
, FALSE
);
796 set(data
->back
, MUIA_Disabled
, TRUE
);
797 set(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgWelcome
);
798 set(data
->page
,MUIA_Group_ActivePage
, EMessageStage
);
799 data
->instc_stage_prev
= EMessageStage
;
802 case EInstallOptionsStage
:
803 set(data
->instc_options_main
->opt_license
, MUIA_Selected
, FALSE
);
804 set(data
->page
,MUIA_Group_ActivePage
, EPartitionOptionsStage
);
805 data
->instc_stage_prev
= ELicenseStage
;
808 case EDestOptionsStage
:
809 set(data
->page
,MUIA_Group_ActivePage
, EInstallOptionsStage
);
810 data
->instc_stage_next
= EDestOptionsStage
;
811 data
->instc_stage_prev
= EMessageStage
;
814 case EGrubOptionsStage
:
815 set(data
->page
,MUIA_Group_ActivePage
, EDestOptionsStage
);
816 data
->instc_options_main
->bootloaded
= FALSE
;
817 data
->instc_stage_next
= EInstallMessageStage
;
818 data
->instc_stage_prev
= EInstallOptionsStage
;
821 case EInstallMessageStage
:
823 /* Back is disabled from here on... */
825 case EPartitioningStage
:
835 IPTR Install__MUIM_IC_CancelInstall
837 Class
*CLASS
, Object
*self
, Msg message
840 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
841 struct optionstmp
*backupOptions
= NULL
;
843 char *cancelmessage
=NULL
;
845 if ((backupOptions
= data
->instc_options_backup
) == NULL
)
847 backupOptions
= AllocMem( sizeof(struct optionstmp
), MEMF_CLEAR
| MEMF_PUBLIC
);
848 data
->instc_options_backup
= backupOptions
;
851 get(data
->page
,MUIA_Group_ActivePage
, &this_page
);
853 get(data
->back
, MUIA_Disabled
, &data
->status_back
);
854 get(data
->proceed
, MUIA_Disabled
, &data
->status_proceed
);
855 get(data
->cancel
, MUIA_Disabled
, &data
->status_cancel
);
859 case EPartitioningStage
:
862 cancelmessage
= KMsgCancelDanger
;
865 case EInstallOptionsStage
:
866 get(data
->instc_options_main
->opt_partition
, MUIA_Disabled
, &backupOptions
->opt_partition
);
867 get(data
->instc_options_main
->opt_format
, MUIA_Disabled
, &backupOptions
->opt_format
);
868 get(data
->instc_options_main
->opt_locale
, MUIA_Disabled
, &backupOptions
->opt_locale
);
869 get(data
->instc_options_main
->opt_copycore
, MUIA_Disabled
, &backupOptions
->opt_copycore
);
870 get(data
->instc_options_main
->opt_copyextra
, MUIA_Disabled
, &backupOptions
->opt_copyextra
);
871 get(data
->instc_options_main
->opt_development
, MUIA_Disabled
, &backupOptions
->opt_development
);
872 get(data
->instc_options_main
->opt_bootloader
, MUIA_Disabled
, &backupOptions
->opt_bootloader
);
873 get(data
->instc_options_main
->opt_reboot
, MUIA_Disabled
, &backupOptions
->opt_reboot
);
875 set(data
->instc_options_main
->opt_partition
, MUIA_Disabled
, TRUE
);
876 set(data
->instc_options_main
->opt_format
, MUIA_Disabled
, TRUE
);
877 set(data
->instc_options_main
->opt_locale
, MUIA_Disabled
, TRUE
);
878 set(data
->instc_options_main
->opt_copycore
, MUIA_Disabled
, TRUE
);
879 set(data
->instc_options_main
->opt_copyextra
, MUIA_Disabled
, TRUE
);
880 set(data
->instc_options_main
->opt_development
, MUIA_Disabled
, TRUE
);
881 set(data
->instc_options_main
->opt_bootloader
, MUIA_Disabled
, TRUE
);
882 set(data
->instc_options_main
->opt_reboot
, MUIA_Disabled
, TRUE
);
885 case EDestOptionsStage
:
886 set(dest_volume
, MUIA_Disabled
, TRUE
);
887 set(work_volume
, MUIA_Disabled
, TRUE
);
888 set(check_copytowork
, MUIA_Disabled
, TRUE
);
889 set(check_work
, MUIA_Disabled
, TRUE
);
892 case EPartitionOptionsStage
:
893 set(data
->instc_options_main
->opt_partmethod
, MUIA_Disabled
, TRUE
);
896 case EGrubOptionsStage
:
901 cancelmessage
= KMsgCancelOK
;
905 set(data
->back
, MUIA_Selected
, FALSE
);
906 set(data
->back
, MUIA_Disabled
, TRUE
);
908 set(data
->proceed
, MUIA_Selected
, FALSE
);
909 set(data
->proceed
, MUIA_Disabled
, TRUE
);
911 set(data
->cancel
, MUIA_Selected
, FALSE
);
912 set(data
->cancel
, MUIA_Disabled
, TRUE
);
914 if ( !MUI_RequestA( data
->installer
, data
->window
, 0, "Cancel Installation...", "*Continue Install|Cancel Install", cancelmessage
, NULL
))
916 DoMethod(self
, MUIM_IC_QuitInstall
);
918 else DoMethod(self
, MUIM_IC_ContinueInstall
);
923 IPTR Install__MUIM_IC_ContinueInstall
925 Class
*CLASS
, Object
*self
, Msg message
928 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
929 struct optionstmp
*backupOptions
= NULL
;
932 backupOptions
= data
->instc_options_backup
;
934 get(data
->page
,MUIA_Group_ActivePage
, &this_page
);
936 if (!(BOOL
)data
->disable_back
) set(data
->back
, MUIA_Disabled
, data
->status_back
);
937 else set(data
->back
, MUIA_Disabled
, TRUE
);
938 set(data
->back
, MUIA_Selected
, FALSE
);
940 set(data
->proceed
, MUIA_Disabled
, data
->status_proceed
);
941 set(data
->proceed
, MUIA_Selected
, FALSE
);
943 set(data
->cancel
, MUIA_Disabled
, data
->status_cancel
);
944 set(data
->cancel
, MUIA_Selected
, FALSE
);
948 case EInstallOptionsStage
:
949 set(data
->instc_options_main
->opt_partition
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_partition
);
950 set(data
->instc_options_main
->opt_format
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_format
);
951 set(data
->instc_options_main
->opt_locale
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_locale
);
952 set(data
->instc_options_main
->opt_copycore
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_copycore
);
953 set(data
->instc_options_main
->opt_copyextra
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_copyextra
);
954 set(data
->instc_options_main
->opt_development
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_development
);
955 set(data
->instc_options_main
->opt_bootloader
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_bootloader
);
956 set(data
->instc_options_main
->opt_reboot
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_reboot
);
959 case EDestOptionsStage
:
960 set(dest_volume
, MUIA_Disabled
, FALSE
);
961 set(check_work
, MUIA_Disabled
, FALSE
);
964 get(check_work
, MUIA_Selected
, &reenable
);
968 set(check_copytowork
, MUIA_Disabled
, FALSE
);
969 set(work_volume
, MUIA_Disabled
, FALSE
);
973 case EPartitionOptionsStage
:
974 set(data
->instc_options_main
->opt_partmethod
, MUIA_Disabled
, FALSE
);
977 case EGrubOptionsStage
:
987 IPTR Install__MUIM_IC_QuitInstall
989 Class
*CLASS
, Object
*self
, Msg message
992 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
994 if ( data
->inst_success
== MUIV_Inst_InProgress
)
996 data
->inst_success
= MUIV_Inst_Cancelled
;
998 DoMethod(self
,MUIM_Reboot
);
1004 /** Start - NEW!! this is part of the "class" change ;) **/
1006 /* ****** FUNCTION IS CALLED BY THE PROCEDURE PROCESSOR
1008 IT LAUNCHES THE NECESSARY FUNCTION TO PERFORM WHATEVER IS BEING ASKED TO DO
1011 IPTR Install__MUIM_DispatchInstallProcedure
1013 Class
*CLASS
, Object
*self
, Msg message
1016 // struct Install_DATA* data = INST_DATA(CLASS, self);
1021 /** End - NEW!! this is part of the "class" change ;) **/
1023 IPTR Install__MUIM_Partition
1025 Class
*CLASS
, Object
*self
, Msg message
1028 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
1029 IPTR option
= FALSE
;
1032 if ( data
->inst_success
== MUIV_Inst_InProgress
)
1034 set(data
->back
, MUIA_Disabled
, TRUE
);
1035 set(data
->proceed
, MUIA_Disabled
, TRUE
);
1037 char tmpcmd
[100], tmparg
[100];
1038 get(dest_device
, MUIA_String_Contents
, &tmp
);
1039 get(dest_unit
, MUIA_String_Integer
, &option
);
1040 sprintf(&tmpcmd
,"C:Partition DEVICE=%s UNIT=%ld FORCE QUIET",
1043 /* Specify SYS size */
1044 get(check_sizesys
, MUIA_Selected
, &option
);
1047 get(sys_size
, MUIA_String_Integer
, &tmp
);
1048 sprintf(&tmparg
, " SYSSIZE=%ld", tmp
);
1049 strcat(tmpcmd
, tmparg
);
1052 /* Specify Work size */
1053 get(check_creatework
, MUIA_Selected
, &option
);
1056 get(check_sizework
, MUIA_Selected
, &option
);
1059 get(work_size
, MUIA_String_Integer
, &tmp
);
1060 sprintf(tmparg
, " WORKSIZE=%ld", tmp
);
1061 strcat(tmpcmd
, tmparg
);
1065 strcat(tmpcmd
, " MAXWORK");
1069 /* Specify whether to wipe disk or not */
1070 get(data
->instc_options_main
->opt_partmethod
, MUIA_Radio_Active
,
1074 D(bug("[INSTALLER] Partitioning EVERYTHING! MUAHAHAHA...\n"));
1075 strcat(tmpcmd
, " WIPE");
1078 D(bug("[INSTALLER] Partitioning Free Space...\n"));
1080 D(bug("[INSTALLER] ### Executing '%s'\n",&tmpcmd
));
1081 tmp
= SystemTagList(&tmpcmd
, NULL
);
1083 set(data
->proceed
, MUIA_Disabled
, FALSE
);
1089 void FixUpPackageFile(char * packagefile
, IPTR
**fixupdirs
, int dircnt
)
1091 IPTR
*fixuppackage_dirs
= *fixupdirs
;
1092 TEXT fixdirbuf
[1024];
1093 register struct FileInfoBlock
*fib
=NULL
;
1094 char *oldpackageline
=NULL
;
1095 BPTR from
=NULL
,lock
=NULL
;
1098 lock
= (BPTR
) Lock(packagefile
, SHARED_LOCK
);
1101 fib
= (void *) AllocVec(sizeof(struct FileInfoBlock
), MEMF_PUBLIC
);
1105 /* Read in the files content to retrieve the current path */
1107 if((from
= Open(packagefile
, MODE_OLDFILE
)))
1109 D(bug("[INSTALLER] FixUpPackageFile() Allocating buffer [%d] for package path '%s'!\n", fib
->fib_Size
, packagefile
));
1110 oldpackageline
= AllocVec(fib
->fib_Size
+1, MEMF_CLEAR
| MEMF_PUBLIC
);
1111 if ((s
= Read(from
, oldpackageline
, fib
->fib_Size
)) == -1)
1113 D(bug("[INSTALLER] FixUpPackageFile() Error processing package file!\n"));
1117 for (i
= 0; &fixuppackage_dirs
[i
] !=NULL
; i
++)
1119 sprintf( fixdirbuf
, "%s", package_Path
);
1120 AddPart( fixdirbuf
, &fixuppackage_dirs
[i
], strlen(package_Path
));
1121 /* replace files in extras with the work equivelant path */
1122 if (!strcmp(fixdirbuf
,oldpackageline
))
1124 D(bug("[INSTALLER] FixUpPackageFile() Found package path needing changed '%s'\n",oldpackageline
));
1125 //AllocVec(strlen(oldpackageline)-strlen(package_Path)+strlen(work_Path),MEMF_PUBLIC|MEMF_CLEAR);
1126 sprintf(fixdirbuf
, "%s", extras_path
);
1127 AddPart( fixdirbuf
, (IPTR
)oldpackageline
+ strlen(package_Path
), 1024);
1128 D(bug("[INSTALLER] FixUpPackageFile() Corrected path = '%s'\n",fixdirbuf
));
1134 FreeVec(oldpackageline
);
1139 if( fib
) FreeVec( fib
);
1144 void create_extraspath_variable(CONST_STRPTR dest_path
,
1145 CONST_STRPTR extras_path
)
1147 if (dest_path
== NULL
|| extras_path
== NULL
)
1152 BPTR env_variable_fh
= NULL
;
1153 TEXT env_variable
[100];
1154 TEXT extraspath
[100];
1156 sprintf(env_variable
, "%s:", dest_path
);
1157 AddPart(env_variable
, "Prefs/Env-Archive/EXTRASPATH", 100);
1159 sprintf(extraspath
, "%s:", extras_path
);
1160 AddPart(extraspath
, "Extras", 100);
1162 D(bug("[INSTALLER] create_extraspath_variable: Setting Var '%s' to '%s'\n", env_variable
, extraspath
));
1164 if ((env_variable_fh
= Open(env_variable
, MODE_NEWFILE
)) != NULL
)
1166 FPuts(env_variable_fh
, extraspath
);
1167 Close(env_variable_fh
);
1171 IPTR Install__MUIM_IC_Install
1173 Class
*CLASS
, Object
*self
, Msg message
1176 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
1178 IPTR option
= FALSE
;
1179 int fixupdir_count
=0;
1181 get(dest_volume
, MUIA_String_Contents
, &option
);
1182 strcpy(dest_Path
, (STRPTR
)option
);
1183 get(work_volume
, MUIA_String_Contents
, &option
);
1184 strcpy(work_Path
, (STRPTR
)option
);
1186 set(data
->back
, MUIA_Disabled
, TRUE
);
1187 set(data
->proceed
, MUIA_Disabled
, TRUE
);
1189 set(data
->pagetitle
,MUIA_Text_Contents
, "Installing AROS...");
1191 /** setup work name to use **/
1193 get(check_copytowork
, MUIA_Selected
, &option
);
1194 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1195 extras_path
= work_Path
;
1197 extras_path
= dest_Path
;
1199 /** STEP : FORMAT **/
1201 get(data
->instc_options_main
->opt_format
, MUIA_Selected
, &option
);
1202 if (option
&& data
->inst_success
== MUIV_Inst_InProgress
)
1204 get(data
->instc_options_main
->opt_partmethod
, MUIA_Radio_Active
, &option
);
1206 DoMethod(self
, MUIM_Format
);
1209 /* MAKE SURE THE WORK PART EXISTS TO PREVENT CRASHING! */
1211 if ((BOOL
)XGET(check_work
, MUIA_Selected
))
1214 sprintf(tmp
,"%s:", work_Path
);
1215 D(bug("[INSTALLER] Install : Using a Work partition - checking validity..."));
1216 if((lock
= Lock(tmp
, SHARED_LOCK
))) /* check the dest dir exists */
1223 D(bug("FAILED!\n[INSTALLER] (Warning) INSTALL - Failed to locate chosen work partition '%s' : defaulting to sys only\n",work_Path
));
1224 extras_path
= dest_Path
;
1230 D(bug("[INSTALLER] Install: Using SYS partition only (%s)\n", dest_Path
));
1233 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1235 /** STEP : LOCALE **/
1237 get(data
->instc_options_main
->opt_locale
, MUIA_Selected
, &option
);
1238 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1240 D(bug("[INSTALLER] Launching Locale Prefs...\n"));
1242 ULONG srcLen
= strlen(source_Path
), dstLen
= (strlen(dest_Path
)+1);
1243 ULONG envsrcLen
= strlen(prefssrc_path
), envdstLen
= strlen(prefs_path
);
1245 ULONG localeFileLen
= srcLen
+ strlen(localeFile_path
) + 3;
1246 ULONG inputFileLen
= srcLen
+ strlen(inputFile_path
) + 3;
1248 ULONG localePFileLen
= dstLen
+ envdstLen
+ strlen(locale_prfs_file
) + 4;
1250 ULONG inputPFileLen
= dstLen
+ envdstLen
+ strlen(input_prfs_file
) + 4;
1252 ULONG envdstdirLen
= 1024;
1253 TEXT envDstDir
[envdstdirLen
]; /* "DH0:Prefs/Env-Archive/SYS" */
1255 TEXT localeFile
[localeFileLen
]; /* "CD0:Prefs/Locale" */
1256 TEXT localesrcPFile
[localePFileLen
]; /* "ENV:SYS/locale.prefs" */
1257 TEXT localePFile
[localePFileLen
]; /* "DH0:Prefs/Env-Archive/SYS/locale.prefs" */
1258 TEXT inputFile
[inputFileLen
]; /* "CD0:Prefs/Input" */
1259 TEXT inputsrcPFile
[inputPFileLen
]; /* "ENV:SYS/input.prefs" */
1260 TEXT inputPFile
[inputPFileLen
]; /* "DH0:Prefs/Env-Archive/SYS/input.prefs" */
1262 sprintf(envDstDir
,"%s:",dest_Path
);
1263 sprintf(localeFile
,"\"%s",source_Path
);
1264 CopyMem(prefssrc_path
, localesrcPFile
, envsrcLen
+ 1);
1265 sprintf(localePFile
,"%s:",dest_Path
);
1266 sprintf(inputFile
,"\"%s",source_Path
);
1267 CopyMem(prefssrc_path
, inputsrcPFile
, envsrcLen
+ 1);
1268 sprintf(inputPFile
,"%s:",dest_Path
);
1270 AddPart(localeFile
, inputFile_path
, localeFileLen
);
1272 AddPart(localesrcPFile
, locale_prfs_file
, localePFileLen
);
1274 AddPart(localePFile
, prefs_path
, localePFileLen
);
1275 AddPart(localePFile
, locale_prfs_file
, localePFileLen
);
1277 AddPart(inputFile
, localeFile_path
, inputFileLen
);
1279 AddPart(inputsrcPFile
, input_prfs_file
, inputPFileLen
);
1281 AddPart(inputPFile
, prefs_path
, inputPFileLen
);
1282 AddPart(inputPFile
, input_prfs_file
, inputPFileLen
);
1284 D(bug("[INSTALLER] Excecuting '%s'...\n",localeFile
));
1286 Execute(localeFile
, NULL
, NULL
);
1288 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1290 D(bug("[INSTALLER] Excecuting '%s'...\n",inputFile
));
1292 Execute(inputFile
, NULL
, NULL
);
1294 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1296 D(bug("[INSTALLER] Copying Locale Settings...\n"));
1298 //create the dirs "Prefs","Prefs/Env-Archive" and "Prefs/Env-Archive/SYS"
1299 AddPart(envDstDir
, "Prefs", dstLen
+ envdstLen
);
1300 D(bug("[INSTALLER] Create Dir '%s' \n",envDstDir
));
1302 BPTR bootDirLock
=NULL
;
1304 if ((lock
= Lock(envDstDir
, ACCESS_READ
))!=NULL
)
1306 D(bug("[INSTALLER] Dir '%s' Exists - no nead to create\n",envDstDir
));
1311 bootDirLock
= CreateDir(envDstDir
);
1312 if(bootDirLock
!= NULL
) UnLock(bootDirLock
);
1316 D(bug("[INSTALLER] Failed to create %s dir!!\n",envDstDir
));
1317 #warning TODO: Should prompt on failure to try again/continue anyhow/exit.
1318 goto localecopydone
;
1319 //data->inst_success = MUIV_Inst_Failed;
1327 AddPart(envDstDir
, "Env-Archive", envdstdirLen
);
1328 D(bug("[INSTALLER] Create Dir '%s' \n",envDstDir
));
1329 if ((lock
= Lock(envDstDir
, ACCESS_READ
))!=NULL
)
1331 D(bug("[INSTALLER] Dir '%s' Exists - no nead to create\n",envDstDir
));
1336 bootDirLock
= CreateDir(envDstDir
);
1337 if(bootDirLock
!= NULL
) UnLock(bootDirLock
);
1338 else goto createdirfaild
;
1344 AddPart(envDstDir
, "SYS", envdstdirLen
);
1345 D(bug("[INSTALLER] Create Dir '%s' \n",envDstDir
));
1346 if ((lock
= Lock(envDstDir
, ACCESS_READ
))!=NULL
)
1348 D(bug("[INSTALLER] Dir '%s' Exists - no nead to create\n",envDstDir
));
1353 bootDirLock
= CreateDir(envDstDir
);
1354 if(bootDirLock
!= NULL
) UnLock(bootDirLock
);
1355 else goto createdirfaild
;
1361 D(bug("[INSTALLER] Copying files\n"));
1363 if ((lock
= Lock(localesrcPFile
, ACCESS_READ
))!=NULL
)
1366 DoMethod(self
, MUIM_IC_CopyFile
, localesrcPFile
, localePFile
);
1372 if ((lock
= Lock(inputsrcPFile
, ACCESS_READ
))!=NULL
)
1375 DoMethod(self
, MUIM_IC_CopyFile
, inputsrcPFile
, inputPFile
);
1381 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1383 /** STEP : COPY CORE **/
1385 get(data
->instc_options_main
->opt_copycore
, MUIA_Selected
, &option
);
1386 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1389 BOOL success
= FALSE
;
1393 "Classes", "Classes",
1401 "Storage", "Storage",
1404 "Utilities", "Utilities",
1405 "WBStartup", "WBStartup",
1409 // Copying Core system Files
1410 D(bug("[INSTALLER] Copying Core files...\n"));
1411 set(data
->label
, MUIA_Text_Contents
, "Copying Core System files...");
1413 CopyDirArray( CLASS
, self
, data
, core_dirs
, dest_Path
);
1415 //Make Env-Archive Writeable ..
1416 sprintf(tmp
,"Protect ADD FLAGS=W ALL QUIET %s:Prefs/Env-Archive", dest_Path
);
1417 D(bug("[INSTALLER] Changing Protection on Env Files (command='%s')\n", tmp
));
1418 success
= (BOOL
)Execute(tmp
, NULL
, NULL
);
1421 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1423 /** STEP : COPY EXTRAS **/
1425 get(data
->instc_options_main
->opt_copyextra
, MUIA_Selected
, &option
);
1426 if (option
&& data
->inst_success
== MUIV_Inst_InProgress
)
1428 TEXT
*extras_dirs
[] =
1436 D(bug("[INSTALLER] Copying Extras to '%s'...\n"), extras_path
);
1437 set(data
->label
, MUIA_Text_Contents
, "Copying Extra Software...");
1439 CopyDirArray( CLASS
, self
, data
, extras_dirs
, extras_path
);
1442 // Set EXTRASPATH environment variable
1443 create_extraspath_variable(dest_Path
, extras_path
);
1446 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1448 /** STEP : COPY DEVELOPMENT **/
1450 get(data
->instc_options_main
->opt_development
, MUIA_Selected
, &option
);
1451 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1453 ULONG srcLen
= strlen(source_Path
);
1454 ULONG developerDirLen
= srcLen
+ strlen("Development") + 2;
1455 TEXT developerDir
[srcLen
+ developerDirLen
];
1457 CopyMem(source_Path
, &developerDir
, srcLen
+ 1);
1458 AddPart(&developerDir
, "Development", srcLen
+ developerDirLen
);
1460 if ((lock
= Lock(&developerDir
, ACCESS_READ
)) != NULL
)
1463 TEXT
*developer_dirs
[((2+1)*2)] =
1465 "Development", "Development",
1470 // Copying Developer stuff
1471 D(bug("[INSTALLER] Copying Developer Files...\n"));
1472 set(data
->label
, MUIA_Text_Contents
, "Copying Developer Files...");
1474 CopyDirArray(CLASS
, self
, data
, developer_dirs
, extras_path
);
1477 else D(bug("[INSTALLER] Couldn't locate Developer Files...\n"));
1480 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1482 /** STEP : INSTALL BOOTLOADER **/
1484 get(data
->instc_options_main
->opt_bootloader
, MUIA_Selected
, &option
);
1485 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1487 int numgrubfiles
= 3,file_count
= 0;
1489 ULONG srcLen
= strlen(source_Path
);
1490 ULONG dstLen
= (strlen(dest_Path
)+1);
1491 TEXT srcPath
[srcLen
+ strlen(boot_path
) + 1];
1492 TEXT dstPath
[dstLen
+ strlen(boot_path
) + 2];
1494 TEXT
*grub_files
[] =
1496 "boot/grub/stage1", "boot/grub/stage1",
1497 "boot/grub/stage2_hdisk", "boot/grub/stage2",
1498 "boot/grub/menu.lst.DH0", "boot/grub/menu.lst",
1502 CreateDestDIR( CLASS
, self
, boot_path
, dest_Path
);
1503 CreateDestDIR( CLASS
, self
, boot_path
"/grub", dest_Path
);
1505 // Copy kernel files
1506 CopyMem(source_Path
, srcPath
, srcLen
+ 1);
1507 AddPart(srcPath
, boot_path
, srcLen
+ strlen(boot_path
) + 1);
1508 sprintf(dstPath
, "%s:%s", dest_Path
, boot_path
);
1509 DoMethod(self
, MUIM_IC_CopyFiles
, srcPath
, dstPath
, 3, 0, FALSE
);
1512 D(bug("[INSTALLER] Installing Grub...\n"));
1513 set(data
->label
, MUIA_Text_Contents
, "Installing Grub...");
1514 set(data
->pageheader
, MUIA_Text_Contents
, KMsgBootLoader
);
1516 set(data
->gauge2
, MUIA_Gauge_Current
, 0);
1518 set(data
->label
, MUIA_Text_Contents
, "Copying BOOT files...");
1520 while (grub_files
[file_count
]!=NULL
)
1522 ULONG newSrcLen
= srcLen
+ strlen(grub_files
[file_count
]) + 2;
1523 ULONG newDstLen
= dstLen
+ strlen(grub_files
[file_count
+1]) + 2;
1525 TEXT srcFile
[newSrcLen
];
1526 TEXT dstFile
[newDstLen
];
1528 CopyMem(source_Path
, srcFile
, srcLen
+ 1);
1529 sprintf(dstFile
,"%s:",dest_Path
);
1530 AddPart(srcFile
, grub_files
[file_count
], newSrcLen
);
1531 AddPart(dstFile
, grub_files
[file_count
+1], newDstLen
);
1533 set(data
->actioncurrent
, MUIA_Text_Contents
, srcFile
);
1534 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1536 DoMethod(self
, MUIM_IC_CopyFile
, srcFile
, dstFile
);
1538 set(data
->gauge2
, MUIA_Gauge_Current
, ((100/(numgrubfiles
+1)) * (file_count
/2)));
1543 /* Add entry to boot MS Windows if present */
1545 if ((part_no
= FindWindowsPartition(boot_Device
, boot_Unit
)) != -1)
1547 STRPTR menu_file_path
= "boot/grub/menu.lst";
1548 sprintf(tmp
, "%s:%s", dest_Path
, menu_file_path
);
1549 BPTR menu_file
= Open(tmp
, MODE_READWRITE
);
1550 if (menu_file
!= NULL
)
1552 Seek(menu_file
, 0, OFFSET_END
);
1554 "\ntitle Microsoft Windows\nrootnoverify (hd%ld,%ld)\nchainloader +1\n",
1555 boot_Unit
, part_no
);
1558 D(bug("[INSTALLER] Windows partition found."
1559 " Adding Windows option to GRUB menu.\n"));
1560 Execute(tmp
, NULL
, NULL
);
1564 "C:install-i386-pc DEVICE %s UNIT %d "
1565 "GRUB %s:boot/grub FORCELBA",
1566 boot_Device
, boot_Unit
, dest_Path
, dest_Path
);
1567 Execute(tmp
, NULL
, NULL
);
1568 set(data
->gauge2
, MUIA_Gauge_Current
, 100);
1571 set(data
->proceed
, MUIA_Disabled
, FALSE
);
1573 /** STEP : PACKAGE CLEANUP **/
1575 if ((BOOL)XGET(check_work, MUIA_Selected))
1577 char *fixuppackage_dirs = AllocVec((fixupdir_count+1)*sizeof(IPTR),MEMF_PUBLIC|MEMF_CLEAR);
1580 get(data->instc_options_main->opt_copyextra, MUIA_Selected, &option);
1581 if (option && (data->inst_success == MUIV_Inst_InProgress))
1583 fixuppackage_dirs[curfixup] = "Demos"; curfixup++;
1584 fixuppackage_dirs[curfixup] = "Extras"; curfixup++;
1587 get(data->instc_options_main->opt_development, MUIA_Selected, &option);
1588 if (option && (data->inst_success == MUIV_Inst_InProgress))
1590 fixuppackage_dirs[curfixup] = "Development"; curfixup++;
1591 fixuppackage_dirs[curfixup] = "Tests"; curfixup++;
1594 D(bug("[INSTALLER] Fix-Up contirbuted package 'PATHS'\n"));
1595 set(data->label, MUIA_Text_Contents, "Setting package paths...");
1596 set(data->gauge2, MUIA_Gauge_Current, 0);
1598 ULONG packagesrcLen = strlen(dest_Path);
1599 ULONG newpackagesrcLen = packagesrcLen + strlen("Prefs/Env-Archive/SYS/Packages") + 2;
1600 TEXT packagesrc[newpackagesrcLen];
1602 sprintf(packagesrc,"%s:",dest_Path);
1603 AddPart(packagesrc, "Prefs/Env-Archive/SYS/Packages", newpackagesrcLen);
1605 TEXT fixupBUF[1024];
1606 BPTR lock = Lock(packagesrc, SHARED_LOCK);
1610 UBYTE buffer[kExallBufSize];
1611 struct ExAllData *ead = (struct ExAllData*)buffer;
1612 struct ExAllControl *eac = AllocDosObject(DOS_EXALLCONTROL, NULL);
1613 eac->eac_LastKey = 0;
1617 struct ExAllData *oldEad = ead;
1622 loop = ExAll(lock, ead, kExallBufSize, ED_COMMENT, eac);
1624 if(!loop && IoErr() != ERROR_NO_MORE_ENTRIES) break;
1626 if(eac->eac_Entries != 0)
1630 if(ead->ed_Type == ST_FILE || ead->ed_Type == ST_USERDIR)
1632 ULONG srcLen = strlen(packagesrc);
1633 ULONG newSrcLen = srcLen + strlen(ead->ed_Name) + 2;
1634 TEXT srcFile[newSrcLen];
1636 CopyMem(packagesrc, srcFile, srcLen + 1);
1637 if(AddPart(srcFile, ead->ed_Name, newSrcLen))
1639 set(data->actioncurrent, MUIA_Text_Contents, ead->ed_Name);
1641 DoMethod(data->installer,MUIM_Application_InputBuffered);
1643 switch(ead->ed_Type)
1647 ULONG percent = ((100/(eac->eac_Entries))*currFile);
1648 set(data->gauge2, MUIA_Gauge_Current, percent);
1650 FixUpPackageFile(srcFile, &fixuppackage_dirs,fixupdir_count);
1656 D(bug("[INSTALLER] BUG"));// %s%s (%d - %d - %d) %s\n",message->dir, ead->ed_Name, dirlen, strlen(ead->ed_Name), newlen, dir));
1660 } while((ead != NULL)&&(data->inst_success == MUIV_Inst_InProgress));
1662 } while((loop)&&(data->inst_success == MUIV_Inst_InProgress));
1664 FreeDosObject(DOS_EXALLCONTROL, eac);
1669 D(bug("[INSTALLER] Failed to lock package path: %s (Error: %d)\n", packagesrc, IoErr()));
1672 set(data->gauge2, MUIA_Gauge_Current, 100);
1675 /** STEP : UNDORECORD CLEANUP **/
1677 D(bug("[INSTALLER] Reached end of Install Function - cleaning up undo logs @ %x...\n",&data
->instc_undorecord
));
1679 struct InstallC_UndoRecord
*CurUndoNode
=NULL
;
1681 ForeachNode(&data
->instc_undorecord
, CurUndoNode
)
1683 D(bug("[INSTALLER] Removing undo record @ %x\n",CurUndoNode
));
1684 Remove(CurUndoNode
);
1686 switch (CurUndoNode
->undo_method
)
1688 case MUIM_IC_CopyFile
:
1689 D(bug("[INSTALLER] Deleting undo file '%s'\n",CurUndoNode
->undo_src
));
1690 DeleteFile(CurUndoNode
->undo_src
);
1692 FreeVec(CurUndoNode
->undo_dst
);
1693 FreeVec(CurUndoNode
->undo_src
);
1698 FreeMem(CurUndoNode
, sizeof(struct InstallC_UndoRecord
));
1704 IPTR Install__MUIM_RefreshWindow
1706 Class
*CLASS
, Object
*self
, Msg message
1709 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
1710 ULONG cur_width
,cur_height
;
1712 get( data
->window
, MUIA_Window_Width
, &cur_width
);
1713 get( data
->window
, MUIA_Window_Height
, &cur_height
);
1715 if ((data
->cur_width
!= cur_width
)||(data
->cur_height
!= cur_height
))
1717 DoMethod(data
->contents
,MUIM_Hide
);
1718 DoMethod(data
->contents
,MUIM_Layout
);
1719 DoMethod(data
->contents
,MUIM_Show
);
1721 else MUI_Redraw(data
->contents
, MADF_DRAWOBJECT
);
1726 static LONG
FindWindowsPartition(STRPTR device
, LONG unit
)
1729 struct PartitionType type
;
1730 struct PartitionHandle
*root
, *partition
;
1731 LONG partition_no
= -1, i
= 0;
1733 if((root
= OpenRootPartition(device
, unit
)) != NULL
)
1735 if (OpenPartitionTable(root
) == 0)
1737 /* Look for an active partition with a Windows FS */
1738 ForeachNode(&root
->table
->list
, partition
)
1740 GetPartitionAttrsTags
1743 PT_ACTIVE
, (IPTR
) &active
,
1744 PT_TYPE
, (IPTR
) &type
,
1748 if (active
&& (id
== 0x7 || id
== 0xb))
1752 ClosePartitionTable(root
);
1754 CloseRootPartition(root
);
1757 return partition_no
;
1760 int CreateDestDIR( Class
*CLASS
, Object
*self
, TEXT
*dest_dir
, TEXT
* destination_Path
)
1762 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
1763 ULONG dstLen
= (strlen(destination_Path
)+1);
1764 ULONG destDirLen
= dstLen
+ strlen(dest_dir
) + 2;
1765 TEXT newDestDir
[destDirLen
];
1767 sprintf(newDestDir
,"%s:",destination_Path
);
1768 AddPart(newDestDir
, dest_dir
, destDirLen
);
1770 BPTR destDirLock
= Lock(newDestDir
, ACCESS_READ
);
1771 if (destDirLock
== NULL
)
1773 destDirLock
= CreateDir(newDestDir
); /* create the newDestDir dir */
1774 if(destDirLock
== NULL
)
1776 D(bug("[INSTALLER] CreateDestDIR: Failed to create '%s' dir!!\n",newDestDir
));
1777 data
->inst_success
= MUIV_Inst_Failed
;
1780 D(bug("[INSTALLER] CreateDestDIR: Created dest dir '%s'\n",newDestDir
));
1784 D(bug("[INSTALLER] CreateDestDIR: Dir '%s' already exists\n",newDestDir
));
1787 UnLock(destDirLock
);
1792 int CopyDirArray( Class
*CLASS
, Object
*self
, struct Install_DATA
* data
, TEXT
*copy_files
[], TEXT
* destination_Path
)
1800 ULONG srcLen
= strlen(source_Path
);
1801 ULONG dstLen
= (strlen(destination_Path
)+1);
1803 set(data
->gauge2
, MUIA_Gauge_Current
, 0);
1805 while (copy_files
[numdirs
]!=NULL
)
1809 numdirs
= (numdirs
- 1)/2;
1811 D(bug("[INSTALLER.CDA] Copying %d Dirs...\n",numdirs
));
1813 while (copy_files
[dir_count
]!=NULL
)
1815 ULONG newSrcLen
= srcLen
+ strlen(copy_files
[dir_count
]) + 2;
1816 ULONG newDstLen
= dstLen
+ strlen(copy_files
[dir_count
+1]) + 2;
1818 TEXT srcDirs
[newSrcLen
+ strlen(".info") ];
1819 TEXT dstDirs
[newDstLen
+ strlen(".info")];
1821 CopyMem(source_Path
, srcDirs
, srcLen
+ 1);
1822 sprintf(dstDirs
,"%s:",destination_Path
);
1823 AddPart(srcDirs
, copy_files
[dir_count
], newSrcLen
);
1824 AddPart(dstDirs
, copy_files
[dir_count
+1], newDstLen
);
1826 set(data
->actioncurrent
, MUIA_Text_Contents
, srcDirs
);
1829 if ((lock
= Lock(srcDirs
, ACCESS_READ
)) != NULL
)
1835 retry
= AskRetry( CLASS
, self
,"Couldn't find %s\nRetry?",dstDirs
,"Yes","Skip","Cancel");
1843 default: /* cancel */
1844 DoMethod(self
, MUIM_IC_QuitInstall
);
1848 noOfFiles
= DoMethod(self
, MUIM_IC_MakeDirs
, srcDirs
, dstDirs
);
1850 /* OK Now copy the contents */
1851 noOfFiles
+= DoMethod(self
, MUIM_IC_CopyFiles
, srcDirs
, dstDirs
, noOfFiles
, 0, TRUE
);
1853 /* check if folder has an icon */
1854 CopyMem(".info", srcDirs
+ strlen(srcDirs
) , strlen(".info") + 1);
1855 CopyMem(".info", dstDirs
+ strlen(dstDirs
) , strlen(".info") + 1);
1856 if ((lock
= Lock(srcDirs
, ACCESS_READ
)) != NULL
)
1859 DoMethod(self
, MUIM_IC_CopyFile
, srcDirs
, dstDirs
);
1862 set(data
->gauge2
, MUIA_Gauge_Current
, ((100/(numdirs
+1)) * (dir_count
/2)));
1863 /* Folder copied /skipped */
1867 return ((dir_count
/2) - skip_count
); /* Return no. of successfully copied dirs */
1870 BOOL
FormatPartition(CONST_STRPTR device
, CONST_STRPTR name
)
1872 BOOL success
= FALSE
;
1874 if (Inhibit(device
, DOSTRUE
))
1876 success
= Format(device
, name
, ID_INTER_FFS_DISK
);
1877 Inhibit(device
, DOSFALSE
);
1883 IPTR Install__MUIM_Format
1885 Class
*CLASS
, Object
*self
, Msg message
1888 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
1889 char dev_nametmp
[100];
1890 char fmt_nametmp
[100];
1891 BOOL success
= FALSE
;
1892 IPTR option
= FALSE
;
1896 sprintf(fmt_nametmp
,"Formatting '%s'...",dest_Path
);
1897 D(bug("[INSTALLER] %s\n",fmt_nametmp
));
1898 set(data
->label
, MUIA_Text_Contents
, fmt_nametmp
);
1899 set(data
->gauge2
, MUIA_Gauge_Current
, 0);
1902 sprintf(dev_nametmp
,"%s:",dest_Path
);
1904 if ((BOOL
)XGET(check_formatsys
,MUIA_Selected
))
1906 #if !defined(USE_FORMAT64)
1907 D(bug("[INSTALLER] (info) Using FormatPartition\n"));
1908 success
= FormatPartition(dev_nametmp
, kDstPartName
);
1910 sprintf(tmp
,"SYS:Extras/aminet/Format64 DRIVE=%s NAME=%s FFS INTL QUICK",dev_nametmp
, kDstPartName
);
1911 D(bug("[INSTALLER] (info) Using '%s'\n",tmp
));
1912 success
= (BOOL
)Execute(tmp
, NULL
, NULL
);
1914 if (success
) set(data
->gauge2
, MUIA_Gauge_Current
, 100);
1917 get(check_work
, MUIA_Selected
, &option
);
1918 if (option
&& XGET(check_formatwork
,MUIA_Selected
))
1920 /* Format Vol1, if it's not already formated */
1921 sprintf(fmt_nametmp
,"Formatting '%s'...",work_Path
);
1922 D(bug("[INSTALLER] %s\n",fmt_nametmp
));
1923 set(data
->label
, MUIA_Text_Contents
, fmt_nametmp
);
1925 set(data
->gauge2
, MUIA_Gauge_Current
, 0);
1927 sprintf(dev_nametmp
,"%s:",work_Path
);
1928 #if !defined(USE_FORMAT64)
1929 D(bug("[INSTALLER] (info) Using FormatPartition\n"));
1930 FormatPartition(dev_nametmp
, kDstWorkName
);
1932 sprintf(tmp
,"SYS:Extras/aminet/Format64 DRIVE=%s NAME=%s FFS QUICK",dev_nametmp
,kDstWorkName
);
1933 D(bug("[INSTALLER] (info) Using '%s'\n",tmp
));
1934 success
= (BOOL
)Execute(tmp
, NULL
, NULL
);
1938 sprintf(tmp
, "%s:", work_Path
);
1939 set(data
->gauge2
, MUIA_Gauge_Current
, 100);
1940 lock
= Lock(tmp
, SHARED_LOCK
); /* check the dest dir exists */
1943 D(bug("[INSTALLER] (Warning) FORMAT: Failed for chosen work partition '%s' : defaulting to sys only\n", tmp
));
1944 extras_path
= dest_Path
;
1953 if (success
) set(data
->gauge2
, MUIA_Gauge_Current
, 100);
1958 IPTR Install__MUIM_IC_MakeDirs
1960 Class
*CLASS
, Object
*self
, struct MUIP_Dir
* message
1963 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
1965 UBYTE
*buffer
= NULL
;
1968 if ((buffer
= AllocVec(4096, MEMF_CLEAR
|MEMF_PUBLIC
)) != NULL
)
1970 struct ExAllData
*ead
= (struct ExAllData
*)buffer
;
1971 struct ExAllData
*oldEad
= ead
;
1972 struct ExAllControl
*eac
= AllocDosObject(DOS_EXALLCONTROL
, NULL
);
1973 eac
->eac_LastKey
= 0;
1975 BPTR lock
= Lock(message
->dstDir
, SHARED_LOCK
); /* check the dest dir exists */
1978 BPTR dstLock
= CreateDir(message
->dstDir
); /* no, so create it */
1979 if(dstLock
!= NULL
) UnLock(dstLock
);
1982 D(bug("[INSTALLER.MD] Failed to create dest dir: %s (Error: %d)\n", message
->dstDir
, IoErr()));
1983 data
->inst_success
= MUIV_Inst_Failed
;
1993 lock
= Lock(message
->srcDir
, SHARED_LOCK
); /* get the source dir */
1996 D(bug("[INSTALLER.MD] Failed to lock dir when making the dirs: %s (Error: %d)\n", message
->srcDir
, IoErr()));
1997 data
->inst_success
= MUIV_Inst_Failed
;
2003 //D(bug("[INSTALLER.MD] Locked and loaded\n"));
2008 loop
= ExAll(lock
, ead
, kExallBufSize
, ED_COMMENT
, eac
);
2010 if(!loop
&& IoErr() != ERROR_NO_MORE_ENTRIES
)
2015 if(eac
->eac_Entries
!= 0)
2019 //D(bug("[INSTALLER.MD] Doin the entries: %d\n", ead->ed_Type));
2021 switch(ead
->ed_Type
)
2024 //D(bug("[INSTALLER.MD] Type: %d\tName: %s\n", ead->ed_Type, ead->ed_Name));
2029 #warning: TODO - add the file size to a global count for total time estimation
2034 ULONG srcLen
= strlen(message
->srcDir
);
2035 ULONG dstLen
= strlen(message
->dstDir
);
2036 ULONG newSrcLen
= srcLen
+ strlen(ead
->ed_Name
) + 2;
2037 ULONG newDstLen
= dstLen
+ strlen(ead
->ed_Name
) + 2;
2039 TEXT srcDir
[newSrcLen
];
2040 TEXT dstDir
[newDstLen
];
2042 CopyMem(message
->srcDir
, srcDir
, srcLen
+ 1);
2043 CopyMem(message
->dstDir
, dstDir
, dstLen
+ 1);
2044 if(AddPart(srcDir
, ead
->ed_Name
, newSrcLen
) && AddPart(dstDir
, ead
->ed_Name
, newDstLen
))
2046 //D(bug("[INSTALLER.MD] R: %s -> %s \n", srcDir, dstDir));
2047 BPTR dirLock
= CreateDir(dstDir
);
2048 if(dirLock
!= NULL
) UnLock(dirLock
);
2049 noOfFiles
+= DoMethod(self
, MUIM_IC_MakeDirs
, srcDir
, dstDir
);
2053 data
->inst_success
= MUIV_Inst_Failed
;
2054 D(bug("[INSTALLER.MD] BUG"));// %s%s (%d - %d - %d) %s\n",message->dir, ead->ed_Name, dirlen, strlen(ead->ed_Name), newlen, dir));
2060 } while((ead
!= NULL
)&&(data
->inst_success
== MUIV_Inst_InProgress
));
2062 } while((loop
)&&(data
->inst_success
== MUIV_Inst_InProgress
));
2064 FreeDosObject(DOS_EXALLCONTROL
, eac
);
2071 #warning "TODO: Warn out of mem creating dir tree"
2077 IPTR Install__MUIM_IC_CopyFiles
2079 Class
*CLASS
, Object
*self
, struct MUIP_CopyFiles
* message
2082 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
2083 UBYTE
*buffer
= NULL
;
2084 BPTR lock
= Lock(message
->srcDir
, SHARED_LOCK
);
2088 D(bug("[INSTALLER.CFs] Failed to lock dir/file when copying files: %s (Error: %d)\n", message
->srcDir
, IoErr()));
2089 data
->inst_success
= MUIV_Inst_Failed
;
2093 if ((buffer
= AllocVec(kExallBufSize
, MEMF_CLEAR
|MEMF_PUBLIC
)) != NULL
)
2095 struct ExAllData
*ead
= (struct ExAllData
*)buffer
;
2096 struct ExAllControl
*eac
= AllocDosObject(DOS_EXALLCONTROL
, NULL
);
2097 eac
->eac_LastKey
= 0;
2100 struct ExAllData
*oldEad
= ead
;
2105 loop
= ExAll(lock
, ead
, kExallBufSize
, ED_COMMENT
, eac
);
2107 if(!loop
&& IoErr() != ERROR_NO_MORE_ENTRIES
) break;
2109 if(eac
->eac_Entries
!= 0)
2113 if(ead
->ed_Type
== ST_FILE
|| ead
->ed_Type
== ST_USERDIR
)
2115 ULONG srcLen
= strlen(message
->srcDir
);
2116 ULONG dstLen
= strlen(message
->dstDir
);
2117 ULONG newSrcLen
= srcLen
+ strlen(ead
->ed_Name
) + 2;
2118 ULONG newDstLen
= dstLen
+ strlen(ead
->ed_Name
) + 2;
2120 TEXT srcFile
[newSrcLen
];
2121 TEXT dstFile
[newDstLen
];
2123 CopyMem(message
->srcDir
, srcFile
, srcLen
+ 1);
2124 CopyMem(message
->dstDir
, dstFile
, dstLen
+ 1);
2125 if(AddPart(srcFile
, ead
->ed_Name
, newSrcLen
) && AddPart(dstFile
, ead
->ed_Name
, newDstLen
))
2127 //D(bug("[INSTALLER] R: %s -> %s \n", srcFile, dstFile));
2128 set(data
->actioncurrent
, MUIA_Text_Contents
, srcFile
);
2130 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
2132 switch(ead
->ed_Type
)
2135 DoMethod(self
, MUIM_IC_CopyFile
, srcFile
, dstFile
);
2137 message
->currFile
++;
2141 if(!message
->recursive
)
2144 if(data
->instc_undoenabled
)
2147 if ((dlock
= Lock(message
->dstDir
, ACCESS_READ
))==NULL
) break;
2150 char *tmppath
= AllocVec((strlen(message
->dstDir
) - strlen(dest_Path
))+strlen(instalationtmp_path
) + 3, MEMF_CLEAR
| MEMF_PUBLIC
);
2153 IPTR src_point
= (((message
->dstDir
) + strlen(dest_Path
))+1),
2154 src_len
= (strlen(message
->dstDir
) - strlen(dest_Path
));
2156 sprintf(tmppath
,"%s/%s", instalationtmp_path
, src_point
);
2158 D(bug("[INSTALLER.CFs] Creating UNDO dir %s \n", tmppath
));
2159 if ((ulock
= Lock(tmppath
, ACCESS_READ
))!=NULL
)
2161 D(bug("[INSTALLER.CFs] Dir '%s' Exists - no nead to create\n",tmppath
));
2166 ulock
= CreateDir(tmppath
);
2167 if(ulock
!= NULL
) UnLock(ulock
);
2170 D(bug("[INSTALLER.CFs] Failed to create %s dir!!\n",tmppath
));
2171 data
->inst_success
= MUIV_Inst_Failed
;
2178 message
->currFile
= DoMethod(self
, MUIM_IC_CopyFiles
, srcFile
, dstFile
, message
->noOfFiles
, message
->currFile
, TRUE
);
2181 ULONG percent
= message
->currFile
== 0 ? 0 : (message
->currFile
*100)/message
->noOfFiles
;
2182 set(data
->gauge2
, MUIA_Gauge_Current
, percent
);
2186 D(bug("[INSTALLER.CFs] BUG"));// %s%s (%d - %d - %d) %s\n",message->dir, ead->ed_Name, dirlen, strlen(ead->ed_Name), newlen, dir));
2190 } while((ead
!= NULL
)&&(data
->inst_success
== MUIV_Inst_InProgress
));
2192 } while((loop
)&&(data
->inst_success
== MUIV_Inst_InProgress
));
2194 FreeDosObject(DOS_EXALLCONTROL
, eac
);
2201 #warning "TODO: Warn out of mem copying files"
2204 return message
->currFile
;
2207 IPTR Install__MUIM_IC_CopyFile
2209 Class
*CLASS
, Object
*self
, struct MUIP_CopyFile
* message
2212 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
2213 static TEXT buffer
[kBufSize
];
2214 struct InstallC_UndoRecord
*undorecord
=NULL
;
2217 BOOL copysuccess
=FALSE
;
2223 if((to
= Open(message
->dstFile
, MODE_OLDFILE
)))
2228 switch (data
->IO_Always_overwrite
)
2230 case IIO_Overwrite_Ask
:
2231 retry
= AskRetry( CLASS
, self
, "File Already Exists\nReplace %s?", message
->dstFile
, "Yes", "Yes [Always]", "No");
2236 case 1: /* Always */
2237 data
->IO_Always_overwrite
=IIO_Overwrite_Always
;
2242 case IIO_Overwrite_Always
:
2244 case IIO_Overwrite_Never
:
2248 else goto copy_retry
;
2252 /* if the user has requested - backup all replaced files */
2254 if(data
->instc_undoenabled
)
2256 if ((undorecord
= AllocMem(sizeof(struct InstallC_UndoRecord
), MEMF_CLEAR
| MEMF_PUBLIC
))==NULL
)DoMethod(self
, MUIM_IC_QuitInstall
);
2258 char *tmppath
=AllocVec((strlen(message
->dstFile
) - strlen(dest_Path
))+2, MEMF_CLEAR
| MEMF_PUBLIC
);
2260 undorecord
->undo_src
= AllocVec((strlen(message
->dstFile
) - strlen(dest_Path
))+strlen(instalationtmp_path
) + 3, MEMF_CLEAR
| MEMF_PUBLIC
);
2261 undorecord
->undo_dst
= AllocVec(strlen(message
->dstFile
)+2, MEMF_CLEAR
| MEMF_PUBLIC
);
2263 IPTR src_point
= (((message
->dstFile
) + strlen(dest_Path
))+1),
2264 src_len
= (strlen(message
->dstFile
) - strlen(dest_Path
));
2266 CopyMem(src_point
, tmppath
, src_len
);
2267 sprintf(undorecord
->undo_src
,"%s/%s", instalationtmp_path
, tmppath
);
2269 CopyMem( message
->dstFile
, undorecord
->undo_dst
, strlen(message
->dstFile
));
2271 D(bug("[INSTALLER.CF] Backup '%s' @ '%s'\n", undorecord
->undo_dst
, undorecord
->undo_src
));
2273 undorecord
->undo_method
=MUIM_IC_CopyFile
;
2276 IPTR undosrcpath
= (((IPTR
)FilePart(undorecord
->undo_src
) - (IPTR
)(undorecord
->undo_src
)) - 1);
2277 tmppath
=AllocVec(undosrcpath
+2, MEMF_CLEAR
| MEMF_PUBLIC
);
2279 CopyMem(undorecord
->undo_src
, tmppath
, undosrcpath
);
2281 if ((lock
= Lock(tmppath
, ACCESS_READ
))!=NULL
)
2283 D(bug("[INSTALLER.CF] Dir '%s' Exists - no nead to create\n",tmppath
));
2288 lock
= CreateDir(tmppath
);
2289 if(lock
!= NULL
) UnLock(lock
);
2292 D(bug("[INSTALLER.CF] Failed to create %s dir!!\n",tmppath
));
2293 data
->inst_success
= MUIV_Inst_Failed
;
2300 if((from
= Open(undorecord
->undo_dst
, MODE_OLDFILE
)))
2302 if((to
= Open(undorecord
->undo_src
, MODE_NEWFILE
)))
2309 if ((s
= Read(from
, buffer
, kBufSize
)) == -1) return 0;
2311 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
2313 if (Write(to
, buffer
, s
) == -1) return 0;
2315 } while ((s
== kBufSize
&& !err
)&&(data
->inst_success
== MUIV_Inst_InProgress
));
2324 /* Main copy code */
2327 if((from
= Open(message
->srcFile
, MODE_OLDFILE
)))
2329 if((to
= Open(message
->dstFile
, MODE_NEWFILE
)))
2336 if ((s
= Read(from
, buffer
, kBufSize
)) == -1)
2338 D(bug("[INSTALLER.CF] Failed to read: %s [ioerr=%d]\n", message
->srcFile
, IoErr()));
2343 retry
= AskRetry( CLASS
, self
, "Couldn't Open %s",message
->srcFile
,"Retry","Skip","Cancel");
2351 DoMethod(self
, MUIM_IC_QuitInstall
);
2355 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
2357 if (Write(to
, buffer
, s
) == -1)
2359 D(bug("[INSTALLER.CF] Failed to write: %s [%d bytes, ioerr=%d]\n", message
->dstFile
, s
, IoErr()));
2361 if (IoErr()==103) retry
= AskRetry( CLASS
, self
, "Couldn't Write to %s\nDisk Full!",message
->dstFile
,"Retry","Skip","Cancel");
2362 else retry
= AskRetry( CLASS
, self
, "Couldn't Write to %s",message
->dstFile
,"Retry","Skip","Cancel");
2374 DoMethod(self
, MUIM_IC_QuitInstall
);
2377 } while ((s
== kBufSize
&& !err
)&&(data
->inst_success
== MUIV_Inst_InProgress
));
2383 D(bug("[INSTALLER.CF] Failed to open '%s' for writing [ioerr=%d]\n", message
->dstFile
, IoErr()));
2384 data
->inst_success
= MUIV_Inst_Failed
;
2388 /* Add the undo record */
2389 if (undorecord
!=NULL
)
2393 D(bug("[INSTALLER.CF] Adding undo record @ %x to undo list @ %x \n", undorecord
, &data
->instc_undorecord
));
2394 AddHead(&data
->instc_undorecord
, undorecord
);
2398 D(bug("[INSTALLER.CF] Freeing undo record\n"));
2399 /* remove the backup file */
2401 DeleteFile(undorecord
->undo_src
);
2403 /* remove the undo record */
2404 FreeVec(undorecord
->undo_dst
);
2405 FreeVec(undorecord
->undo_src
);
2406 FreeMem(undorecord
, sizeof(struct InstallC_UndoRecord
));
2412 D(bug("[INSTALLER.CF] Failed to open: %s [ioerr=%d]\n", message
->srcFile
, IoErr()));
2413 data
->inst_success
= MUIV_Inst_Failed
;
2417 D(bug("[INSTALLER.CF] Failed to copy: %s [%d]\n", message
->srcFile
, IoErr()));
2418 data
->inst_success
= MUIV_Inst_Failed
;
2419 if(from
) Close(from
);
2424 IPTR Install__MUIM_IC_UndoSteps
2426 Class
*CLASS
, Object
*self
, Msg message
2429 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
2430 struct InstallC_UndoRecord
*CurUndoNode
=NULL
;
2432 D(bug("[INSTALLER.US] Performing UNDO steps...\n"));
2434 /* Disbale "UNDO" mode to prevent new records */
2435 data
->instc_undoenabled
=FALSE
;
2437 ForeachNode(&data
->instc_undorecord
, CurUndoNode
)
2439 D(bug("[INSTALLER.US] Removing undo record @ %x\n",CurUndoNode
));
2440 Remove(CurUndoNode
);
2442 switch (CurUndoNode
->undo_method
)
2444 case MUIM_IC_CopyFile
:
2445 D(bug("[INSTALLER.US] Reverting file '%s'\n",CurUndoNode
->undo_dst
));
2447 DoMethod(self
, CurUndoNode
->undo_method
, CurUndoNode
->undo_src
, CurUndoNode
->undo_dst
);
2449 D(bug("[INSTALLER.US] Deleting undo file '%s'\n",CurUndoNode
->undo_src
));
2450 DeleteFile(CurUndoNode
->undo_src
);
2452 FreeVec(CurUndoNode
->undo_dst
);
2453 FreeVec(CurUndoNode
->undo_src
);
2458 FreeMem(CurUndoNode
, sizeof(struct InstallC_UndoRecord
));
2461 D(bug("[INSTALLER.US] UNDO complete\n"));
2466 IPTR Install__MUIM_Reboot
2468 Class
*CLASS
, Object
*self
, Msg message
2471 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
2473 IPTR option
= FALSE
;
2475 get(data
->instc_options_main
->opt_reboot
, MUIA_Selected
, &option
); // Make sure the user wants to reboot
2476 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
2478 D(bug("[INSTALLER] Cold rebooting...\n"));
2483 D(bug("[INSTALLER] Install Finished [no reboot]...\n"));
2484 if (data
->inst_success
== MUIV_Inst_InProgress
) data
->inst_success
= MUIV_Inst_Completed
;
2485 set(data
->window
,MUIA_Window_CloseRequest
,TRUE
);
2488 return TRUE
; /* Keep the compiler happy... */
2492 IPTR Install__OM_SET
2494 Class
*CLASS
, Object
*self
, struct opSet
*message
2497 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
2499 struct TagItem
*tstate
= message
->ops_AttrList
,
2502 while ((tag
= NextTagItem(&tstate
)) != NULL
)
2504 switch (tag
->ti_Tag
)
2507 data
->IO_Flags
= tag
->ti_Data
;
2514 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
2517 BOOPSI_DISPATCHER(IPTR
, Install_Dispatcher
, CLASS
, self
, message
)
2519 switch (message
->MethodID
)
2522 return Install__OM_NEW(CLASS
, self
, (struct opSet
*) message
);
2525 return Install__OM_SET(CLASS
, self
, (struct opSet
*) message
);
2527 case MUIM_FindDrives
:
2528 return Install__MUIM_FindDrives(CLASS
, self
, message
);
2530 case MUIM_IC_NextStep
:
2531 return Install__MUIM_IC_NextStep(CLASS
, self
, message
);
2533 case MUIM_IC_PrevStep
:
2534 return Install__MUIM_IC_PrevStep(CLASS
, self
, message
);
2535 //cancel control methods
2536 case MUIM_IC_CancelInstall
:
2537 return Install__MUIM_IC_CancelInstall(CLASS
, self
, message
);
2539 case MUIM_IC_ContinueInstall
:
2540 return Install__MUIM_IC_ContinueInstall(CLASS
, self
, message
);
2542 case MUIM_IC_QuitInstall
:
2543 return Install__MUIM_IC_QuitInstall(CLASS
, self
, message
);
2546 return Install__MUIM_Reboot(CLASS
, self
, message
);
2548 //This should dissapear
2549 case MUIM_RefreshWindow
:
2550 return Install__MUIM_RefreshWindow(CLASS
, self
, message
);
2552 case MUIM_IC_Install
:
2553 return Install__MUIM_IC_Install(CLASS
, self
, message
);
2555 //These will be consumed by the io task
2556 case MUIM_Partition
:
2557 return Install__MUIM_Partition(CLASS
, self
, message
);
2560 return Install__MUIM_Format(CLASS
, self
, message
);
2562 case MUIM_IC_MakeDirs
:
2563 return Install__MUIM_IC_MakeDirs(CLASS
, self
, (struct MUIP_Dir
*)message
);
2565 case MUIM_IC_CopyFiles
:
2566 return Install__MUIM_IC_CopyFiles(CLASS
, self
, (struct MUIP_CopyFiles
*)message
);
2568 case MUIM_IC_CopyFile
:
2569 return Install__MUIM_IC_CopyFile(CLASS
, self
, (struct MUIP_CopyFile
*)message
);
2571 case MUIM_IC_UndoSteps
:
2572 return Install__MUIM_IC_UndoSteps(CLASS
, self
, message
);
2575 return DoSuperMethodA(CLASS
, self
, message
);
2580 BOOPSI_DISPATCHER_END
2598 int main(int argc
,char *argv
[])
2602 Object
*wnd
= NULL
; /* installer window objects - will get swallowed into the class eventually */
2603 Object
*wndcontents
= NULL
;
2604 Object
*page
= NULL
;
2606 Object
*welcomeMsg
= NULL
;
2607 Object
*LicenseMsg
= NULL
;
2608 Object
*doneMsg
= NULL
;
2610 Object
*pagetitle
= NULL
;
2611 Object
*pageheader
= NULL
;
2612 Object
*currentaction
= NULL
;
2614 Object
*radio_part
= NULL
;
2616 Object
*gad_back
= SimpleButton("<< _Back...");
2617 Object
*gad_proceed
= SimpleButton(KMsgProceed
);
2618 Object
*gad_cancel
= SimpleButton("_Cancel");
2621 Object
*io_retrywnd
= NULL
; /* IO retry objects */
2622 Object
*io_retrymessage
= NULL
;
2624 Object
*gad_io_opt1
= SimpleButton("");
2625 Object
*gad_io_opt2
= SimpleButton("");
2626 Object
*gad_io_opt3
= SimpleButton("");
2629 Object
*grub_drive
= NULL
;
2630 Object
*grub_grub
= NULL
;
2632 Object
*LicenseMandGrp
= NULL
;
2633 Object
*check_license
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Selected
,FALSE
, End
;
2635 Object
* check_format
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Selected
, TRUE
, End
;
2636 Object
* check_locale
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Selected
,FALSE
, End
;
2637 Object
* check_core
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Selected
,TRUE
, End
;
2638 Object
* check_dev
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Selected
,FALSE
, End
;
2639 Object
* check_extras
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Selected
,TRUE
, End
;
2640 Object
* check_bootloader
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Selected
,TRUE
, End
;
2642 Object
* check_reboot
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, End
;
2644 Object
* gauge1
= (GaugeObject
, MUIA_Gauge_InfoText
, "%ld %%", MUIA_Gauge_Horiz
, TRUE
, MUIA_Gauge_Current
, 0, End
);
2645 Object
* gauge2
= (GaugeObject
, MUIA_Gauge_InfoText
, "%ld %%", MUIA_Gauge_Horiz
, TRUE
, MUIA_Gauge_Current
, 0, End
);
2646 Object
* gauge3
= (GaugeObject
, MUIA_Gauge_InfoText
, "%ld %%", MUIA_Gauge_Horiz
, TRUE
, MUIA_Gauge_Current
, 0, End
);
2650 static char *opt_partentries
[] =
2652 "Only use free space",
2654 "Use existing AROS partitions (on any drive)",
2657 struct Install_Options
*install_opts
= NULL
;
2658 struct Grub_Options
*grub_opts
= NULL
;
2659 char *source_path
= NULL
;
2660 char *dest_path
= NULL
;
2661 char *work_path
= NULL
;
2665 check_copytowork
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Disabled
, TRUE
, End
;
2666 check_work
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Selected
, FALSE
, End
;
2667 check_formatsys
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Selected
,TRUE
, End
;
2668 check_formatwork
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
, MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
, MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
, MUIA_ShowSelState
, FALSE
, MUIA_Disabled
, TRUE
, End
;
2670 check_sizesys
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
,
2671 MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
,
2672 MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
,
2673 MUIA_ShowSelState
, FALSE
, MUIA_Selected
, FALSE
, End
;
2674 check_sizework
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
,
2675 MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
,
2676 MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
,
2677 MUIA_ShowSelState
, FALSE
, MUIA_Selected
, FALSE
, MUIA_Disabled
, TRUE
,
2679 check_creatework
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
,
2680 MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
,
2681 MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
,
2682 MUIA_ShowSelState
, FALSE
, MUIA_Selected
, FALSE
, MUIA_Disabled
, TRUE
,
2685 install_opts
= AllocMem( sizeof(struct Install_Options
), MEMF_CLEAR
| MEMF_PUBLIC
);
2686 grub_opts
= AllocMem( sizeof(struct Grub_Options
), MEMF_CLEAR
| MEMF_PUBLIC
);
2687 source_path
= AllocVec( 256, MEMF_CLEAR
| MEMF_PUBLIC
);
2689 dest_path
= AllocVec( 256, MEMF_CLEAR
| MEMF_PUBLIC
);
2690 work_path
= AllocVec( 256, MEMF_CLEAR
| MEMF_PUBLIC
);
2694 if (!(ExpansionBase
= (struct ExpansionBase
*)OpenLibrary("expansion.library", 0)))
2697 if (!NameFromLock(GetProgramDir(), source_path
, 255))
2699 D(bug("[INST-APP] Couldn't get progdir\n"));
2702 pathend
= FilePart(source_path
);
2703 pathend
= pathend
- (IPTR
)source_path
;
2705 D(bug("[INST-APP] Path length = %d bytes\n", pathend
));
2707 source_Path
= AllocVec( pathend
+ 1 , MEMF_CLEAR
| MEMF_PUBLIC
);
2708 CopyMem(source_path
, source_Path
, pathend
);
2709 D(bug("[INST-APP] Launched from '%s'\n", source_Path
));
2710 FreeVec(source_path
);
2712 dest_Path
= dest_path
;
2713 sprintf(dest_Path
,"" kDstPartVol
);
2715 work_Path
= work_path
;
2716 sprintf(work_Path
,"" kDstWorkVol
);
2719 lock
= Lock(DEF_INSTALL_IMAGE
, ACCESS_READ
);
2724 LicenseMsg
= NFloattextObject
,
2725 MUIA_Background
, MUII_TextBack
,
2731 D(bug("[INST-APP] Failed to create FloattextObject\n"));
2735 Object
*app
= ApplicationObject
,
2736 MUIA_Application_Title
, (IPTR
) "AROS Installer",
2737 MUIA_Application_Version
, (IPTR
) "$VER: InstallAROS 0.5 (1.9.2007)",
2738 MUIA_Application_Copyright
, (IPTR
) "Copyright © 2003-2007, The AROS Development Team. All rights reserved.",
2739 MUIA_Application_Author
, (IPTR
) "John \"Forgoil\" Gustafsson & Nic Andrews",
2740 MUIA_Application_Description
, (IPTR
) "Installs AROS on to a PC.",
2741 MUIA_Application_Base
, (IPTR
) "INSTALLER",
2743 SubWindow
, (IPTR
) (wnd
= WindowObject
,
2744 MUIA_Window_Title
, (IPTR
) "AROS Installer",
2745 MUIA_Window_ID
, MAKE_ID('f','o','r','g'),
2746 MUIA_Window_SizeGadget
, TRUE
,
2747 WindowContents
, (IPTR
) (wndcontents
= VGroup
,
2749 Child
, (IPTR
) VGroup
,
2750 Child
, (IPTR
) HGroup
,
2751 Child
, (IPTR
) VGroup
,
2752 MUIA_Background
, MUII_SHADOW
,
2754 Child
, (IPTR
) ImageObject
,
2755 MUIA_Frame
, MUIV_Frame_None
,
2756 MUIA_Image_Spec
, (IPTR
) "3:"DEF_INSTALL_IMAGE
,
2758 Child
, (IPTR
) HVSpace
,
2761 Child
, (IPTR
) ScrollgroupObject
,
2762 MUIA_Scrollgroup_FreeHoriz
, FALSE
,
2763 MUIA_Scrollgroup_FreeVert
, TRUE
,
2764 MUIA_Scrollgroup_Contents
, (IPTR
) (page
= VGroup
,
2765 MUIA_Group_PageMode
, TRUE
,
2768 /* each page represents an install time page... you must have one for each enumerated install progress page */
2770 Child
, (IPTR
) VGroup
,
2771 Child
, (IPTR
) VGroup
,
2772 Child
, (IPTR
) (welcomeMsg
= FreeCLabel("")),
2773 Child
, (IPTR
) HVSpace
,
2777 Child
, (IPTR
) VGroup
,
2778 Child
, (IPTR
) VGroup
,
2779 Child
, (IPTR
) LicenseMsg
,
2780 Child
, (IPTR
) (LicenseMandGrp
= HGroup
,
2781 Child
, (IPTR
) HVSpace
,
2782 Child
, (IPTR
) check_license
,
2783 Child
, (IPTR
) LLabel("Accept License Agreement?"),
2784 Child
, (IPTR
) HVSpace
,
2789 /* Partitioning options */
2790 Child
, (IPTR
) VGroup
,
2791 Child
, (IPTR
) VGroup
,
2792 Child
, (IPTR
) CLabel(KMsgPartitionOptions
),
2793 Child
, (IPTR
) HVSpace
,
2795 Child
, (IPTR
) ColGroup(5),
2796 Child
, (IPTR
) ColGroup(2),
2797 Child
, (IPTR
) LLabel("Device:"),
2798 Child
, (IPTR
) (dest_device
=
2800 MUIA_String_Contents
, (IPTR
) "ata.device",
2801 MUIA_String_Reject
, " \"\'*",
2802 MUIA_HorizWeight
, 200,
2804 Child
, (IPTR
) HVSpace
,
2805 Child
, (IPTR
) LLabel("Unit:"),
2806 Child
, (IPTR
) (dest_unit
=
2808 MUIA_String_Integer
, 0,
2809 MUIA_String_Accept
, "0123456789",
2810 MUIA_HorizWeight
, 20,
2815 Child
, (IPTR
) HVSpace
,
2816 Child
, (IPTR
) (radio_part
= RadioObject
,
2818 MUIA_Radio_Entries
, (IPTR
) opt_partentries
,
2820 Child
, (IPTR
) HVSpace
,
2821 Child
, (IPTR
) ColGroup(2),
2822 Child
, (IPTR
) ColGroup(2),
2823 Child
, (IPTR
) LLabel(KMsgDestPartition
),
2824 Child
, (IPTR
) HVSpace
,
2827 Child
, (IPTR
) ColGroup(6),
2828 Child
, (IPTR
) LLabel("Size:"),
2829 Child
, (IPTR
) (sys_size
= StringObject
,
2830 MUIA_String_Accept
, "0123456789",
2831 MUIA_String_Integer
, 0,
2832 MUIA_Disabled
, TRUE
, End
),
2833 Child
, (IPTR
) LLabel("MB"),
2834 Child
, (IPTR
) HVSpace
,
2835 Child
, (IPTR
) check_sizesys
,
2836 Child
, (IPTR
) LLabel("Specify Size"),
2838 Child
, (IPTR
) HVSpace
,
2839 Child
, (IPTR
) ColGroup(4),
2840 Child
, (IPTR
) LLabel(KMsgWorkPartition
),
2841 Child
, (IPTR
) HVSpace
,
2842 Child
, (IPTR
) check_creatework
,
2843 Child
, (IPTR
) LLabel("Create"),
2845 Child
, (IPTR
) ColGroup(6),
2846 Child
, (IPTR
) LLabel("Size:"),
2847 Child
, (IPTR
) (work_size
= StringObject
,
2848 MUIA_String_Accept
, "0123456789",
2849 MUIA_String_Integer
, 0,
2850 MUIA_Disabled
, TRUE
, End
),
2851 Child
, (IPTR
) LLabel("MB"),
2852 Child
, (IPTR
) HVSpace
,
2853 Child
, (IPTR
) check_sizework
,
2854 Child
, (IPTR
) LLabel("Specify Size"),
2859 Child
, (IPTR
) VGroup
,
2860 Child
, (IPTR
) VGroup
,
2861 Child
, (IPTR
) CLabel(KMsgInstallOptions
),
2862 Child
, (IPTR
) HVSpace
,
2863 Child
, (IPTR
) ColGroup(2),
2864 Child
, (IPTR
) check_locale
,
2865 Child
, (IPTR
) LLabel("Choose Language Options"),
2866 Child
, (IPTR
) check_core
,
2867 Child
, (IPTR
) LLabel("Install AROS Core System"),
2868 Child
, (IPTR
) check_extras
,
2869 Child
, (IPTR
) LLabel("Install Extra Software"),
2870 Child
, (IPTR
) check_dev
,
2871 Child
, (IPTR
) LLabel("Install Development Software"),
2872 Child
, (IPTR
) check_bootloader
,
2873 Child
, (IPTR
) LLabel("Install Bootloader"),
2875 Child
, (IPTR
) HVSpace
,
2879 Child
, (IPTR
) VGroup
,
2880 Child
, (IPTR
) VGroup
,
2881 Child
, (IPTR
) CLabel(KMsgDestOptions
),
2882 Child
, (IPTR
) HVSpace
,
2883 Child
, (IPTR
) ColGroup(2),
2884 Child
, (IPTR
) ColGroup(2),
2885 Child
, (IPTR
) LLabel(KMsgDestVolume
),
2886 Child
, (IPTR
) HVSpace
,
2888 Child
, (IPTR
) (show_formatsys
= ColGroup(2),
2889 Child
, (IPTR
) check_formatsys
,
2890 Child
, (IPTR
) LLabel("Format Partition"),
2893 Child
, (IPTR
) HVSpace
,
2894 Child
, (IPTR
) (dest_volume
= StringObject
,
2895 MUIA_String_Contents
, (IPTR
) dest_Path
,
2897 Child
, (IPTR
) HVSpace
,
2898 Child
, (IPTR
) ColGroup(2),
2899 Child
, (IPTR
) check_work
,
2900 Child
, (IPTR
) LLabel("Use 'Work' Partition"),
2901 Child
, (IPTR
) check_copytowork
,
2902 Child
, (IPTR
) LLabel("Copy Extras and Developer Files to Work"),
2904 Child
, (IPTR
) HVSpace
,
2906 Child
, (IPTR
) ColGroup(2),
2907 Child
, (IPTR
) ColGroup(2),
2908 Child
, (IPTR
) LLabel(KMsgWorkVolume
),
2909 Child
, (IPTR
) HVSpace
,
2911 Child
, (IPTR
) (show_formatwork
= ColGroup(2),
2912 Child
, (IPTR
) check_formatwork
,
2913 Child
, (IPTR
) LLabel("Format Partition"),
2916 Child
, (IPTR
) HVSpace
,
2917 Child
, (IPTR
) (work_volume
=
2919 MUIA_String_Contents
,
2921 MUIA_Disabled
, TRUE
,
2923 Child
, (IPTR
) HVSpace
,
2927 /* Bootloader options */
2928 Child
, (IPTR
) VGroup
,
2929 Child
, (IPTR
) VGroup
,
2930 Child
, (IPTR
) CLabel(KMsgGrubOptions
),
2931 Child
, (IPTR
) HVSpace
,
2932 Child
, (IPTR
) LLabel(KMsgGrubGOptions
),
2933 Child
, (IPTR
) LLabel(KMsgGrubDrive
),
2934 Child
, (IPTR
) HVSpace
,
2935 Child
, (IPTR
) (grub_drive
= TextObject
, MUIA_Text_PreParse
, (IPTR
) "" MUIX_C
, MUIA_Text_Contents
, (IPTR
)" ",End
),
2936 Child
, (IPTR
) HVSpace
,
2937 Child
, (IPTR
) LLabel(KMsgGrubGrub
),
2938 Child
, (IPTR
) HVSpace
,
2939 Child
, (IPTR
) (grub_grub
= TextObject
, MUIA_Text_PreParse
, (IPTR
) "" MUIX_C
, MUIA_Text_Contents
, (IPTR
)" ",End
),
2940 Child
, (IPTR
) HVSpace
,
2944 Child
, (IPTR
) VGroup
,
2945 Child
, (IPTR
) VGroup
,
2946 Child
, (IPTR
) CLabel(KMsgPartitioning
),
2947 Child
, (IPTR
) HVSpace
,
2948 Child
, (IPTR
) VGroup
, GaugeFrame
,MUIA_Background
, MUII_HSHINEBACK
, Child
, gauge1
, End
,
2949 Child
, (IPTR
) ScaleObject
, End
,
2950 Child
, (IPTR
) HVSpace
,
2954 Child
, (IPTR
) VGroup
,
2955 Child
, (IPTR
) VGroup
,
2956 Child
, (IPTR
) CLabel(KMsgPartitioning
),
2957 Child
, (IPTR
) HVSpace
,
2958 Child
, (IPTR
) VGroup
, GaugeFrame
,MUIA_Background
, MUII_HSHINEBACK
, Child
, (IPTR
) gauge3
, End
,
2959 Child
, (IPTR
) ScaleObject
, End
,
2960 Child
, (IPTR
) HVSpace
,
2964 Child
, (IPTR
) VGroup
,
2965 Child
, (IPTR
) VGroup
,
2966 Child
, (IPTR
) (pagetitle
= CLabel(" ")),
2967 Child
, (IPTR
) HVSpace
,
2968 Child
, (IPTR
) (pageheader
= FreeCLabel(KMsgInstall
)),
2969 Child
, (IPTR
) HVSpace
,
2970 Child
, (IPTR
) (label
= FreeLLabel("YOU SHOULD NOT SEE THIS")),
2971 Child
, (IPTR
) HVSpace
,
2972 Child
, (IPTR
) (currentaction
= TextObject
,MUIA_Text_Contents
,(IPTR
)" ",End
),
2973 Child
, (IPTR
) VGroup
, GaugeFrame
,MUIA_Background
, MUII_HSHINEBACK
, Child
, gauge2
, End
,
2974 Child
, (IPTR
) HVSpace
,
2978 /* Completed page */
2979 Child
, (IPTR
) VGroup
,
2980 Child
, (IPTR
) VGroup
,
2981 MUIA_Group_SameHeight
, FALSE
,
2982 Child
, (IPTR
) (doneMsg
= FreeCLabel(KMsgDone
)),
2983 Child
, (IPTR
) HVSpace
,
2984 Child
, (IPTR
) (reboot_group
= ColGroup(2),
2987 Child
, (IPTR
) check_reboot
,
2988 Child
, (IPTR
) LLabel("Reboot AROS now"),
2998 Child
, (IPTR
) HGroup
,
2999 Child
, (IPTR
) HVSpace
,
3000 Child
, (IPTR
) gad_back
,
3001 Child
, (IPTR
) gad_proceed
,
3002 Child
, (IPTR
) gad_cancel
,
3007 SubWindow
, (IPTR
) (io_retrywnd
= WindowObject
,
3008 MUIA_Window_Title
, (IPTR
) "IO Error has occured",
3009 MUIA_Window_SizeGadget
, TRUE
,
3010 WindowContents
, (IPTR
) VGroup
,
3011 Child
, (IPTR
) HVSpace
,
3012 Child
, (IPTR
) (io_retrymessage
= TextObject
, MUIA_Text_PreParse
, (IPTR
) "" MUIX_C
, MUIA_Text_Contents
, (IPTR
)" ",End
),
3013 Child
, (IPTR
) HVSpace
,
3014 Child
, (IPTR
) HGroup
,
3016 Child
, (IPTR
) HSpace(0),
3017 Child
, (IPTR
) HGroup
,
3018 Child
, (IPTR
) gad_io_opt1
,
3019 Child
, (IPTR
) gad_io_opt2
,
3020 Child
, (IPTR
) gad_io_opt3
,
3030 D(bug("[INST-APP] Failed to create Installer GUI\n"));
3034 /* Update GUI in response to certain user actions */
3035 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Disabled
, MUIV_EveryTime
,
3036 (IPTR
) dest_device
, 3, MUIM_Set
,
3037 MUIA_Disabled
, MUIV_TriggerValue
);
3038 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Disabled
, MUIV_EveryTime
,
3039 (IPTR
) dest_unit
, 3, MUIM_Set
,
3040 MUIA_Disabled
, MUIV_TriggerValue
);
3041 DoMethod(radio_part
, MUIM_Notify
, (IPTR
) MUIA_Radio_Active
, 0,
3042 (IPTR
) check_sizesys
, 3, MUIM_Set
,
3043 MUIA_Disabled
, FALSE
);
3044 DoMethod(radio_part
, MUIM_Notify
, (IPTR
) MUIA_Radio_Active
, 1,
3045 (IPTR
) check_sizesys
, 3, MUIM_Set
,
3046 MUIA_Disabled
, FALSE
);
3047 DoMethod(radio_part
, MUIM_Notify
, (IPTR
) MUIA_Radio_Active
, 2,
3048 (IPTR
) check_sizesys
, 3, MUIM_Set
,
3049 MUIA_Disabled
, TRUE
);
3050 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3051 (IPTR
) check_creatework
, 3, MUIM_Set
,
3052 MUIA_Disabled
, MUIV_NotTriggerValue
);
3053 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3054 (IPTR
) check_creatework
, 3, MUIM_Set
,
3055 MUIA_Selected
, FALSE
);
3056 DoMethod(check_creatework
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3057 (IPTR
) check_sizework
, 3, MUIM_Set
,
3058 MUIA_Disabled
, MUIV_NotTriggerValue
);
3059 DoMethod(check_creatework
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3060 (IPTR
) check_sizework
, 3, MUIM_Set
,
3061 MUIA_Selected
, FALSE
);
3062 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3063 (IPTR
) sys_size
, 3, MUIM_Set
,
3064 MUIA_Disabled
, MUIV_NotTriggerValue
);
3065 DoMethod(check_sizework
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3066 (IPTR
) work_size
, 3, MUIM_Set
,
3067 MUIA_Disabled
, MUIV_NotTriggerValue
);
3069 #if 0 /* Notification doesn't seem to work on String gadgets */
3070 DoMethod(dest_volume
, MUIM_Notify
, MUIA_String_Contents
, MUIV_EveryTime
,
3071 (IPTR
) dest_volume
, 3, MUIM_WriteString
,
3072 MUIV_TriggerValue
, dest_Path
);
3075 DoMethod(check_core
, MUIM_Notify
, MUIA_Selected
, FALSE
,
3076 (IPTR
) check_formatsys
, 3, MUIM_Set
,
3077 MUIA_Selected
, FALSE
);
3078 DoMethod(check_work
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3079 (IPTR
) check_copytowork
, 3, MUIM_Set
,
3080 MUIA_Disabled
, MUIV_NotTriggerValue
);
3081 DoMethod(check_work
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3082 (IPTR
) check_copytowork
, 3, MUIM_Set
,
3083 MUIA_Selected
, FALSE
);
3084 DoMethod(check_work
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3085 (IPTR
) check_formatwork
, 3, MUIM_Set
,
3086 MUIA_Disabled
, MUIV_NotTriggerValue
);
3087 DoMethod(check_work
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3088 (IPTR
) check_formatwork
, 3, MUIM_Set
,
3089 MUIA_Selected
, FALSE
);
3090 DoMethod(check_work
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3091 (IPTR
) work_volume
, 3, MUIM_Set
,
3092 MUIA_Disabled
, MUIV_NotTriggerValue
);
3095 install_opts
->opt_license
= check_license
;
3096 install_opts
->opt_lic_box
= LicenseMsg
;
3097 install_opts
->opt_lic_mgrp
= LicenseMandGrp
;
3099 install_opts
->opt_partmethod
= radio_part
;
3101 install_opts
->opt_format
= check_format
;
3102 install_opts
->opt_locale
= check_locale
;
3103 install_opts
->opt_copycore
= check_core
;
3104 install_opts
->opt_copyextra
= check_extras
;
3105 install_opts
->opt_development
= check_dev
;
3106 install_opts
->opt_bootloader
= check_bootloader
;
3108 install_opts
->opt_reboot
= check_reboot
;
3110 grub_opts
->gopt_drive
= grub_drive
;
3111 grub_opts
->gopt_grub
= grub_grub
;
3113 struct MUI_CustomClass
*mcc
= MUI_CreateCustomClass(NULL
, MUIC_Notify
, NULL
, sizeof(struct Install_DATA
), Install_Dispatcher
);
3114 Object
*installer
= NewObject(mcc
->mcc_Class
, NULL
,
3116 MUIA_Page
, (IPTR
) page
,
3117 MUIA_Gauge1
, (IPTR
) gauge1
,
3118 MUIA_Gauge2
, (IPTR
) gauge2
,
3119 MUIA_Install
, (IPTR
) label
,
3122 MUIA_OBJ_Installer
,(IPTR
) app
,
3124 MUIA_WelcomeMsg
, (IPTR
) welcomeMsg
,
3125 MUIA_FinishedMsg
, (IPTR
) doneMsg
,
3127 MUIA_List_Options
, (IPTR
) install_opts
,
3128 MUIA_Grub_Options
, (IPTR
) grub_opts
,
3130 MUIA_OBJ_WindowContent
,(IPTR
) wndcontents
,
3131 MUIA_OBJ_Window
,(IPTR
) wnd
,
3133 MUIA_OBJ_PageTitle
, (IPTR
) pagetitle
,
3134 MUIA_OBJ_PageHeader
, (IPTR
) pageheader
,
3135 MUIA_OBJ_CActionStrng
, (IPTR
) currentaction
,
3136 MUIA_OBJ_Back
,(IPTR
) gad_back
,
3137 MUIA_OBJ_Proceed
,(IPTR
) gad_proceed
,
3138 MUIA_OBJ_Cancel
,(IPTR
) gad_cancel
,
3140 MUIA_OBJ_IO_RWindow
,(IPTR
) io_retrywnd
,
3141 MUIA_OBJ_IO_RText
, (IPTR
) io_retrymessage
,
3142 MUIA_OBJ_IO_ROpt1
, (IPTR
) gad_io_opt1
,
3143 MUIA_OBJ_IO_ROpt2
, (IPTR
) gad_io_opt2
,
3144 MUIA_OBJ_IO_ROpt3
, (IPTR
) gad_io_opt3
,
3146 MUIA_IC_EnableUndo
, TRUE
,
3148 // MUIA_IC_License_File,"HELP:English/license", /* License can only be viewed by highlighting text and dragging */
3149 MUIA_IC_License_Mandatory
, TRUE
,
3154 /** Start - NEW!! this is part of the "class" change ;) **/
3158 IPTR install_content1
[20],install_content2
[20],install_content3
[20],install_content4
[20],install_content5
[20],install_content6
[20];
3159 IPTR install_pages
[20];
3161 /* page descriptions */
3163 install_content1
[0] = INSTV_TEXT
;
3164 install_content1
[1] = (IPTR
) KMsgWelcome
;
3166 install_content1
[2] = TAG_DONE
;
3169 install_content2
[0] = INSTV_TEXT
;
3170 install_content2
[1] = (IPTR
) KMsgInstallOptions
;
3172 install_content2
[0] = INSTV_SPACE
;
3173 install_content2
[1] = TAG_IGNORE
;
3175 install_content2
[0] = INSTV_BOOL
;
3176 install_content2
[1] = (IPTR
) check_autopart
;
3178 install_content2
[2] = INSTV_BOOL
;
3179 install_content2
[3] = (IPTR
) check_locale
;
3181 install_content2
[4] = INSTV_BOOL
;
3182 install_content2
[5] = (IPTR
) check_core
;
3184 install_content2
[6] = INSTV_BOOL
;
3185 install_content2
[7] = (IPTR
) check_extras
;
3187 install_content2
[8] = INSTV_BOOL
;
3188 install_content2
[9] = (IPTR
) check_bootloader
;
3190 install_content2
[10] = TAG_DONE
;
3192 /* Prepare Drives Page */
3193 install_content3
[0] = INSTV_TEXT
;
3194 install_content3
[1] = (IPTR
) KMsgPartitioning
;
3196 install_content3
[2] = INSTV_RETURN
;
3197 install_content3
[3] = OPTION_PREPDRIVES
;
3199 install_content3
[4] = TAG_DONE
;
3202 install_content4
[0] = INSTV_TEXT
;
3203 install_content4
[1] = (IPTR
) KMsgPartitioningWipe
;
3205 install_content4
[2] = INSTV_RETURN
;
3206 install_content4
[3] = OPTION_FORMAT
;
3208 install_content4
[4] = TAG_DONE
;
3211 install_content5
[4] = TAG_DONE
;
3214 install_content6
[0] = INSTV_TEXT
;
3215 install_content6
[1] = (IPTR
) KMsgDone
;
3217 install_content6
[2] = TAG_DONE
;
3218 /* installer pages */
3220 install_pages
[0] = INSTV_CURR
;
3221 install_pages
[1] = (IPTR
) install_content1
;
3223 install_pages
[0] = INSTV_TITLE
;
3224 install_pages
[1] = (IPTR
)"AROS Installer";
3226 install_pages
[0] = INSTV_LOGO
;
3227 install_pages
[1] = (IPTR
)"3:"DEF_INSTALL_IMAGE
;
3229 install_pages
[0] = INSTV_PAGE
;
3230 install_pages
[1] = (IPTR
) install_content1
;
3232 install_pages
[2] = INSTV_PAGE
;
3233 install_pages
[3] = (IPTR
) install_content2
;
3235 install_pages
[4] = INSTV_PAGE
;
3236 install_pages
[5] = (IPTR
) install_content3
;
3238 install_pages
[6] = INSTV_PAGE
;
3239 install_pages
[7] = (IPTR
) install_content4
;
3241 install_pages
[8] = INSTV_PAGE
;
3242 install_pages
[9] = (IPTR
) install_content5
;
3244 install_pages
[10] = INSTV_PAGE
;
3245 install_pages
[11] = (IPTR
) install_content6
;
3247 install_pages
[12] = TAG_DONE
;
3250 /** End - NEW!! this is part of the "class" change ;) **/
3253 DoMethod(wnd
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
, app
,2,MUIM_Application_ReturnID
,MUIV_Application_ReturnID_Quit
);
3255 set(wnd
,MUIA_Window_Open
,TRUE
);
3259 while (DoMethod(app
,MUIM_Application_NewInput
,&sigs
) != MUIV_Application_ReturnID_Quit
)
3263 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
3264 if (sigs
& SIGBREAKF_CTRL_C
) break;
3269 D(bug("[INST-APP] Closing Window\n"));
3271 set(wnd
,MUIA_Window_Open
,FALSE
);
3273 D(bug("[INST-APP] Disposing of Installer Object\n"));
3275 DisposeObject(installer
);
3277 D(bug("[INST-APP] Removing Custom Class\n"));
3279 MUI_DeleteCustomClass(mcc
);
3281 D(bug("[INST-APP] Removing App Object\n"));
3283 MUI_DisposeObject(app
);