2 Copyright © 2003-2009, The AROS Development Team. All rights reserved.
6 #define INTUITION_NO_INLINE_STDARG
9 #include <aros/debug.h>
11 #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/TextEditor_mcc.h>
49 #define kBufSize (4*65536)
50 #define kExallBufSize (4096)
52 #define kDstPartVol "DH0"
53 #define kDstWorkVol "DH1"
54 #define package_Path "SYS:"
55 #define kDstPartName "AROS"
56 #define kDstWorkName "Work"
58 #define MAX_FFS_SIZE (4L * 1024)
59 #define MAX_SFS_SIZE (124L * 1024)
61 #define INSTALLER_TMP_PATH "T:Installer"
62 #define INSTALLAROS_TMP_PATH "T:Installer/InstallAROS"
64 #define localeFile_path "Prefs/Locale\""
65 #define inputFile_path "Prefs/Input\""
66 #define prefssrc_path "ENV:SYS"
67 #define prefs_path "Prefs/Env-Archive/SYS"
68 #define BOOT_PATH "boot"
69 #define GRUB_PATH "grub"
71 #define locale_prfs_file "locale.prefs" /* please note the suffixed \" */
72 #define input_prfs_file "input.prefs"
74 #define DEF_INSTALL_IMAGE "IMAGES:Logos/install.logo"
75 #define DEF_BACK_IMAGE "IMAGES:Logos/install.logo"
76 #define DEF_LIGHTBACK_IMAGE "IMAGES:Logos/install.logo"
78 #define POST_INSTALL_SCRIPT "PROGDIR:InstallAROS-Post-Install"
79 #define AROS_BOOT_FILE "AROS.boot"
81 #define GRUB_COPY_FILE_LOOP \
82 SET(data->gauge2, MUIA_Gauge_Current, 0); \
84 while (grub_files[file_count] != NULL && data->inst_success == MUIV_Inst_InProgress) \
86 ULONG newSrcLen = strlen(srcPath) + strlen(grub_files[file_count]) + 2; \
87 ULONG newDstLen = strlen(dstPath) + strlen(grub_files[file_count + 1]) + 2; \
89 TEXT srcFile[newSrcLen]; \
90 TEXT dstFile[newDstLen]; \
92 sprintf(srcFile, "%s", srcPath); \
93 sprintf(dstFile, "%s", dstPath); \
94 AddPart(srcFile, grub_files[file_count], newSrcLen); \
95 AddPart(dstFile, grub_files[file_count + 1], newDstLen); \
97 DoMethod(self, MUIM_IC_CopyFile, srcFile, dstFile); \
101 if (numgrubfiles > 0) \
103 SET(data->gauge2, MUIA_Gauge_Current, \
104 (LONG)((100.0 / numgrubfiles) * (file_count / 2.0))); \
108 /** Start - NEW!! this is part of the "class" change ;) **/
110 #define OPTION_PREPDRIVES 1
111 #define OPTION_FORMAT 2
112 #define OPTION_LANGUAGE 3
113 #define OPTION_CORE 4
114 #define OPTION_EXTRAS 5
115 #define OPTION_BOOTLOADER 6
117 #define INSTV_TITLE 101001
118 #define INSTV_LOGO 101002
119 #define INSTV_PAGE 101003
121 #define INSTV_TEXT 101004
122 #define INSTV_SPACE 101005
123 #define INSTV_BOOL 101006
124 #define INSTV_RETURN 101007
126 #define INSTV_CURR 101100
128 /** End - NEW!! this is part of the "class" change ;) **/
130 struct ExpansionBase
*ExpansionBase
= NULL
;
132 char *source_Path
=NULL
; /* full path to source "tree" */
133 char *source_Name
=NULL
;
135 char *dest_Path
=NULL
; /* DOS DEVICE NAME of part used to store "aros" */
136 char *work_Path
=NULL
; /* DOS DEVICE NAME of part used to store "work" */
137 TEXT
*extras_path
= NULL
; /* DOS DEVICE NAME of part used to store extras */
142 Object
* check_copytowork
= NULL
;
143 Object
* check_work
= NULL
;
144 Object
* show_formatsys
= NULL
;
145 Object
* show_formatwork
= NULL
;
146 Object
* check_formatsys
= NULL
;
147 Object
* check_formatwork
= NULL
;
148 Object
* cycle_fstypesys
= NULL
;
149 Object
* cycle_fstypework
= NULL
;
150 Object
* cycle_sysunits
= NULL
;
151 Object
* cycle_workunits
= NULL
;
153 Object
* dest_volume
= NULL
;
154 Object
* work_volume
= NULL
;
156 Object
* dest_device
= NULL
;
157 Object
* dest_unit
= NULL
;
158 Object
* show_sizesys
= NULL
;
159 Object
* show_sizework
= NULL
;
160 Object
* check_sizesys
= NULL
;
161 Object
* check_sizework
= NULL
;
162 Object
* check_creatework
= NULL
;
163 Object
* sys_size
= NULL
;
164 Object
* work_size
= NULL
;
166 Object
* grub_device
= NULL
;
167 Object
* grub_unit
= NULL
;
169 Object
*reboot_group
= NULL
;
171 static struct FileSysStartupMsg
*getDiskFSSM(CONST_STRPTR path
);
172 static LONG
GetPartitionSize(BOOL get_work
);
173 static LONG
FindWindowsPartition(STRPTR device
, LONG unit
);
174 LONG
CopyDirArray(Class
*CLASS
, Object
*self
, CONST_STRPTR sourcePath
, CONST_STRPTR destinationPath
,
175 CONST_STRPTR directories
[]);
179 Class
*CLASS
, Object
*self
, struct opSet
*message
182 self
= (Object
*) DoSuperMethodA(CLASS
, self
, (Msg
) message
);
184 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
187 /* We will generate this info shortly */
191 data
->IO_Always_overwrite
= IIO_Overwrite_Ask
;
195 data
->welcomeMsg
= (APTR
)GetTagData(MUIA_WelcomeMsg
, (IPTR
)NULL
, message
->ops_AttrList
);
196 data
->doneMsg
= (APTR
)GetTagData(MUIA_FinishedMsg
, (IPTR
)NULL
, message
->ops_AttrList
);
198 data
->page
= (APTR
)GetTagData(MUIA_Page
, (IPTR
)NULL
, message
->ops_AttrList
);
199 data
->gauge1
= (APTR
)GetTagData(MUIA_Gauge1
, (IPTR
)NULL
, message
->ops_AttrList
);
200 data
->gauge2
= (APTR
)GetTagData(MUIA_Gauge2
, (IPTR
)NULL
, message
->ops_AttrList
);
201 data
->label
= (APTR
)GetTagData(MUIA_Install
, (IPTR
)NULL
, message
->ops_AttrList
);
203 data
->installer
= (APTR
)GetTagData(MUIA_OBJ_Installer
, (IPTR
)NULL
, message
->ops_AttrList
);
205 data
->window
= (APTR
)GetTagData(MUIA_OBJ_Window
, (IPTR
)NULL
, message
->ops_AttrList
);
206 data
->contents
= (APTR
)GetTagData(MUIA_OBJ_WindowContent
, (IPTR
)NULL
, message
->ops_AttrList
);
208 data
->pagetitle
= (APTR
)GetTagData(MUIA_OBJ_PageTitle
, (IPTR
)NULL
, message
->ops_AttrList
);
209 data
->pageheader
= (APTR
)GetTagData(MUIA_OBJ_PageHeader
, (IPTR
)NULL
, message
->ops_AttrList
);
211 data
->actioncurrent
= (APTR
)GetTagData(MUIA_OBJ_CActionStrng
, (IPTR
)NULL
, message
->ops_AttrList
);
212 data
->back
= (APTR
)GetTagData(MUIA_OBJ_Back
, (IPTR
)NULL
, message
->ops_AttrList
);
213 data
->proceed
= (APTR
)GetTagData(MUIA_OBJ_Proceed
, (IPTR
)NULL
, message
->ops_AttrList
);
214 data
->cancel
= (APTR
)GetTagData(MUIA_OBJ_Cancel
, (IPTR
)NULL
, message
->ops_AttrList
);
216 data
->instc_lic_file
= (char *)GetTagData(MUIA_IC_License_File
, (IPTR
)NULL
, message
->ops_AttrList
);
217 data
->instc_copt_licensemandatory
= (BOOL
)GetTagData(MUIA_IC_License_Mandatory
, (IPTR
)FALSE
, message
->ops_AttrList
);
220 data
->instc_options_main
= (APTR
)GetTagData(MUIA_List_Options
, (IPTR
)NULL
, message
->ops_AttrList
);
221 data
->instc_options_grub
= (APTR
)GetTagData(MUIA_Grub_Options
, (IPTR
)NULL
, message
->ops_AttrList
);
223 data
->instc_copt_undoenabled
= (BOOL
)GetTagData (MUIA_IC_EnableUndo
, (IPTR
)FALSE
, message
->ops_AttrList
);
225 data
->instc_options_main
->partitioned
= FALSE
;
226 data
->instc_options_main
->bootloaded
= FALSE
;
227 data
->instc_options_grub
->bootinfo
= FALSE
;
229 GET( data
->window
, MUIA_Window_Width
, &data
->cur_width
);
230 GET( data
->window
, MUIA_Window_Height
, &data
->cur_height
);
232 SET(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgWelcome
);
233 SET(data
->back
, MUIA_Disabled
, TRUE
);
235 data
->instc_stage_next
= EPartitionOptionsStage
;
237 data
->inst_success
= FALSE
;
238 data
->disable_back
= FALSE
;
240 data
->instc_cflag_driveset
= (BOOL
)DoMethod(self
, MUIM_FindDrives
);
242 DoMethod(data
->proceed
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
) self
, 1, MUIM_IC_NextStep
);
243 DoMethod(data
->back
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
) self
, 1, MUIM_IC_PrevStep
);
244 DoMethod(data
->cancel
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
) self
, 1, MUIM_IC_CancelInstall
);
246 DoMethod(self
, MUIM_Notify
, MUIA_InstallComplete
, TRUE
, (IPTR
) self
, 1, MUIM_Reboot
);
248 /* set up the license info */
250 if (data
->instc_lic_file
)
252 register struct FileInfoBlock
*fib
=NULL
;
256 lock
= (BPTR
) Lock(data
->instc_lic_file
, SHARED_LOCK
);
259 fib
= (void *) AllocVec(sizeof(*fib
), MEMF_PUBLIC
);
263 if((from
= Open(data
->instc_lic_file
, MODE_OLDFILE
)))
265 D(bug("[INSTALLER.i] Allocating buffer [%d] for license file '%s'!", fib
->fib_Size
, data
->instc_lic_file
));
266 data
->instc_lic_buffer
= AllocVec(fib
->fib_Size
+1, MEMF_CLEAR
| MEMF_PUBLIC
);
267 if ((s
= Read(from
, data
->instc_lic_buffer
, fib
->fib_Size
)) == -1)
269 D(bug("[INSTALLER.i] Error processing license file!"));
270 if ((BOOL
)data
->instc_copt_licensemandatory
)
279 DoMethod(data
->instc_options_main
->opt_lic_box
, MUIM_TextEditor_InsertText
, data
->instc_lic_buffer
, MUIV_TextEditor_InsertText_Top
);
286 if( fib
) FreeVec( fib
);
290 if (!data
->instc_copt_licensemandatory
)
291 SET(data
->instc_options_main
->opt_lic_mgrp
,MUIA_ShowMe
,FALSE
);
293 DoMethod(data
->instc_options_main
->opt_license
, MUIM_Notify
,
294 MUIA_Selected
, MUIV_EveryTime
, (IPTR
) data
->proceed
, 3, MUIM_Set
,
295 MUIA_Disabled
, MUIV_NotTriggerValue
);
300 if (data
->instc_copt_undoenabled
)
303 NEWLIST((struct List
*)&data
->instc_undorecord
);
304 D(bug("[INSTALLER.i] Prepared UNDO list @ %p\n", &data
->instc_undorecord
));
306 if ((lock
= Lock(INSTALLER_TMP_PATH
, ACCESS_READ
))!=NULL
)
308 D(bug("[INSTALLER.i] Dir '%s' Exists - no nead to create\n",INSTALLER_TMP_PATH
));
313 lock
= CreateDir(INSTALLER_TMP_PATH
);
314 if(lock
!= NULL
) UnLock(lock
);
317 D(bug("[INSTALLER.i] Failed to create dir '%s'!!\n",INSTALLER_TMP_PATH
));
318 data
->inst_success
= MUIV_Inst_Failed
;
323 if ((lock
= Lock(INSTALLAROS_TMP_PATH
, ACCESS_READ
))!=NULL
)
325 D(bug("[INSTALLER.i] Dir '%s' Exists - no nead to create\n",INSTALLAROS_TMP_PATH
));
330 lock
= CreateDir(INSTALLAROS_TMP_PATH
);
331 if(lock
!= NULL
) UnLock(lock
);
334 D(bug("[INSTALLER.i] Failed to create dir '%s'!!\n",INSTALLAROS_TMP_PATH
));
335 data
->inst_success
= MUIV_Inst_Failed
;
348 ULONG
AskRetry(Class
*CLASS
, Object
*self
, CONST_STRPTR message
, CONST_STRPTR file
,
349 CONST_STRPTR opt1
, CONST_STRPTR opt2
, CONST_STRPTR opt3
)
351 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
352 STRPTR finalmessage
= NULL
;
353 STRPTR finaloptions
= NULL
;
356 finalmessage
= AllocVec(strlen(message
) + strlen(file
) + 2, MEMF_CLEAR
| MEMF_PUBLIC
);
357 finaloptions
= AllocVec(strlen(opt1
) + strlen(opt2
) + strlen(opt3
) + 5, MEMF_CLEAR
| MEMF_PUBLIC
);
359 sprintf(finalmessage
, message
, file
);
360 sprintf(finaloptions
, "%s|%s|%s", opt1
, opt2
, opt3
);
362 result
= MUI_RequestA(data
->installer
, data
->window
, 0, "IO Error has occured",
363 finaloptions
, finalmessage
, NULL
);
364 FreeVec(finalmessage
);
365 FreeVec(finaloptions
);
370 /* Return TRUE if we suspect a floppy disk */
371 BOOL
myCheckFloppy( struct DosEnvec
*DriveEnv
)
373 switch(DriveEnv
->de_HighCyl
)
376 /* Standard Floppy size
377 for PC floppies, DD = 9, HD = 18
378 for Amiga floppies, DD = 11, HD = 22
380 if ((DriveEnv
->de_BlocksPerTrack
==18) ||
381 (DriveEnv
->de_BlocksPerTrack
==9) ||
382 (DriveEnv
->de_BlocksPerTrack
==22) ||
383 (DriveEnv
->de_BlocksPerTrack
==11))
388 /* Standard Zip (95Mb) */
389 if ((DriveEnv
->de_BlocksPerTrack
==60) ||
390 (DriveEnv
->de_BlocksPerTrack
==68))
394 /* Standard Zip & LS120 sizes */
395 if (DriveEnv
->de_BlocksPerTrack
==1) return TRUE
;
399 /* OK - shouldn't be a floppy...*/
403 /* Returns the first AROS-supported filesystem's name */
404 char *FindPartition(struct PartitionHandle
*root
)
406 struct PartitionHandle
*partition
= NULL
;
407 char *success
= NULL
;
409 struct PartitionType
*type
=NULL
;
411 ForeachNode(&root
->table
->list
, partition
)
413 D(bug("[INSTALLER.fp] checking part\n"));
414 if (OpenPartitionTable(partition
) == 0)
416 D(bug("[INSTALLER.fp] checking Child Parts... \n"));
417 success
= FindPartition(partition
);
418 ClosePartitionTable(partition
);
419 D(bug("[INSTALLER.fp] Children Done...\n"));
422 D(bug("[INSTALLER.fp] Found '%s'\n",success
));
428 D(bug("[INSTALLER.fp] checking PARTITION\n"));
429 struct PartitionType pttype
;
431 name
=AllocVec( 100, MEMF_CLEAR
| MEMF_PUBLIC
);
433 GetPartitionAttrsTags
436 PT_NAME
, (IPTR
) name
,
437 PT_TYPE
, (IPTR
) &pttype
,
443 if (type
->id_len
== 4)
445 D(bug("[INSTALLER.fp] Found RDB Partition!\n"));
446 if ((type
->id
[0]==68)&&(type
->id
[1]==79)&&(type
->id
[2]==83))
448 D(bug("[INSTALLER.fp] Found AFFS Partition! '%s'\n",name
));
452 if ((type
->id
[0]==83)&&(type
->id
[1]==70)&&(type
->id
[2]==83))
454 D(bug("[INSTALLER.fp] Found SFS Partition! '%s'\n",name
));
462 if ((!success
)&&(name
)) FreeVec(name
);
467 IPTR Install__MUIM_FindDrives
469 Class
*CLASS
, Object
*self
, Msg message
472 struct BootNode
*CurBootNode
=NULL
;
473 struct PartitionHandle
*root
;
475 struct DevInfo
*devnode
=NULL
;
476 struct FileSysStartupMsg
*StartMess
=NULL
;
477 struct DosEnvec
*DriveEnv
=NULL
;
480 BOOL founddisk
= FALSE
;
482 ForeachNode(&ExpansionBase
->MountList
, CurBootNode
)
484 devnode
= CurBootNode
->bn_DeviceNode
;
485 StartMess
= devnode
->dvi_Startup
;
486 if (!StartMess
) continue;
488 DriveEnv
= StartMess
->fssm_Environ
;
490 if (!myCheckFloppy(DriveEnv
))
492 if((root
= OpenRootPartition(StartMess
->fssm_Device
, StartMess
->fssm_Unit
)) != NULL
)
496 /* First drive in system - save its info for grub */
497 D(bug("[INSTALLER.fd] First DRIVE found [%s unit %d]...\n",StartMess
->fssm_Device
, StartMess
->fssm_Unit
));
499 // boot_Device = StartMess->fssm_Device;
500 // boot_Unit = StartMess->fssm_Unit;
503 if (OpenPartitionTable(root
) == 0)
505 result
= FindPartition(root
);
506 D(bug("[INSTALLER.fd] Partition '%s'\n",result
));
507 ClosePartitionTable(root
);
509 CloseRootPartition(root
);
517 static struct FileSysStartupMsg
*getDiskFSSM(CONST_STRPTR path
)
520 struct DeviceNode
*dn
;
524 D(bug("[install] getDiskFSSM('%s')\n", path
));
526 for (i
= 0; (path
[i
]) && (path
[i
] != ':'); i
++)
531 dl
= LockDosList(LDF_READ
);
534 dn
= (struct DeviceNode
*) FindDosEntry(dl
, dname
, LDF_DEVICES
);
535 UnLockDosList(LDF_READ
);
538 if (IsFileSystem(dname
))
540 return (struct FileSysStartupMsg
*) BADDR(dn
->dn_Startup
);
543 printf("device '%s' doesn't contain a file system\n",
547 PrintFault(ERROR_OBJECT_NOT_FOUND
, dname
);
551 printf("'%s' doesn't contain a device name\n", path
);
555 void w2strcpy(STRPTR name
, UWORD
*wstr
, ULONG len
)
559 *((UWORD
*)name
) = AROS_BE2WORD(*wstr
);
560 name
+= sizeof(UWORD
);
567 while ((*name
==0) || (*name
==' ')) *name
-- = 0;
570 void identify(struct IOStdReq
*ioreq
, STRPTR name
) {
571 struct SCSICmd scsicmd
;
573 UBYTE cmd
=0xEC; /* identify */
575 scsicmd
.scsi_Data
= data
;
576 scsicmd
.scsi_Length
= 512;
577 scsicmd
.scsi_Command
= &cmd
;
578 scsicmd
.scsi_CmdLength
= 1;
579 ioreq
->io_Command
= HD_SCSICMD
;
580 ioreq
->io_Data
= &scsicmd
;
581 ioreq
->io_Length
= sizeof(struct SCSICmd
);
582 if (DoIO((struct IORequest
*)ioreq
)) return;
584 w2strcpy(name
, &data
[27], 40);
587 IPTR Install__MUIM_IC_NextStep
589 Class
*CLASS
, Object
*self
, Msg message
592 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
593 IPTR this_page
=0,next_stage
=0,option
=0;
595 GET(data
->page
,MUIA_Group_ActivePage
, &this_page
);
597 if ((EDoneStage
== this_page
)&&( this_page
== data
->instc_stage_next
))
598 set(self
, MUIA_InstallComplete
, TRUE
); //ALL DONE!!
600 SET(data
->back
, MUIA_Disabled
, (BOOL
)data
->disable_back
);
602 next_stage
= data
->instc_stage_next
;
603 data
->instc_stage_prev
= this_page
;
605 SET(data
->back
, MUIA_Selected
, FALSE
);
606 SET(data
->proceed
, MUIA_Selected
, FALSE
);
607 SET(data
->cancel
, MUIA_Selected
, FALSE
);
609 switch(data
->instc_stage_next
)
613 if (data
->instc_lic_file
)
615 if (data
->instc_copt_licensemandatory
)
617 /* Force acceptance of the license */
618 SET(data
->instc_options_main
->opt_license
, MUIA_Selected
, FALSE
);
619 SET(data
->proceed
, MUIA_Disabled
, TRUE
);
621 data
->instc_stage_next
= EInstallOptionsStage
;
622 next_stage
= ELicenseStage
;
625 /* if no license we ignore this step... and go to partition options */
627 case EPartitionOptionsStage
:
628 if(data
->instc_cflag_driveset
)
630 SET(data
->instc_options_main
->opt_partmethod
, MUIA_Radio_Active
, 2);
632 data
->instc_stage_next
= EPartitioningStage
;
633 next_stage
= EPartitionOptionsStage
;
636 case EInstallOptionsStage
:
637 SET(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgInstallOptions
);
638 data
->instc_stage_next
= EDestOptionsStage
;
639 next_stage
= EInstallOptionsStage
;
642 case EDestOptionsStage
:
643 if ((BOOL
)XGET(data
->instc_options_main
->opt_format
, MUIA_Selected
))
645 SET(show_formatsys
,MUIA_ShowMe
,TRUE
);
646 SET(show_formatwork
,MUIA_ShowMe
,TRUE
);
650 SET(check_formatsys
,MUIA_Selected
,FALSE
);
651 SET(check_formatwork
,MUIA_Selected
,FALSE
);
652 SET(show_formatsys
,MUIA_ShowMe
,FALSE
);
653 SET(show_formatwork
,MUIA_ShowMe
,FALSE
);
655 data
->instc_stage_next
= EInstallMessageStage
;
656 next_stage
= EDestOptionsStage
;
659 case EInstallMessageStage
:
660 /* PARTITION DRIVES */
662 /* have we already done this? */
663 if (!data
->instc_options_main
->partitioned
)
665 data
->instc_options_main
->partitioned
= TRUE
;
666 data
->instc_stage_next
= EPartitioningStage
;
667 next_stage
= EPartitionOptionsStage
;
668 data
->instc_stage_prev
= this_page
;
676 GET(data
->instc_options_main
->opt_bootloader
, MUIA_Selected
, &option
);
679 //have we already done this?
680 if (!data
->instc_options_main
->bootloaded
)
682 data
->instc_options_main
->bootloaded
= TRUE
;
684 if (!data
->instc_options_grub
->bootinfo
)
686 char *tmp_drive
=NULL
;
687 char *tmp_device
=NULL
;
689 char *tmp_kernel
=NULL
;
690 struct IOStdReq
*ioreq
=NULL
;
691 struct MsgPort
*mp
=NULL
;
692 struct FileSysStartupMsg
*fssm
;
694 data
->instc_options_grub
->bootinfo
= TRUE
;
696 tmp_drive
=AllocVec( 100, MEMF_CLEAR
| MEMF_PUBLIC
);
697 tmp_device
=AllocVec( 100, MEMF_CLEAR
| MEMF_PUBLIC
);
698 tmp_grub
=AllocVec( 100, MEMF_CLEAR
| MEMF_PUBLIC
);
699 tmp_kernel
=AllocVec( 100, MEMF_CLEAR
| MEMF_PUBLIC
);
701 GET(dest_volume
, MUIA_String_Contents
, &option
);
702 sprintf(tmp_grub
,"%s:boot/grub", (CONST_STRPTR
)option
);
704 /* Guess the best disk to install GRUB's bootblock to */
706 fssm
= getDiskFSSM(tmp_grub
);
709 boot_Device
= fssm
->fssm_Device
;
710 if (strcmp(fssm
->fssm_Device
, "ata.device") != 0)
711 boot_Unit
= fssm
->fssm_Unit
;
716 SET(grub_device
, MUIA_String_Contents
, (IPTR
)boot_Device
);
717 SET(grub_unit
, MUIA_String_Integer
, boot_Unit
);
720 mp
= CreateMsgPort();
723 ioreq
= (struct IOStdReq
*)CreateIORequest(mp
, sizeof(struct IOStdReq
));
726 if (OpenDevice(boot_Device
, boot_Unit
, (struct IORequest
*)ioreq
, 0) == 0)
728 identify(ioreq
, tmp_drive
);
729 sprintf(tmp_device
,"%s [%s unit %d]",tmp_drive
,boot_Device
,boot_Unit
);
730 CloseDevice((struct IORequest
*)ioreq
);
732 else sprintf(tmp_device
,"Unknown Drive [%s unit %d]",boot_Device
,boot_Unit
);
733 DeleteIORequest((struct IORequest
*)ioreq
);
735 else sprintf(tmp_device
,"Unknown Drive [%s unit %d]",boot_Device
,boot_Unit
);
738 else sprintf(tmp_device
,"Unknown Drive [%s unit %d]",boot_Device
,boot_Unit
);
740 SET(data
->instc_options_grub
->gopt_drive
, MUIA_Text_Contents
, tmp_device
);
742 SET(data
->instc_options_grub
->gopt_grub
, MUIA_Text_Contents
, tmp_grub
);
745 data
->instc_stage_next
= EInstallMessageStage
;
746 next_stage
= EGrubOptionsStage
;
747 data
->instc_stage_prev
= EInstallOptionsStage
;
750 else if (strlen(XGET(grub_device
, MUIA_String_Contents
)) == 0)
752 /* Go back if user hasn't entered a device name for GRUB */
753 MUI_RequestA(data
->installer
, data
->window
, 0, "Error",
754 "OK", KMsgNoGrubDevice
, NULL
);
755 data
->instc_stage_next
= EInstallMessageStage
;
756 next_stage
= EGrubOptionsStage
;
757 data
->instc_stage_prev
= EInstallOptionsStage
;
762 if (XGET(check_formatsys
, MUIA_Selected
)
763 || XGET(check_formatwork
, MUIA_Selected
))
764 SET(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgBeginWithPartition
);
766 SET(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgBeginWithoutPartition
);
767 data
->instc_stage_next
= EInstallStage
;
768 next_stage
= EMessageStage
;
771 case EPartitioningStage
:
772 get(data
->instc_options_main
->opt_partmethod
,MUIA_Radio_Active
,&option
);
773 if ((int)option
== 0 || (int)option
== 1)
775 LONG syssize
= 0, worksize
= 0;
776 IPTR systype
, worktype
;
778 /* Let user try again if either partition size is too big.
779 Note that C:Partition will ensure that automatically sized
780 partitions are within size limits */
781 syssize
= GetPartitionSize(FALSE
);
782 worksize
= GetPartitionSize(TRUE
);
784 get(cycle_fstypesys
, MUIA_Cycle_Active
, &systype
);
785 get(cycle_fstypework
, MUIA_Cycle_Active
, &worktype
);
787 if (syssize
> (systype
? MAX_SFS_SIZE
: MAX_FFS_SIZE
) ||
788 worksize
> (worktype
? MAX_SFS_SIZE
: MAX_FFS_SIZE
))
790 TEXT msg
[sizeof(KMsgPartitionTooBig
) + 40];
791 sprintf(msg
, KMsgPartitionTooBig
,
792 MAX_SFS_SIZE
/ 1024, MAX_SFS_SIZE
,
793 MAX_FFS_SIZE
/ 1024, MAX_FFS_SIZE
);
794 MUI_RequestA(data
->installer
, data
->window
, 0, "Error",
800 /* Warn user about partitiong DH0: to non FFS-Intl filesystem
802 if ((int)systype
!= 0)
804 if(MUI_RequestA(data
->installer
, data
->window
, 0, "Warning",
805 "Continue Partitioning|*Cancel Partitioning", KMsgGRUBNonFFSWarning
, NULL
) != 1)
810 data
->disable_back
= TRUE
;
812 SET(data
->page
,MUIA_Group_ActivePage
, EPartitioningStage
);
818 if(DoMethod(self
, MUIM_Partition
) != RETURN_OK
)
820 D(bug("[INSTALLER] Partitioning FAILED!!!!\n"));
821 data
->disable_back
= FALSE
;
822 SET(data
->page
,MUIA_Group_ActivePage
, EInstallMessageStage
);
823 data
->instc_stage_next
= EPartitioningStage
;
824 data
->instc_options_main
->partitioned
= FALSE
;
825 MUI_RequestA(data
->installer
, data
->window
, 0, "Error",
826 "Quit", KMsgPartitioningFailed
, NULL
);
827 DoMethod(self
, MUIM_IC_QuitInstall
);
830 data
->instc_options_main
->partitioned
= TRUE
;
831 next_stage
= EDoneStage
;
832 DoMethod(data
->page
, MUIM_Group_InitChange
);
833 SET(data
->doneMsg
,MUIA_Text_Contents
,KMsgDoneReboot
);
834 SET(reboot_group
, MUIA_ShowMe
, TRUE
);
835 SET(data
->instc_options_main
->opt_reboot
, MUIA_Selected
, TRUE
);
836 DoMethod(data
->page
, MUIM_Group_ExitChange
);
837 SET(data
->back
, MUIA_Disabled
, TRUE
);
838 SET(data
->cancel
, MUIA_Disabled
, TRUE
);
839 data
->instc_stage_next
= EDoneStage
;
842 data
->disable_back
= FALSE
;
843 data
->instc_options_main
->partitioned
= TRUE
;
844 data
->instc_stage_next
= EDestOptionsStage
;
845 next_stage
= EInstallOptionsStage
;
848 D(bug("[INSTALLER] Launching QuickPart...\n"));
849 Execute("SYS:Tools/QuickPart", NULL
, NULL
);
855 data
->disable_back
= TRUE
;
856 SET(data
->page
,MUIA_Group_ActivePage
, EInstallStage
);
858 DoMethod(self
, MUIM_IC_Install
);
860 next_stage
= EDoneStage
;
861 SET(data
->back
, MUIA_Disabled
, TRUE
);
862 SET(data
->cancel
, MUIA_Disabled
, TRUE
);
863 data
->instc_stage_next
= EDoneStage
;
870 SET(data
->page
,MUIA_Group_ActivePage
, next_stage
);
874 IPTR Install__MUIM_IC_PrevStep
876 Class
*CLASS
, Object
*self
, Msg message
879 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
882 GET(data
->page
,MUIA_Group_ActivePage
, &this_page
);
883 SET(data
->back
, MUIA_Selected
, FALSE
);
884 SET(data
->proceed
, MUIA_Selected
, FALSE
);
885 SET(data
->cancel
, MUIA_Selected
, FALSE
);
887 SET(data
->back
, MUIA_Disabled
, (BOOL
)data
->disable_back
);
888 data
->instc_stage_next
= this_page
;
893 /* BACK should only be possible when page != first_page */
894 if (data
->instc_stage_prev
!= EMessageStage
)
896 SET(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgBeginWithPartition
);
897 if (data
->instc_stage_prev
== EDestOptionsStage
)
899 SET(data
->page
,MUIA_Group_ActivePage
, EDestOptionsStage
);
901 data
->instc_stage_prev
= EInstallOptionsStage
;
905 if (!data
->instc_options_grub
->bootinfo
)
907 SET(data
->page
,MUIA_Group_ActivePage
, EPartitionOptionsStage
);
911 SET(data
->page
,MUIA_Group_ActivePage
, EGrubOptionsStage
);
913 data
->instc_stage_prev
= EDestOptionsStage
;
915 data
->instc_stage_next
= EInstallMessageStage
;
919 case EPartitionOptionsStage
:
920 if (data
->instc_lic_file
)
922 SET(data
->instc_options_main
->opt_license
, MUIA_Selected
, FALSE
);
923 SET(data
->proceed
, MUIA_Disabled
, TRUE
);
924 SET(data
->page
,MUIA_Group_ActivePage
, EPartitionOptionsStage
);
925 data
->instc_stage_prev
= ELicenseStage
;
930 SET(data
->proceed
, MUIA_Disabled
, FALSE
);
931 SET(data
->back
, MUIA_Disabled
, TRUE
);
932 SET(data
->welcomeMsg
, MUIA_Text_Contents
, KMsgWelcome
);
933 SET(data
->page
,MUIA_Group_ActivePage
, EMessageStage
);
934 data
->instc_stage_prev
= EMessageStage
;
937 case EInstallOptionsStage
:
938 SET(data
->instc_options_main
->opt_license
, MUIA_Selected
, FALSE
);
939 SET(data
->page
,MUIA_Group_ActivePage
, EPartitionOptionsStage
);
940 data
->instc_stage_prev
= ELicenseStage
;
941 data
->instc_stage_next
= EPartitioningStage
;
944 case EDestOptionsStage
:
945 SET(data
->page
,MUIA_Group_ActivePage
, EInstallOptionsStage
);
946 data
->instc_stage_next
= EDestOptionsStage
;
947 data
->instc_stage_prev
= EMessageStage
;
950 case EGrubOptionsStage
:
951 SET(data
->page
,MUIA_Group_ActivePage
, EDestOptionsStage
);
952 data
->instc_options_main
->bootloaded
= FALSE
;
953 data
->instc_options_grub
->bootinfo
= FALSE
;
954 data
->instc_stage_next
= EInstallMessageStage
;
955 data
->instc_stage_prev
= EInstallOptionsStage
;
958 case EInstallMessageStage
:
960 /* Back is disabled from here on... */
962 case EPartitioningStage
:
972 IPTR Install__MUIM_IC_CancelInstall
974 Class
*CLASS
, Object
*self
, Msg message
977 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
978 struct optionstmp
*backupOptions
= NULL
;
980 const char *cancelmessage
= NULL
;
982 if ((backupOptions
= data
->instc_options_backup
) == NULL
)
984 backupOptions
= AllocMem( sizeof(struct optionstmp
), MEMF_CLEAR
| MEMF_PUBLIC
);
985 data
->instc_options_backup
= backupOptions
;
988 GET(data
->page
,MUIA_Group_ActivePage
, &this_page
);
990 GET(data
->back
, MUIA_Disabled
, &data
->status_back
);
991 GET(data
->proceed
, MUIA_Disabled
, &data
->status_proceed
);
992 GET(data
->cancel
, MUIA_Disabled
, &data
->status_cancel
);
996 case EPartitioningStage
:
999 cancelmessage
= KMsgCancelDanger
;
1002 case EInstallOptionsStage
:
1003 GET(data
->instc_options_main
->opt_format
, MUIA_Disabled
, &backupOptions
->opt_format
);
1004 GET(data
->instc_options_main
->opt_locale
, MUIA_Disabled
, &backupOptions
->opt_locale
);
1005 GET(data
->instc_options_main
->opt_copycore
, MUIA_Disabled
, &backupOptions
->opt_copycore
);
1006 GET(data
->instc_options_main
->opt_copyextra
, MUIA_Disabled
, &backupOptions
->opt_copyextra
);
1007 GET(data
->instc_options_main
->opt_development
, MUIA_Disabled
, &backupOptions
->opt_development
);
1008 GET(data
->instc_options_main
->opt_bootloader
, MUIA_Disabled
, &backupOptions
->opt_bootloader
);
1009 GET(data
->instc_options_main
->opt_reboot
, MUIA_Disabled
, &backupOptions
->opt_reboot
);
1011 SET(data
->instc_options_main
->opt_format
, MUIA_Disabled
, TRUE
);
1012 SET(data
->instc_options_main
->opt_locale
, MUIA_Disabled
, TRUE
);
1013 SET(data
->instc_options_main
->opt_copycore
, MUIA_Disabled
, TRUE
);
1014 SET(data
->instc_options_main
->opt_copyextra
, MUIA_Disabled
, TRUE
);
1015 SET(data
->instc_options_main
->opt_development
, MUIA_Disabled
, TRUE
);
1016 SET(data
->instc_options_main
->opt_bootloader
, MUIA_Disabled
, TRUE
);
1017 SET(data
->instc_options_main
->opt_reboot
, MUIA_Disabled
, TRUE
);
1020 case EDestOptionsStage
:
1021 SET(dest_volume
, MUIA_Disabled
, TRUE
);
1022 SET(work_volume
, MUIA_Disabled
, TRUE
);
1023 SET(check_copytowork
, MUIA_Disabled
, TRUE
);
1024 SET(check_work
, MUIA_Disabled
, TRUE
);
1027 case EPartitionOptionsStage
:
1028 SET(data
->instc_options_main
->opt_partmethod
, MUIA_Disabled
, TRUE
);
1031 case EGrubOptionsStage
:
1036 cancelmessage
= KMsgCancelOK
;
1040 SET(data
->back
, MUIA_Selected
, FALSE
);
1041 SET(data
->back
, MUIA_Disabled
, TRUE
);
1043 SET(data
->proceed
, MUIA_Selected
, FALSE
);
1044 SET(data
->proceed
, MUIA_Disabled
, TRUE
);
1046 SET(data
->cancel
, MUIA_Selected
, FALSE
);
1047 SET(data
->cancel
, MUIA_Disabled
, TRUE
);
1049 if ( !MUI_RequestA( data
->installer
, data
->window
, 0, "Cancel Installation...", "*Continue Install|Cancel Install", cancelmessage
, NULL
))
1051 DoMethod(self
, MUIM_IC_QuitInstall
);
1053 else DoMethod(self
, MUIM_IC_ContinueInstall
);
1058 IPTR Install__MUIM_IC_ContinueInstall
1060 Class
*CLASS
, Object
*self
, Msg message
1063 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
1064 struct optionstmp
*backupOptions
= NULL
;
1067 backupOptions
= data
->instc_options_backup
;
1069 GET(data
->page
,MUIA_Group_ActivePage
, &this_page
);
1071 if (!(BOOL
)data
->disable_back
) SET(data
->back
, MUIA_Disabled
, data
->status_back
);
1072 else SET(data
->back
, MUIA_Disabled
, TRUE
);
1073 SET(data
->back
, MUIA_Selected
, FALSE
);
1075 SET(data
->proceed
, MUIA_Disabled
, data
->status_proceed
);
1076 SET(data
->proceed
, MUIA_Selected
, FALSE
);
1078 SET(data
->cancel
, MUIA_Disabled
, data
->status_cancel
);
1079 SET(data
->cancel
, MUIA_Selected
, FALSE
);
1083 case EInstallOptionsStage
:
1084 SET(data
->instc_options_main
->opt_format
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_format
);
1085 SET(data
->instc_options_main
->opt_locale
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_locale
);
1086 SET(data
->instc_options_main
->opt_copycore
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_copycore
);
1087 SET(data
->instc_options_main
->opt_copyextra
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_copyextra
);
1088 SET(data
->instc_options_main
->opt_development
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_development
);
1089 SET(data
->instc_options_main
->opt_bootloader
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_bootloader
);
1090 SET(data
->instc_options_main
->opt_reboot
, MUIA_Disabled
, (BOOL
) backupOptions
->opt_reboot
);
1093 case EDestOptionsStage
:
1094 SET(dest_volume
, MUIA_Disabled
, FALSE
);
1095 SET(check_work
, MUIA_Disabled
, FALSE
);
1098 GET(check_work
, MUIA_Selected
, &reenable
);
1102 SET(check_copytowork
, MUIA_Disabled
, FALSE
);
1103 SET(work_volume
, MUIA_Disabled
, FALSE
);
1107 case EPartitionOptionsStage
:
1108 SET(data
->instc_options_main
->opt_partmethod
, MUIA_Disabled
, FALSE
);
1111 case EGrubOptionsStage
:
1121 IPTR Install__MUIM_IC_QuitInstall
1123 Class
*CLASS
, Object
*self
, Msg message
1126 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
1128 if ( data
->inst_success
== MUIV_Inst_InProgress
)
1130 data
->inst_success
= MUIV_Inst_Cancelled
;
1132 DoMethod(self
,MUIM_Reboot
);
1138 /** Start - NEW!! this is part of the "class" change ;) **/
1140 /* ****** FUNCTION IS CALLED BY THE PROCEDURE PROCESSOR
1142 IT LAUNCHES THE NECESSARY FUNCTION TO PERFORM WHATEVER IS BEING ASKED TO DO
1145 IPTR Install__MUIM_DispatchInstallProcedure
1147 Class
*CLASS
, Object
*self
, Msg message
1150 // struct Install_DATA* data = INST_DATA(CLASS, self);
1155 /** End - NEW!! this is part of the "class" change ;) **/
1157 static LONG
GetPartitionSize(BOOL get_work
)
1164 if ((BOOL
)XGET(check_sizesys
, MUIA_Selected
))
1166 GET(sys_size
, MUIA_String_Integer
, &tmp
);
1168 if (XGET(cycle_sysunits
, MUIA_Cycle_Active
) == 1)
1174 if ((BOOL
)XGET(check_sizework
, MUIA_Selected
))
1176 GET(work_size
, MUIA_String_Integer
, &tmp
);
1178 if (XGET(cycle_workunits
, MUIA_Cycle_Active
) == 1)
1186 IPTR Install__MUIM_Partition
1188 Class
*CLASS
, Object
*self
, Msg message
1191 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
1192 IPTR option
= FALSE
;
1195 if ( data
->inst_success
== MUIV_Inst_InProgress
)
1197 SET(data
->back
, MUIA_Disabled
, TRUE
);
1198 SET(data
->proceed
, MUIA_Disabled
, TRUE
);
1200 char tmpcmd
[150], tmparg
[100];
1201 GET(dest_device
, MUIA_String_Contents
, &tmp
);
1202 GET(dest_unit
, MUIA_String_Integer
, &option
);
1203 sprintf(tmpcmd
,"C:Partition DEVICE=%s UNIT=%ld FORCE QUIET",
1204 (char *)tmp
, option
);
1206 /* Specify SYS size */
1207 GET(check_sizesys
, MUIA_Selected
, &option
);
1210 tmp
= GetPartitionSize(FALSE
);
1211 sprintf(tmparg
, " SYSSIZE=%ld", tmp
);
1212 strcat(tmpcmd
, tmparg
);
1215 /* Specify SYS filesystem (defaults to FFSIntl)*/
1216 get(cycle_fstypesys
, MUIA_Cycle_Active
, &tmp
);
1218 strcat(tmpcmd
, " SYSTYPE=SFS");
1220 strcat(tmpcmd
, " SYSTYPE=FFSIntl");
1222 /* Specify Work size */
1223 GET(check_creatework
, MUIA_Selected
, &option
);
1226 GET(check_sizework
, MUIA_Selected
, &option
);
1229 tmp
= GetPartitionSize(TRUE
);
1230 sprintf(tmparg
, " WORKSIZE=%ld", tmp
);
1231 strcat(tmpcmd
, tmparg
);
1235 strcat(tmpcmd
, " MAXWORK");
1239 /* Specify WORK filesystem (defaults to SFS)*/
1240 get(cycle_fstypework
, MUIA_Cycle_Active
, &tmp
);
1242 strcat(tmpcmd
, " WORKTYPE=FFSIntl");
1244 strcat(tmpcmd
, " WORKTYPE=SFS");
1246 /* Specify whether to wipe disk or not */
1247 GET(data
->instc_options_main
->opt_partmethod
, MUIA_Radio_Active
,
1251 D(bug("[INSTALLER] Partitioning EVERYTHING! MUAHAHAHA...\n"));
1252 strcat(tmpcmd
, " WIPE");
1255 D(bug("[INSTALLER] Partitioning Free Space...\n"));
1257 D(bug("[INSTALLER] ### Executing '%s'\n",&tmpcmd
));
1258 tmp
= SystemTagList(tmpcmd
, NULL
);
1260 SET(data
->proceed
, MUIA_Disabled
, FALSE
);
1266 void create_environment_variable(CONST_STRPTR envarchiveDisk
, CONST_STRPTR name
, CONST_STRPTR value
)
1268 BPTR env_variable_fh
= NULL
;
1269 TEXT env_variable_path
[100];
1271 if ((envarchiveDisk
== NULL
) || (name
== NULL
) || (value
== NULL
))
1275 sprintf(env_variable_path
, "%s:", envarchiveDisk
);
1276 AddPart(env_variable_path
, "Prefs/Env-Archive/", 100);
1277 AddPart(env_variable_path
, name
, 100);
1279 D(bug("[INSTALLER] create_environment_variable: Setting Var '%s' to '%s'\n", env_variable_path
, value
));
1281 if ((env_variable_fh
= Open(env_variable_path
, MODE_NEWFILE
)) != NULL
)
1283 FPuts(env_variable_fh
, value
);
1284 Close(env_variable_fh
);
1288 LONG
CountFiles(CONST_STRPTR directory
, CONST_STRPTR fileMask
, BOOL recursive
)
1290 UBYTE
*buffer
= NULL
;
1291 TEXT matchString
[3 * strlen(fileMask
)];
1292 BPTR dirLock
= NULL
;
1295 D(bug("[INSTALLER.Count] Entry, directory: %s, mask: %s\n", directory
, fileMask
));
1297 /* Check if directory exists */
1298 dirLock
= Lock(directory
, SHARED_LOCK
);
1300 if (dirLock
== NULL
)
1305 buffer
= AllocVec(kExallBufSize
, MEMF_CLEAR
|MEMF_PUBLIC
);
1313 if (ParsePatternNoCase(fileMask
, matchString
, 3 * strlen(fileMask
)) < 0)
1320 struct ExAllData
*ead
= (struct ExAllData
*)buffer
;
1321 struct ExAllControl
*eac
= AllocDosObject(DOS_EXALLCONTROL
, NULL
);
1322 eac
->eac_LastKey
= 0;
1325 struct ExAllData
*oldEad
= ead
;
1330 loop
= ExAll(dirLock
, ead
, kExallBufSize
, ED_COMMENT
, eac
);
1332 if(!loop
&& IoErr() != ERROR_NO_MORE_ENTRIES
) break;
1334 if(eac
->eac_Entries
!= 0)
1338 if(ead
->ed_Type
== ST_FILE
&& MatchPatternNoCase(matchString
, ead
->ed_Name
))
1341 if(ead
->ed_Type
== ST_USERDIR
&& recursive
)
1343 LONG subFileCount
= 0;
1344 ULONG subDirNameLen
= strlen(directory
) + strlen(ead
->ed_Name
) + 2;
1345 TEXT subDirName
[subDirNameLen
];
1347 sprintf(subDirName
, "%s", directory
);
1348 AddPart(subDirName
, ead
->ed_Name
, subDirNameLen
);
1350 subFileCount
= CountFiles(subDirName
, fileMask
, recursive
);
1352 if (subFileCount
>= 0)
1353 fileCount
+= subFileCount
;
1356 /* Error at lower level */
1357 FreeDosObject(DOS_EXALLCONTROL
, eac
);
1364 } while(ead
!= NULL
);
1368 FreeDosObject(DOS_EXALLCONTROL
, eac
);
1375 LONG
InternalCopyFiles(Class
*CLASS
, Object
*self
, CONST_STRPTR srcDir
, CONST_STRPTR dstDir
,
1376 CONST_STRPTR fileMask
, BOOL recursive
, LONG totalFiles
, LONG totalFilesCopied
)
1378 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
1379 UBYTE
*buffer
= NULL
;
1380 TEXT matchString
[3 * strlen(fileMask
)];
1381 BPTR srcDirLock
= NULL
, dstDirLock
= NULL
;
1382 LONG totalFilesCopiedThis
= 0;
1384 /* Check entry condition */
1385 if (data
->inst_success
!= MUIV_Inst_InProgress
)
1386 return totalFilesCopied
;
1388 /* Check if source directory exists */
1391 srcDirLock
= Lock(srcDir
, SHARED_LOCK
);
1393 if (srcDirLock
== NULL
)
1395 ULONG retry
= AskRetry( CLASS
, self
, "Could not find %s\nRetry?", srcDir
, "Yes","Skip","Quit");
1403 DoMethod(self
, MUIM_IC_QuitInstall
);
1407 } while (srcDirLock
== NULL
);
1409 /* Check if destination directory exists and create it */
1410 dstDirLock
= Lock(dstDir
, SHARED_LOCK
);
1412 if (dstDirLock
!= NULL
)
1416 dstDirLock
= CreateDir(dstDir
);
1417 if (dstDirLock
!= NULL
)
1426 /* Allocate buffer for ExAll */
1427 buffer
= AllocVec(kExallBufSize
, MEMF_CLEAR
|MEMF_PUBLIC
);
1435 if (ParsePatternNoCase(fileMask
, matchString
, 3 * strlen(fileMask
)) < 0)
1442 struct ExAllData
*ead
= (struct ExAllData
*)buffer
;
1443 struct ExAllControl
*eac
= AllocDosObject(DOS_EXALLCONTROL
, NULL
);
1444 eac
->eac_LastKey
= 0;
1447 struct ExAllData
*oldEad
= ead
;
1450 /* Main copy file loop */
1454 loop
= ExAll(srcDirLock
, ead
, kExallBufSize
, ED_COMMENT
, eac
);
1456 if(!loop
&& IoErr() != ERROR_NO_MORE_ENTRIES
) break;
1458 if(eac
->eac_Entries
!= 0)
1463 ((ead
->ed_Type
== ST_FILE
) && MatchPatternNoCase(matchString
, ead
->ed_Name
)) ||
1464 ((ead
->ed_Type
== ST_USERDIR
) && recursive
)
1467 ULONG srcLen
= strlen(srcDir
);
1468 ULONG dstLen
= strlen(dstDir
);
1469 ULONG newSrcLen
= srcLen
+ strlen(ead
->ed_Name
) + 2;
1470 ULONG newDstLen
= dstLen
+ strlen(ead
->ed_Name
) + 2;
1472 TEXT srcFile
[newSrcLen
];
1473 TEXT dstFile
[newDstLen
];
1475 sprintf(srcFile
, "%s", srcDir
);
1476 sprintf(dstFile
, "%s", dstDir
);
1478 AddPart(srcFile
, ead
->ed_Name
, newSrcLen
);
1479 AddPart(dstFile
, ead
->ed_Name
, newDstLen
);
1481 if (ead
->ed_Type
== ST_FILE
)
1483 totalFilesCopiedThis
+= (ULONG
)DoMethod(self
, MUIM_IC_CopyFile
, srcFile
, dstFile
);
1487 SET(data
->gauge2
, MUIA_Gauge_Current
,
1488 (LONG
)((100.0 / totalFiles
) * (totalFilesCopied
+ totalFilesCopiedThis
)));
1492 if (ead
->ed_Type
== ST_USERDIR
)
1495 LONG totalFilesCopiedSub
= InternalCopyFiles(CLASS
, self
, srcFile
, dstFile
, fileMask
,
1496 recursive
, totalFiles
,
1497 totalFilesCopied
+ totalFilesCopiedThis
);
1498 if (totalFilesCopiedSub
>= 0)
1499 totalFilesCopiedThis
+= totalFilesCopiedSub
;
1502 /* Do nothing. It will be caught at level of Install__MUIM_IC_CopyFiles */
1508 } while((ead
!= NULL
) && (data
->inst_success
== MUIV_Inst_InProgress
));
1510 } while((loop
) && (data
->inst_success
== MUIV_Inst_InProgress
));
1512 FreeDosObject(DOS_EXALLCONTROL
, eac
);
1516 return totalFilesCopiedThis
;
1519 IPTR Install__MUIM_IC_CopyFiles
1521 Class
*CLASS
, Object
*self
, struct MUIP_CopyFiles
* message
1524 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
1525 LONG totalFiles
= -1, totalFilesCopied
= 0;
1528 D(bug("[INSTALLER.CFs] Entry, src: %s, dst: %s, mask: %s\n", message
->srcDir
, message
->dstDir
,
1529 message
->fileMask
));
1531 /* Check entry condition */
1532 if (data
->inst_success
!= MUIV_Inst_InProgress
)
1533 return totalFilesCopied
;
1535 SET(data
->gauge2
, MUIA_Gauge_Current
, 0);
1537 /* Get file count */
1540 totalFiles
= CountFiles(message
->srcDir
, message
->fileMask
, message
->recursive
);
1541 D(bug("[INSTALLER.CFs] Found %ld files in %s\n", totalFiles
, message
->srcDir
));
1545 ULONG retry
= AskRetry( CLASS
, self
, "Error scanning %s\nRetry?", message
->srcDir
, "Yes","Skip","Quit");
1554 DoMethod(self
, MUIM_IC_QuitInstall
);
1555 return totalFilesCopied
;
1558 } while(totalFiles
< 0);
1561 totalFilesCopied
= InternalCopyFiles(CLASS
, self
, message
->srcDir
, message
->dstDir
, message
->fileMask
,
1562 message
->recursive
, totalFiles
, totalFilesCopied
);
1564 /* Check final condition */
1565 if ((data
->inst_success
== MUIV_Inst_InProgress
) && (totalFiles
!= totalFilesCopied
))
1567 TEXT msg
[strlen(KMsgNotAllFilesCopied
) + strlen(message
->srcDir
) + 3];
1568 sprintf(msg
, KMsgNotAllFilesCopied
, message
->srcDir
);
1570 if(MUI_RequestA(data
->installer
, data
->window
, 0, "Error", "Continue|*Quit", msg
, NULL
) != 1)
1571 DoMethod(self
, MUIM_IC_QuitInstall
);
1573 return totalFilesCopied
;
1576 return totalFilesCopied
;
1579 IPTR Install__MUIM_IC_Install
1581 Class
*CLASS
, Object
*self
, Msg message
1584 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
1586 IPTR option
= FALSE
;
1588 GET(dest_volume
, MUIA_String_Contents
, &option
);
1589 strcpy(dest_Path
, (STRPTR
)option
);
1590 GET(work_volume
, MUIA_String_Contents
, &option
);
1591 strcpy(work_Path
, (STRPTR
)option
);
1593 SET(data
->back
, MUIA_Disabled
, TRUE
);
1594 SET(data
->proceed
, MUIA_Disabled
, TRUE
);
1596 SET(data
->pagetitle
,MUIA_Text_Contents
, "Installing AROS...");
1598 /** setup work name to use **/
1600 GET(check_copytowork
, MUIA_Selected
, &option
);
1601 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1602 extras_path
= work_Path
;
1604 extras_path
= dest_Path
;
1606 /** STEP : FORMAT **/
1608 GET(data
->instc_options_main
->opt_format
, MUIA_Selected
, &option
);
1609 if (option
&& data
->inst_success
== MUIV_Inst_InProgress
)
1611 GET(data
->instc_options_main
->opt_partmethod
, MUIA_Radio_Active
, &option
);
1613 DoMethod(self
, MUIM_Format
);
1616 /* MAKE SURE THE WORK PART EXISTS TO PREVENT CRASHING! */
1618 if ((BOOL
)XGET(check_work
, MUIA_Selected
))
1621 sprintf(tmp
,"%s:", work_Path
);
1622 D(bug("[INSTALLER] Install : Using a Work partition - checking validity..."));
1623 if((lock
= Lock(tmp
, SHARED_LOCK
))) /* check the dest dir exists */
1630 D(bug("FAILED!\n[INSTALLER] (Warning) INSTALL - Failed to locate chosen work partition '%s' : defaulting to sys only\n",work_Path
));
1631 extras_path
= dest_Path
;
1637 D(bug("[INSTALLER] Install: Using SYS partition only (%s)\n", dest_Path
));
1640 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1642 /** STEP : LOCALE **/
1644 GET(data
->instc_options_main
->opt_locale
, MUIA_Selected
, &option
);
1645 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1647 D(bug("[INSTALLER] Launching Locale Prefs...\n"));
1649 ULONG srcLen
= strlen(source_Path
), dstLen
= (strlen(dest_Path
)+1);
1650 ULONG envsrcLen
= strlen(prefssrc_path
), envdstLen
= strlen(prefs_path
);
1652 ULONG localeFileLen
= srcLen
+ strlen(localeFile_path
) + 3;
1653 ULONG inputFileLen
= srcLen
+ strlen(inputFile_path
) + 3;
1655 ULONG localePFileLen
= dstLen
+ envdstLen
+ strlen(locale_prfs_file
) + 4;
1657 ULONG inputPFileLen
= dstLen
+ envdstLen
+ strlen(input_prfs_file
) + 4;
1659 ULONG envdstdirLen
= 1024;
1660 TEXT envDstDir
[envdstdirLen
]; /* "DH0:Prefs/Env-Archive/SYS" */
1662 TEXT localeFile
[localeFileLen
]; /* "CD0:Prefs/Locale" */
1663 TEXT localesrcPFile
[localePFileLen
]; /* "ENV:SYS/locale.prefs" */
1664 TEXT localePFile
[localePFileLen
]; /* "DH0:Prefs/Env-Archive/SYS/locale.prefs" */
1665 TEXT inputFile
[inputFileLen
]; /* "CD0:Prefs/Input" */
1666 TEXT inputsrcPFile
[inputPFileLen
]; /* "ENV:SYS/input.prefs" */
1667 TEXT inputPFile
[inputPFileLen
]; /* "DH0:Prefs/Env-Archive/SYS/input.prefs" */
1669 sprintf(envDstDir
,"%s:",dest_Path
);
1670 sprintf(localeFile
,"\"%s",source_Path
);
1671 CopyMem(prefssrc_path
, localesrcPFile
, envsrcLen
+ 1);
1672 sprintf(localePFile
,"%s:",dest_Path
);
1673 sprintf(inputFile
,"\"%s",source_Path
);
1674 CopyMem(prefssrc_path
, inputsrcPFile
, envsrcLen
+ 1);
1675 sprintf(inputPFile
,"%s:",dest_Path
);
1677 AddPart(localeFile
, inputFile_path
, localeFileLen
);
1679 AddPart(localesrcPFile
, locale_prfs_file
, localePFileLen
);
1681 AddPart(localePFile
, prefs_path
, localePFileLen
);
1682 AddPart(localePFile
, locale_prfs_file
, localePFileLen
);
1684 AddPart(inputFile
, localeFile_path
, inputFileLen
);
1686 AddPart(inputsrcPFile
, input_prfs_file
, inputPFileLen
);
1688 AddPart(inputPFile
, prefs_path
, inputPFileLen
);
1689 AddPart(inputPFile
, input_prfs_file
, inputPFileLen
);
1691 D(bug("[INSTALLER] Excecuting '%s'...\n",localeFile
));
1693 Execute(localeFile
, NULL
, NULL
);
1695 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1697 D(bug("[INSTALLER] Excecuting '%s'...\n",inputFile
));
1699 Execute(inputFile
, NULL
, NULL
);
1701 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1703 D(bug("[INSTALLER] Copying Locale Settings...\n"));
1705 //create the dirs "Prefs","Prefs/Env-Archive" and "Prefs/Env-Archive/SYS"
1706 AddPart(envDstDir
, "Prefs", dstLen
+ envdstLen
);
1707 D(bug("[INSTALLER] Create Dir '%s' \n",envDstDir
));
1709 BPTR bootDirLock
=NULL
;
1711 if ((lock
= Lock(envDstDir
, ACCESS_READ
))!=NULL
)
1713 D(bug("[INSTALLER] Dir '%s' Exists - no nead to create\n",envDstDir
));
1718 bootDirLock
= CreateDir(envDstDir
);
1719 if(bootDirLock
!= NULL
) UnLock(bootDirLock
);
1723 D(bug("[INSTALLER] Failed to create %s dir!!\n",envDstDir
));
1724 #warning TODO: Should prompt on failure to try again/continue anyhow/exit.
1725 goto localecopydone
;
1726 //data->inst_success = MUIV_Inst_Failed;
1734 AddPart(envDstDir
, "Env-Archive", envdstdirLen
);
1735 D(bug("[INSTALLER] Create Dir '%s' \n",envDstDir
));
1736 if ((lock
= Lock(envDstDir
, ACCESS_READ
))!=NULL
)
1738 D(bug("[INSTALLER] Dir '%s' Exists - no nead to create\n",envDstDir
));
1743 bootDirLock
= CreateDir(envDstDir
);
1744 if(bootDirLock
!= NULL
) UnLock(bootDirLock
);
1745 else goto createdirfaild
;
1751 AddPart(envDstDir
, "SYS", envdstdirLen
);
1752 D(bug("[INSTALLER] Create Dir '%s' \n",envDstDir
));
1753 if ((lock
= Lock(envDstDir
, ACCESS_READ
))!=NULL
)
1755 D(bug("[INSTALLER] Dir '%s' Exists - no nead to create\n",envDstDir
));
1760 bootDirLock
= CreateDir(envDstDir
);
1761 if(bootDirLock
!= NULL
) UnLock(bootDirLock
);
1762 else goto createdirfaild
;
1768 D(bug("[INSTALLER] Copying files\n"));
1770 if ((lock
= Lock(localesrcPFile
, ACCESS_READ
))!=NULL
)
1773 DoMethod(self
, MUIM_IC_CopyFile
, localesrcPFile
, localePFile
);
1779 if ((lock
= Lock(inputsrcPFile
, ACCESS_READ
))!=NULL
)
1782 DoMethod(self
, MUIM_IC_CopyFile
, inputsrcPFile
, inputPFile
);
1788 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1790 /** STEP : COPY CORE **/
1792 GET(data
->instc_options_main
->opt_copycore
, MUIA_Selected
, &option
);
1793 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1796 BOOL success
= FALSE
;
1797 CONST_STRPTR core_dirs
[] =
1800 "Classes", "Classes",
1808 "Storage", "Storage",
1811 "Utilities", "Utilities",
1812 "WBStartup", "WBStartup",
1815 TEXT destinationPath
[strlen(dest_Path
) + 2];
1817 /* Copying Core system Files */
1818 D(bug("[INSTALLER] Copying Core files...\n"));
1819 SET(data
->label
, MUIA_Text_Contents
, "Copying Core System files...");
1820 sprintf(destinationPath
, "%s:", dest_Path
);
1821 CopyDirArray(CLASS
, self
, source_Path
, destinationPath
, core_dirs
);
1823 /* Copy AROS.boot file */
1824 sprintf(tmp
, "%s", source_Path
);
1825 sprintf(destinationPath
, "%s:" AROS_BOOT_FILE
, dest_Path
);
1826 AddPart(tmp
, AROS_BOOT_FILE
, 100);
1827 DoMethod(self
, MUIM_IC_CopyFile
, tmp
, destinationPath
);
1829 /* Make Env-Archive Writeable */
1830 sprintf(tmp
,"Protect ADD FLAGS=W ALL QUIET %s:Prefs/Env-Archive", dest_Path
);
1831 D(bug("[INSTALLER] Changing Protection on Env Files (command='%s')\n", tmp
));
1832 success
= (BOOL
)Execute(tmp
, NULL
, NULL
);
1835 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1837 /** STEP : COPY EXTRAS **/
1839 GET(data
->instc_options_main
->opt_copyextra
, MUIA_Selected
, &option
);
1840 if (option
&& data
->inst_success
== MUIV_Inst_InProgress
)
1842 CONST_STRPTR extras_dirs
[] =
1849 TEXT extraspath
[100];
1850 BOOL undoenabled
= data
->instc_copt_undoenabled
;
1852 /* Explicitly disable undo. Some users might not have RAM for backup */
1853 data
->instc_copt_undoenabled
= FALSE
;
1855 /* Copying Extras */
1856 D(bug("[INSTALLER] Copying Extras to '%s'...\n", extras_path
));
1857 SET(data
->label
, MUIA_Text_Contents
, "Copying Extra Software...");
1858 sprintf(extraspath
, "%s:", extras_path
);
1859 CopyDirArray(CLASS
, self
, source_Path
, extraspath
, extras_dirs
);
1861 /* Set EXTRASPATH environment variable */
1862 AddPart(extraspath
, "Extras", 100);
1863 create_environment_variable(dest_Path
, "EXTRASPATH", extraspath
);
1865 /* Restore undo state */
1866 data
->instc_copt_undoenabled
= undoenabled
;
1869 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1871 /** STEP : COPY DEVELOPMENT **/
1873 GET(data
->instc_options_main
->opt_development
, MUIA_Selected
, &option
);
1874 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1876 ULONG srcLen
= strlen(source_Path
);
1877 ULONG developerDirLen
= srcLen
+ strlen("Development") + 2;
1878 TEXT developerDir
[srcLen
+ developerDirLen
];
1880 CopyMem(source_Path
, &developerDir
, srcLen
+ 1);
1881 AddPart(developerDir
, "Development", srcLen
+ developerDirLen
);
1883 if ((lock
= Lock(developerDir
, SHARED_LOCK
)) != NULL
)
1885 CONST_STRPTR developer_dirs
[] =
1887 "Development", "Development",
1891 TEXT developmentpath
[100];
1892 BOOL undoenabled
= data
->instc_copt_undoenabled
;
1894 /* Explicitly disable undo. Some users might not have RAM for backup */
1895 data
->instc_copt_undoenabled
= FALSE
;
1899 /* Copying Developer stuff */
1900 D(bug("[INSTALLER] Copying Developer Files...\n"));
1901 SET(data
->label
, MUIA_Text_Contents
, "Copying Developer Files...");
1902 sprintf(developmentpath
, "%s:", extras_path
);
1903 CopyDirArray(CLASS
, self
, source_Path
, developmentpath
, developer_dirs
);
1905 /* Set DEVELPATH environment variable */
1906 AddPart(developmentpath
, "Development", 100);
1907 create_environment_variable(dest_Path
, "DEVELPATH", developmentpath
);
1909 /* Restore undo state */
1910 data
->instc_copt_undoenabled
= undoenabled
;
1912 else D(bug("[INSTALLER] Couldn't locate Developer Files...\n"));
1915 if (!option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1917 /* If not installing Development, delete the package file */
1918 TEXT packagePath
[100];
1919 sprintf(packagePath
, "%s:Prefs/Env-Archive/SYS/Packages/Developer", dest_Path
);
1920 D(bug("[INSTALLER] Deleting Developer Package...\n"));
1921 DeleteFile(packagePath
);
1924 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
1926 /** STEP : INSTALL BOOTLOADER **/
1928 GET(data
->instc_options_main
->opt_bootloader
, MUIA_Selected
, &option
);
1929 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
1931 int numgrubfiles
= 0,file_count
= 0;
1933 ULONG srcLen
= strlen(source_Path
) + strlen(BOOT_PATH
) + strlen(GRUB_PATH
) + 4;
1934 ULONG dstLen
= strlen(dest_Path
)+ strlen(BOOT_PATH
) + strlen(GRUB_PATH
) + 4;
1935 TEXT srcPath
[srcLen
];
1936 TEXT dstPath
[dstLen
];
1938 /* Copy kernel files */
1939 sprintf(srcPath
, "%s", source_Path
);
1940 sprintf(dstPath
, "%s:", dest_Path
);
1941 AddPart(srcPath
, BOOT_PATH
, srcLen
);
1942 AddPart(dstPath
, BOOT_PATH
, dstLen
);
1943 DoMethod(self
, MUIM_IC_CopyFiles
, srcPath
, dstPath
, "#?", FALSE
);
1945 /* Installing GRUB */
1946 D(bug("[INSTALLER] Installing Grub...\n"));
1947 SET(data
->label
, MUIA_Text_Contents
, "Installing Grub...");
1948 SET(data
->pageheader
, MUIA_Text_Contents
, KMsgBootLoader
);
1949 SET(data
->label
, MUIA_Text_Contents
, "Copying BOOT files...");
1951 AddPart(srcPath
, GRUB_PATH
, srcLen
);
1952 AddPart(dstPath
, GRUB_PATH
, dstLen
);
1953 /* Warning: do not modify srcPath or dstPath beyond this point */
1955 /* Get drive chosen to install GRUB bootblock to */
1956 GET(grub_device
, MUIA_String_Contents
, &option
);
1957 strcpy(boot_Device
, (STRPTR
)option
);
1958 boot_Unit
= XGET(grub_unit
, MUIA_String_Integer
);
1961 DoMethod(self
, MUIM_IC_CopyFiles
, srcPath
, dstPath
, "#?.mod", FALSE
);
1964 TEXT
*grub_files
[] =
1966 "boot.img", "boot.img",
1967 "core.img", "core.img",
1968 "grub.cfg", "grub.cfg",
1969 "splash.png", "splash.png",
1970 "_unifont.pff", "_unifont.pff",
1971 "command.lst", "command.lst",
1978 /* Grub 2 text/gfx mode */
1979 GET(data
->instc_options_grub
->gopt_grub2mode
, MUIA_Cycle_Active
, &option
);
1980 if ((int)option
== 1)
1982 /* gfx mode - copy _unifont.pff -> unifont.pff */
1983 ULONG newDstLen
= strlen(dstPath
) + strlen("_unifont.pff") + 2;
1984 TEXT srcFile
[newDstLen
];
1985 TEXT dstFile
[newDstLen
];
1987 sprintf(srcFile
, "%s", dstPath
);
1988 sprintf(dstFile
, "%s", dstPath
);
1989 AddPart(srcFile
, "_unifont.pff", newDstLen
);
1990 AddPart(dstFile
, "unifont.pff", newDstLen
);
1992 DoMethod(self
, MUIM_IC_CopyFile
, srcFile
, dstFile
);
1996 /* other - delete unifont.pff */
1997 ULONG newDstLen
= strlen(dstPath
) + strlen("unifont.pff") + 2;
1998 TEXT dstFile
[newDstLen
];
2000 sprintf(dstFile
, "%s", dstPath
);
2001 AddPart(dstFile
, "unifont.pff", newDstLen
);
2003 DeleteFile(dstFile
);
2008 /* Add entry to boot MS Windows if present */
2009 if ((part_no
= FindWindowsPartition(boot_Device
, boot_Unit
)) != -1)
2011 sprintf(tmp
, "%s", dstPath
);
2012 AddPart(tmp
, "grub.cfg", 256);
2013 BPTR menu_file
= Open(tmp
, MODE_READWRITE
);
2014 if (menu_file
!= NULL
)
2016 Seek(menu_file
, 0, OFFSET_END
);
2018 "\nmenuentry \"Microsoft Windows\" {\n chainloader (hd%ld,%ld)+1\n}\n\n",
2019 boot_Unit
, part_no
+ 1); /* GRUB2 counts partitions from 1 */
2022 D(bug("[INSTALLER] Windows partition found."
2023 " Adding Windows option to GRUB2 menu.\n"));
2027 "C:Install-grub2-i386-pc DEVICE \"%s\" UNIT %d "
2029 boot_Device
, boot_Unit
, dstPath
);
2035 TEXT
*grub_files
[] =
2038 "stage2_hdisk", "stage2",
2039 "menu.lst.DH0", "menu.lst",
2047 /* Add entry to boot MS Windows if present */
2048 if ((part_no
= FindWindowsPartition(boot_Device
, boot_Unit
)) != -1)
2050 sprintf(tmp
, "%s", dstPath
);
2051 AddPart(tmp
, "menu.lst", 256);
2052 BPTR menu_file
= Open(tmp
, MODE_READWRITE
);
2053 if (menu_file
!= NULL
)
2055 Seek(menu_file
, 0, OFFSET_END
);
2057 "\ntitle Microsoft Windows\nrootnoverify (hd%ld,%ld)\nchainloader +1\n",
2058 boot_Unit
, part_no
);
2061 D(bug("[INSTALLER] Windows partition found."
2062 " Adding Windows option to GRUB menu.\n"));
2063 Execute(tmp
, NULL
, NULL
);
2067 "C:install-i386-pc DEVICE \"%s\" UNIT %d "
2068 "GRUB \"%s\" FORCELBA",
2069 boot_Device
, boot_Unit
, dstPath
);
2072 #error bootloader not supported
2075 D(bug("[INSTALLER] execute: %s\n", tmp
));
2076 Execute(tmp
, NULL
, NULL
);
2077 SET(data
->gauge2
, MUIA_Gauge_Current
, 100);
2080 SET(data
->proceed
, MUIA_Disabled
, FALSE
);
2082 /** STEP : PACKAGE CLEANUP **/
2083 /* REMOVED - handled by DEVELPATH and EXTRASPATH variables */
2085 /** STEP : EXECUTE EXTERNAL POST-INSTALL SCRIPT **/
2087 BPTR scriptfile
= Open(POST_INSTALL_SCRIPT
, MODE_OLDFILE
);
2091 D(bug("[INSTALLER] Running post-install script...\n"));
2092 SET(data
->label
, MUIA_Text_Contents
, "Running post-install script...");
2093 SET(data
->pageheader
, MUIA_Text_Contents
, KMsgPostInstall
);
2094 SET(data
->gauge2
, MUIA_Gauge_Current
, 0);
2095 SET(data
->actioncurrent
, MUIA_Text_Contents
, POST_INSTALL_SCRIPT
);
2098 /* Post install script (at this momement) does not allow user interaction.
2099 Set SYS_Input to opened console and SYS_Background to FALSE to allow it.*/
2101 struct TagItem tags
[] =
2103 { SYS_Input
, (IPTR
)NULL
},
2104 { SYS_Output
, (IPTR
)NULL
},
2105 { SYS_Error
, (IPTR
)NULL
},
2106 { SYS_ScriptInput
, (IPTR
)scriptfile
},
2107 { SYS_UserShell
, TRUE
},
2111 D(bug("[INSTALLER] execute: %s\n", POST_INSTALL_SCRIPT
));
2113 SystemTagList("", tags
);
2115 /* Do not close scriptfile. It was closed by SystemTagList */
2117 SET(data
->gauge2
, MUIA_Gauge_Current
, 100);
2121 /** STEP : UNDORECORD CLEANUP **/
2123 D(bug("[INSTALLER] Reached end of Install Function - cleaning up undo logs @ %p...\n",&data
->instc_undorecord
));
2125 struct InstallC_UndoRecord
*CurUndoNode
=NULL
;
2126 struct Node
*undonode_tmp
= NULL
;
2128 ForeachNodeSafe(&data
->instc_undorecord
, CurUndoNode
, undonode_tmp
)
2130 D(bug("[INSTALLER] Removing undo record @ %p\n", CurUndoNode
));
2131 Remove((struct Node
*)CurUndoNode
);
2133 switch (CurUndoNode
->undo_method
)
2135 case MUIM_IC_CopyFile
:
2136 D(bug("[INSTALLER] Deleting undo file '%s'\n",CurUndoNode
->undo_src
));
2137 DeleteFile(CurUndoNode
->undo_src
);
2139 FreeVec(CurUndoNode
->undo_dst
);
2140 FreeVec(CurUndoNode
->undo_src
);
2145 FreeMem(CurUndoNode
, sizeof(struct InstallC_UndoRecord
));
2151 IPTR Install__MUIM_RefreshWindow
2153 Class
*CLASS
, Object
*self
, Msg message
2156 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
2157 ULONG cur_width
= 0,cur_height
= 0;
2159 GET( data
->window
, MUIA_Window_Width
, &cur_width
);
2160 GET( data
->window
, MUIA_Window_Height
, &cur_height
);
2162 if ((data
->cur_width
!= cur_width
)||(data
->cur_height
!= cur_height
))
2164 DoMethod(data
->contents
,MUIM_Hide
);
2165 DoMethod(data
->contents
,MUIM_Layout
);
2166 DoMethod(data
->contents
,MUIM_Show
);
2168 else MUI_Redraw(data
->contents
, MADF_DRAWOBJECT
);
2173 static LONG
FindWindowsPartition(STRPTR device
, LONG unit
)
2176 struct PartitionType type
;
2177 struct PartitionHandle
*root
, *partition
;
2178 LONG partition_no
= -1, i
= 0;
2180 if((root
= OpenRootPartition(device
, unit
)) != NULL
)
2182 if (OpenPartitionTable(root
) == 0)
2184 /* Look for an active partition with a Windows FS */
2185 ForeachNode(&root
->table
->list
, partition
)
2187 GetPartitionAttrsTags
2190 PT_ACTIVE
, (IPTR
) &active
,
2191 PT_TYPE
, (IPTR
) &type
,
2195 if (active
&& (id
== 0x7 || id
== 0xb))
2199 ClosePartitionTable(root
);
2201 CloseRootPartition(root
);
2204 return partition_no
;
2208 LONG
CopyDirArray(Class
*CLASS
, Object
*self
, CONST_STRPTR sourcePath
, CONST_STRPTR destinationPath
,
2209 CONST_STRPTR directories
[])
2211 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
2212 LONG numdirs
= 0, dir_count
= 0;
2215 while (directories
[numdirs
] != NULL
) numdirs
++;
2217 numdirs
= (numdirs
- 1) / 2;
2219 D(bug("[INSTALLER.CDA] Copying %d Dirs...\n", numdirs
));
2221 while ((directories
[dir_count
] != NULL
) && (data
->inst_success
== MUIV_Inst_InProgress
))
2223 ULONG newSrcLen
= strlen(sourcePath
) + strlen(directories
[dir_count
]) + 2;
2224 ULONG newDstLen
= strlen(destinationPath
) + strlen(directories
[dir_count
+ 1]) + 2;
2226 TEXT srcDirs
[newSrcLen
+ strlen(".info") ];
2227 TEXT dstDirs
[newDstLen
+ strlen(".info")];
2229 sprintf(srcDirs
, "%s", sourcePath
);
2230 sprintf(dstDirs
, "%s", destinationPath
);
2231 AddPart(srcDirs
, directories
[dir_count
], newSrcLen
);
2232 AddPart(dstDirs
, directories
[dir_count
+ 1], newDstLen
);
2234 SET(data
->actioncurrent
, MUIA_Text_Contents
, strchr(srcDirs
, ':') + 1);
2236 /* OK Now copy the contents */
2237 DoMethod(self
, MUIM_IC_CopyFiles
, srcDirs
, dstDirs
, "#?", TRUE
);
2239 if (data
->inst_success
== MUIV_Inst_InProgress
)
2241 /* Check if folder has an icon */
2242 CopyMem(".info", srcDirs
+ strlen(srcDirs
) , strlen(".info") + 1);
2243 CopyMem(".info", dstDirs
+ strlen(dstDirs
) , strlen(".info") + 1);
2244 if ((lock
= Lock(srcDirs
, SHARED_LOCK
)) != NULL
)
2247 DoMethod(self
, MUIM_IC_CopyFile
, srcDirs
, dstDirs
);
2255 return dir_count
/ 2; /* Return no. of copied dirs */
2258 BOOL
FormatPartition(CONST_STRPTR device
, CONST_STRPTR name
, ULONG dostype
)
2260 BOOL success
= FALSE
;
2262 if (Inhibit(device
, DOSTRUE
))
2264 success
= Format(device
, name
, dostype
);
2265 Inhibit(device
, DOSFALSE
);
2271 IPTR Install__MUIM_Format
2273 Class
*CLASS
, Object
*self
, Msg message
2276 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
2277 char dev_nametmp
[100];
2278 char fmt_nametmp
[100];
2279 BOOL success
= FALSE
;
2280 IPTR option
= FALSE
;
2284 sprintf(fmt_nametmp
,"Formatting '%s'...",dest_Path
);
2285 D(bug("[INSTALLER] %s\n",fmt_nametmp
));
2286 SET(data
->label
, MUIA_Text_Contents
, fmt_nametmp
);
2287 SET(data
->gauge2
, MUIA_Gauge_Current
, 0);
2290 sprintf(dev_nametmp
,"%s:",dest_Path
);
2292 if ((BOOL
)XGET(check_formatsys
,MUIA_Selected
))
2295 * If partition is FFS -> it will format it for FFS
2296 * If partition is SFS -> it will format it for SFS
2297 * Correct way of doing things: read type for DH0 and DH1, apply correct
2298 * type when formatting
2300 D(bug("[INSTALLER] (info) Using FormatPartition\n"));
2301 success
= FormatPartition(dev_nametmp
, kDstPartName
, ID_INTER_FFS_DISK
);
2303 if (success
) set(data
->gauge2
, MUIA_Gauge_Current
, 100);
2306 GET(check_work
, MUIA_Selected
, &option
);
2307 if (option
&& XGET(check_formatwork
,MUIA_Selected
))
2309 /* Format Vol1, if it's not already formated */
2310 sprintf(fmt_nametmp
,"Formatting '%s'...",work_Path
);
2311 D(bug("[INSTALLER] %s\n",fmt_nametmp
));
2312 SET(data
->label
, MUIA_Text_Contents
, fmt_nametmp
);
2314 SET(data
->gauge2
, MUIA_Gauge_Current
, 0);
2316 sprintf(dev_nametmp
,"%s:",work_Path
);
2319 * If partition is FFS -> it will format it for FFS
2320 * If partition is SFS -> it will format it for SFS
2321 * Correct way of doing things: read type for DH0 and DH1, apply correct
2322 * type when formatting (ID_INTER_FFS_DISK or ID_SFS_BE_DISK)
2324 D(bug("[INSTALLER] (info) Using FormatPartition\n"));
2325 success
= FormatPartition(dev_nametmp
, kDstWorkName
, ID_INTER_FFS_DISK
);
2329 sprintf(tmp
, "%s:", work_Path
);
2330 SET(data
->gauge2
, MUIA_Gauge_Current
, 100);
2331 lock
= Lock(tmp
, SHARED_LOCK
); /* check the dest dir exists */
2334 D(bug("[INSTALLER] (Warning) FORMAT: Failed for chosen work partition '%s' : defaulting to sys only\n", tmp
));
2335 extras_path
= dest_Path
;
2344 if (success
) SET(data
->gauge2
, MUIA_Gauge_Current
, 100);
2349 BPTR
RecursiveCreateDir(CONST_STRPTR dirpath
)
2351 /* Will create directory even if top level directory does not exist */
2354 ULONG lastdirseparator
= 0;
2355 ULONG dirpathlen
= strlen(dirpath
);
2356 STRPTR tmpdirpath
= AllocVec(dirpathlen
+ 2, MEMF_CLEAR
| MEMF_PUBLIC
);
2358 CopyMem(dirpath
, tmpdirpath
, dirpathlen
);
2360 /* Recurvice directory creation */
2363 if (lastdirseparator
>= dirpathlen
) break;
2365 for (; lastdirseparator
< dirpathlen
; lastdirseparator
++)
2366 if (tmpdirpath
[lastdirseparator
] == '/') break;
2368 tmpdirpath
[lastdirseparator
] = '\0'; /* cut */
2370 /* Unlock any lock from previous interation. Last iteration lock will be returned. */
2377 /* Check if directory exists */
2378 lock
= Lock(tmpdirpath
, SHARED_LOCK
);
2381 lock
= CreateDir(tmpdirpath
);
2383 break; /* Error with creation */
2386 tmpdirpath
[lastdirseparator
] = '/'; /* restore */
2390 FreeVec(tmpdirpath
);
2394 BOOL
BackUpFile(CONST_STRPTR filepath
, CONST_STRPTR backuppath
, struct InstallC_UndoRecord
* undorecord
)
2396 ULONG filepathlen
= strlen(filepath
);
2397 ULONG backuppathlen
= strlen(backuppath
);
2400 STRPTR pathpart
= NULL
;
2401 BPTR lock
= NULL
, from
= NULL
, to
= NULL
;
2402 static TEXT buffer
[kBufSize
];
2405 if (undorecord
== NULL
)
2408 undorecord
->undo_src
= AllocVec(filepathlen
+ backuppathlen
+ 3, MEMF_CLEAR
| MEMF_PUBLIC
);
2409 undorecord
->undo_dst
= AllocVec(filepathlen
+ 2, MEMF_CLEAR
| MEMF_PUBLIC
);
2411 /* Create backup file name */
2412 tmp
= AllocVec(filepathlen
+ 2, MEMF_CLEAR
| MEMF_PUBLIC
);
2413 CopyMem(filepath
, tmp
, filepathlen
);
2414 for (i
= 0; i
< filepathlen
; i
++)
2415 if (tmp
[i
] == ':') tmp
[i
] = '/'; /* Substitute : with / */
2416 sprintf(undorecord
->undo_src
, "%s/%s", backuppath
, tmp
);
2419 /* Create source file name */
2420 CopyMem(filepath
, undorecord
->undo_dst
, filepathlen
);
2422 /* Create backup file path */
2423 tmp
= AllocVec(strlen(undorecord
->undo_src
) + 2, MEMF_CLEAR
| MEMF_PUBLIC
);
2424 CopyMem(undorecord
->undo_src
, tmp
, strlen(undorecord
->undo_src
));
2425 pathpart
= PathPart(tmp
);
2426 if (pathpart
== NULL
)
2431 *pathpart
= '\0'; /* 'cut' string at end of path */
2433 D(bug("[INSTALLER.CF] Backup '%s' @ '%s'\n", undorecord
->undo_dst
, undorecord
->undo_src
));
2435 undorecord
->undo_method
=MUIM_IC_CopyFile
;
2437 /* Create backup directory */
2438 if ((lock
= Lock(tmp
, SHARED_LOCK
)) != NULL
)
2440 D(bug("[INSTALLER.CF] Dir '%s' Exists - no need to create\n", tmp
));
2445 lock
= RecursiveCreateDir(tmp
);
2450 D(bug("[INSTALLER.CF] Failed to create %s dir!!\n",tmp
));
2459 if((from
= Open(undorecord
->undo_dst
, MODE_OLDFILE
)))
2461 if((to
= Open(undorecord
->undo_src
, MODE_NEWFILE
)))
2467 if ((s
= Read(from
, buffer
, kBufSize
)) == -1) {err
= TRUE
; break;};
2469 if (Write(to
, buffer
, s
) == -1) {err
= TRUE
; break;};
2471 } while (s
== kBufSize
&& !err
);
2482 IPTR Install__MUIM_IC_CopyFile
2484 Class
*CLASS
, Object
*self
, struct MUIP_CopyFile
* message
2487 struct Install_DATA
*data
= INST_DATA(CLASS
, self
);
2488 static TEXT buffer
[kBufSize
];
2489 struct InstallC_UndoRecord
*undorecord
=NULL
;
2491 ULONG filescopied
= 0;
2495 /* Display copied file name */
2496 SET(data
->actioncurrent
, MUIA_Text_Contents
, strchr(message
->srcFile
, ':') + 1);
2498 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
2500 /* Check if destination file exists */
2501 if((to
= Open(message
->dstFile
, MODE_OLDFILE
)))
2506 switch (data
->IO_Always_overwrite
)
2508 case IIO_Overwrite_Ask
:
2509 retry
= AskRetry( CLASS
, self
, "File Already Exists\nReplace %s?", message
->dstFile
, "Yes", "Yes [Always]", "No");
2514 case 1: /* Always */
2515 data
->IO_Always_overwrite
=IIO_Overwrite_Always
;
2520 case IIO_Overwrite_Always
:
2522 case IIO_Overwrite_Never
:
2526 else goto copy_retry
;
2530 /* if the user has requested - backup all replaced files */
2532 if(data
->instc_copt_undoenabled
)
2534 if ((undorecord
= AllocMem(sizeof(struct InstallC_UndoRecord
), MEMF_CLEAR
| MEMF_PUBLIC
)) == NULL
)
2535 DoMethod(self
, MUIM_IC_QuitInstall
);
2537 if (!BackUpFile(message
->dstFile
, INSTALLAROS_TMP_PATH
, undorecord
))
2539 data
->inst_success
= MUIV_Inst_Failed
;
2544 /* Main copy code */
2547 if((from
= Open(message
->srcFile
, MODE_OLDFILE
)))
2549 if((to
= Open(message
->dstFile
, MODE_NEWFILE
)))
2555 if ((s
= Read(from
, buffer
, kBufSize
)) == -1)
2557 D(bug("[INSTALLER.CF] Failed to read: %s [ioerr=%d]\n", message
->srcFile
, IoErr()));
2562 retry
= AskRetry( CLASS
, self
, "Couldn't Open %s",message
->srcFile
,"Retry","Skip","Cancel");
2570 DoMethod(self
, MUIM_IC_QuitInstall
);
2575 DoMethod(data
->installer
,MUIM_Application_InputBuffered
);
2577 if (Write(to
, buffer
, s
) == -1)
2579 D(bug("[INSTALLER.CF] Failed to write: %s [%d bytes, ioerr=%d]\n", message
->dstFile
, s
, IoErr()));
2581 if (IoErr()==103) retry
= AskRetry( CLASS
, self
, "Couldn't Write to %s\nDisk Full!",message
->dstFile
,"Retry","Skip","Cancel");
2582 else retry
= AskRetry( CLASS
, self
, "Couldn't Write to %s",message
->dstFile
,"Retry","Skip","Cancel");
2594 DoMethod(self
, MUIM_IC_QuitInstall
);
2598 } while ((s
== kBufSize
)&&(data
->inst_success
== MUIV_Inst_InProgress
));
2600 if (data
->inst_success
== MUIV_Inst_InProgress
)
2607 D(bug("[INSTALLER.CF] Failed to open '%s' for writing [ioerr=%d]\n", message
->dstFile
, IoErr()));
2608 data
->inst_success
= MUIV_Inst_Failed
;
2613 /* Add the undo record */
2614 if (undorecord
!=NULL
)
2616 if (filescopied
> 0)
2618 D(bug("[INSTALLER.CF] Adding undo record @ %x to undo list @ %x \n", undorecord
, &data
->instc_undorecord
));
2619 AddHead(&data
->instc_undorecord
, (struct Node
*)undorecord
);
2623 D(bug("[INSTALLER.CF] Freeing undo record\n"));
2624 /* remove the backup file */
2626 DeleteFile(undorecord
->undo_src
);
2628 /* remove the undo record */
2629 FreeVec(undorecord
->undo_dst
);
2630 FreeVec(undorecord
->undo_src
);
2631 FreeMem(undorecord
, sizeof(struct InstallC_UndoRecord
));
2637 D(bug("[INSTALLER.CF] Failed to open: %s [ioerr=%d]\n", message
->srcFile
, IoErr()));
2638 data
->inst_success
= MUIV_Inst_Failed
;
2644 IPTR Install__MUIM_IC_UndoSteps
2646 Class
*CLASS
, Object
*self
, Msg message
2649 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
2650 struct InstallC_UndoRecord
*CurUndoNode
=NULL
;
2652 D(bug("[INSTALLER.US] Performing UNDO steps...\n"));
2654 /* Disbale "UNDO" mode to prevent new records */
2655 data
->instc_copt_undoenabled
=FALSE
;
2657 ForeachNode(&data
->instc_undorecord
, CurUndoNode
)
2659 D(bug("[INSTALLER.US] Removing undo record @ %x\n",CurUndoNode
));
2660 Remove((struct Node
*)CurUndoNode
);
2662 switch (CurUndoNode
->undo_method
)
2664 case MUIM_IC_CopyFile
:
2665 D(bug("[INSTALLER.US] Reverting file '%s'\n",CurUndoNode
->undo_dst
));
2667 DoMethod(self
, CurUndoNode
->undo_method
, CurUndoNode
->undo_src
, CurUndoNode
->undo_dst
);
2669 D(bug("[INSTALLER.US] Deleting undo file '%s'\n",CurUndoNode
->undo_src
));
2670 DeleteFile(CurUndoNode
->undo_src
);
2672 FreeVec(CurUndoNode
->undo_dst
);
2673 FreeVec(CurUndoNode
->undo_src
);
2678 FreeMem(CurUndoNode
, sizeof(struct InstallC_UndoRecord
));
2681 D(bug("[INSTALLER.US] UNDO complete\n"));
2686 IPTR Install__MUIM_Reboot
2688 Class
*CLASS
, Object
*self
, Msg message
2691 struct Install_DATA
* data
= INST_DATA(CLASS
, self
);
2693 IPTR option
= FALSE
;
2695 /* Make sure the user wants to reboot */
2696 GET(data
->instc_options_main
->opt_reboot
, MUIA_Selected
, &option
);
2697 if (option
&& (data
->inst_success
== MUIV_Inst_InProgress
))
2699 D(bug("[INSTALLER] Cold rebooting...\n"));
2704 D(bug("[INSTALLER] Install Finished [no reboot]...\n"));
2705 if (data
->inst_success
== MUIV_Inst_InProgress
) data
->inst_success
= MUIV_Inst_Completed
;
2706 SET(data
->window
,MUIA_Window_CloseRequest
,TRUE
);
2709 return TRUE
; /* Keep the compiler happy... */
2712 IPTR Install__OM_SET
2714 Class
*CLASS
, Object
*self
, struct opSet
*message
2717 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
2720 BOOPSI_DISPATCHER(IPTR
, Install_Dispatcher
, CLASS
, self
, message
)
2722 switch (message
->MethodID
)
2725 return Install__OM_NEW(CLASS
, self
, (struct opSet
*) message
);
2728 return Install__OM_SET(CLASS
, self
, (struct opSet
*) message
);
2730 case MUIM_FindDrives
:
2731 return Install__MUIM_FindDrives(CLASS
, self
, message
);
2733 case MUIM_IC_NextStep
:
2734 return Install__MUIM_IC_NextStep(CLASS
, self
, message
);
2736 case MUIM_IC_PrevStep
:
2737 return Install__MUIM_IC_PrevStep(CLASS
, self
, message
);
2738 //cancel control methods
2739 case MUIM_IC_CancelInstall
:
2740 return Install__MUIM_IC_CancelInstall(CLASS
, self
, message
);
2742 case MUIM_IC_ContinueInstall
:
2743 return Install__MUIM_IC_ContinueInstall(CLASS
, self
, message
);
2745 case MUIM_IC_QuitInstall
:
2746 return Install__MUIM_IC_QuitInstall(CLASS
, self
, message
);
2749 return Install__MUIM_Reboot(CLASS
, self
, message
);
2751 //This should dissapear
2752 case MUIM_RefreshWindow
:
2753 return Install__MUIM_RefreshWindow(CLASS
, self
, message
);
2755 case MUIM_IC_Install
:
2756 return Install__MUIM_IC_Install(CLASS
, self
, message
);
2758 //These will be consumed by the io task
2759 case MUIM_Partition
:
2760 return Install__MUIM_Partition(CLASS
, self
, message
);
2763 return Install__MUIM_Format(CLASS
, self
, message
);
2765 case MUIM_IC_CopyFiles
:
2766 return Install__MUIM_IC_CopyFiles(CLASS
, self
, (struct MUIP_CopyFiles
*)message
);
2768 case MUIM_IC_CopyFile
:
2769 return Install__MUIM_IC_CopyFile(CLASS
, self
, (struct MUIP_CopyFile
*)message
);
2771 case MUIM_IC_UndoSteps
:
2772 return Install__MUIM_IC_UndoSteps(CLASS
, self
, message
);
2775 return DoSuperMethodA(CLASS
, self
, message
);
2780 BOOPSI_DISPATCHER_END
2798 int main(int argc
,char *argv
[])
2802 Object
*wnd
= NULL
; /* installer window objects - will get swallowed into the class eventually */
2803 Object
*wndcontents
= NULL
;
2804 Object
*page
= NULL
;
2806 Object
*welcomeMsg
= NULL
;
2807 Object
*LicenseMsg
= NULL
;
2808 Object
*doneMsg
= NULL
;
2810 Object
*pagetitle
= NULL
;
2811 Object
*pageheader
= NULL
;
2812 Object
*currentaction
= NULL
;
2814 Object
*radio_part
= NULL
;
2816 Object
*gad_back
= SimpleButton("<< _Back...");
2817 Object
*gad_proceed
= SimpleButton(KMsgProceed
);
2818 Object
*gad_cancel
= SimpleButton("_Cancel");
2821 Object
*grub_drive
= NULL
;
2822 Object
*grub_grub
= NULL
;
2824 Object
*LicenseMandGrp
= NULL
;
2825 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
;
2827 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
;
2828 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
;
2829 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
;
2830 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
;
2831 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
;
2832 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
;
2834 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
;
2836 Object
* gauge1
= (GaugeObject
, MUIA_Gauge_InfoText
, "%ld %%", MUIA_Gauge_Horiz
, TRUE
, MUIA_Gauge_Current
, 0, End
);
2837 Object
* gauge2
= (GaugeObject
, MUIA_Gauge_InfoText
, "%ld %%", MUIA_Gauge_Horiz
, TRUE
, MUIA_Gauge_Current
, 0, End
);
2838 Object
* gauge3
= (GaugeObject
, MUIA_Gauge_InfoText
, "%ld %%", MUIA_Gauge_Horiz
, TRUE
, MUIA_Gauge_Current
, 0, End
);
2842 static char *opt_partentries
[] =
2844 "Only use free space",
2846 "Use existing AROS partitions (on any drive)",
2849 struct Install_Options
*install_opts
= NULL
;
2850 struct Grub_Options
*grub_opts
= NULL
;
2851 char *source_path
= NULL
;
2852 char *dest_path
= NULL
;
2853 char *work_path
= NULL
;
2857 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
;
2858 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
;
2859 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
;
2860 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
;
2862 check_sizesys
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
,
2863 MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
,
2864 MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
,
2865 MUIA_ShowSelState
, FALSE
, MUIA_Selected
, FALSE
, End
;
2866 check_sizework
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
,
2867 MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
,
2868 MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
,
2869 MUIA_ShowSelState
, FALSE
, MUIA_Selected
, FALSE
, MUIA_Disabled
, TRUE
,
2871 check_creatework
= ImageObject
, ImageButtonFrame
, MUIA_InputMode
,
2872 MUIV_InputMode_Toggle
, MUIA_Image_Spec
, MUII_CheckMark
,
2873 MUIA_Image_FreeVert
, TRUE
, MUIA_Background
, MUII_ButtonBack
,
2874 MUIA_ShowSelState
, FALSE
, MUIA_Selected
, FALSE
, MUIA_Disabled
, TRUE
,
2877 static char *opt_fstypes
[] =
2885 cycle_fstypesys
= CycleObject
, MUIA_Cycle_Entries
, opt_fstypes
, MUIA_Disabled
, FALSE
, MUIA_Cycle_Active
, 1, End
;
2887 cycle_fstypesys
= CycleObject
, MUIA_Cycle_Entries
, opt_fstypes
, MUIA_Disabled
, FALSE
, MUIA_Cycle_Active
, 0, End
;
2889 cycle_fstypework
= CycleObject
, MUIA_Cycle_Entries
, opt_fstypes
, MUIA_Disabled
, TRUE
, MUIA_Cycle_Active
, 1, End
;
2891 static char *opt_sizeunits
[] =
2898 cycle_sysunits
= CycleObject
, MUIA_Cycle_Entries
, opt_sizeunits
, MUIA_Disabled
, TRUE
, MUIA_Cycle_Active
, 1, End
;
2899 cycle_workunits
= CycleObject
, MUIA_Cycle_Entries
, opt_sizeunits
, MUIA_Disabled
, TRUE
, MUIA_Cycle_Active
, 1, End
;
2901 static char *opt_grub2mode
[] =
2908 Object
* cycle_grub2mode
= CycleObject
, MUIA_Cycle_Entries
, opt_grub2mode
, MUIA_Disabled
,
2909 FALSE
, MUIA_Cycle_Active
, 0, End
;
2911 install_opts
= AllocMem( sizeof(struct Install_Options
), MEMF_CLEAR
| MEMF_PUBLIC
);
2912 grub_opts
= AllocMem( sizeof(struct Grub_Options
), MEMF_CLEAR
| MEMF_PUBLIC
);
2913 source_path
= AllocVec( 256, MEMF_CLEAR
| MEMF_PUBLIC
);
2915 dest_path
= AllocVec( 256, MEMF_CLEAR
| MEMF_PUBLIC
);
2916 work_path
= AllocVec( 256, MEMF_CLEAR
| MEMF_PUBLIC
);
2920 if (!(ExpansionBase
= (struct ExpansionBase
*)OpenLibrary("expansion.library", 0)))
2923 if (!NameFromLock(GetProgramDir(), source_path
, 255))
2925 D(bug("[INST-APP] Couldn't get progdir\n"));
2928 pathend
= (IPTR
)FilePart(source_path
);
2929 pathend
= pathend
- (IPTR
)source_path
;
2931 D(bug("[INST-APP] Path length = %d bytes\n", pathend
));
2933 source_Path
= AllocVec( pathend
+ 1 , MEMF_CLEAR
| MEMF_PUBLIC
);
2934 CopyMem(source_path
, source_Path
, pathend
);
2935 D(bug("[INST-APP] Launched from '%s'\n", source_Path
));
2936 FreeVec(source_path
);
2938 dest_Path
= dest_path
;
2939 sprintf(dest_Path
,"" kDstPartVol
);
2941 work_Path
= work_path
;
2942 sprintf(work_Path
,"" kDstWorkVol
);
2945 lock
= Lock(DEF_INSTALL_IMAGE
, ACCESS_READ
);
2950 LicenseMsg
= MUI_NewObject(MUIC_TextEditor
,
2951 MUIA_Background
, MUII_SHINE
,
2952 MUIA_TextEditor_ReadOnly
, TRUE
,
2957 D(bug("[INST-APP] Failed to create LicenseMsg Object\n"));
2961 Object
*app
= ApplicationObject
,
2962 MUIA_Application_Title
, (IPTR
) "AROS Installer",
2963 MUIA_Application_Version
, (IPTR
) "$VER: InstallAROS 1.1 (7.4.2009)",
2964 MUIA_Application_Copyright
, (IPTR
) "Copyright © 2003-2009, The AROS Development Team. All rights reserved.",
2965 MUIA_Application_Author
, (IPTR
) "John \"Forgoil\" Gustafsson, Nic Andrews & Neil Cafferkey",
2966 MUIA_Application_Description
, (IPTR
) "Installs AROS on to a PC.",
2967 MUIA_Application_Base
, (IPTR
) "INSTALLER",
2969 SubWindow
, (IPTR
) (wnd
= WindowObject
,
2970 MUIA_Window_Title
, (IPTR
) "AROS Installer",
2971 MUIA_Window_ID
, MAKE_ID('f','o','r','g'),
2972 MUIA_Window_SizeGadget
, TRUE
,
2973 WindowContents
, (IPTR
) (wndcontents
= VGroup
,
2975 Child
, (IPTR
) VGroup
,
2976 Child
, (IPTR
) HGroup
,
2977 Child
, (IPTR
) VGroup
,
2978 MUIA_Background
, MUII_SHADOW
,
2980 Child
, (IPTR
) ImageObject
,
2981 MUIA_Frame
, MUIV_Frame_None
,
2982 MUIA_Image_Spec
, (IPTR
) "3:"DEF_INSTALL_IMAGE
,
2984 Child
, (IPTR
) HVSpace
,
2987 Child
, (IPTR
) ScrollgroupObject
,
2988 MUIA_Scrollgroup_FreeHoriz
, FALSE
,
2989 MUIA_Scrollgroup_FreeVert
, TRUE
,
2990 MUIA_Scrollgroup_Contents
, (IPTR
) (page
= VGroup
,
2991 MUIA_Group_PageMode
, TRUE
,
2994 /* each page represents an install time page... you must have one for each enumerated install progress page */
2996 Child
, (IPTR
) VGroup
,
2997 Child
, (IPTR
) VGroup
,
2998 Child
, (IPTR
) (welcomeMsg
= FreeCLabel("")),
2999 Child
, (IPTR
) HVSpace
,
3003 Child
, (IPTR
) VGroup
,
3004 Child
, (IPTR
) VGroup
,
3005 Child
, (IPTR
) LicenseMsg
,
3006 Child
, (IPTR
) (LicenseMandGrp
= HGroup
,
3007 Child
, (IPTR
) HVSpace
,
3008 Child
, (IPTR
) check_license
,
3009 Child
, (IPTR
) LLabel("Accept License Agreement?"),
3010 Child
, (IPTR
) HVSpace
,
3015 /* Partitioning options */
3016 Child
, (IPTR
) VGroup
,
3017 Child
, (IPTR
) VGroup
,
3018 Child
, (IPTR
) CLabel(KMsgPartitionOptions
),
3019 Child
, (IPTR
) HVSpace
,
3021 Child
, (IPTR
) ColGroup(5),
3022 Child
, (IPTR
) LLabel("Device:"),
3023 Child
, (IPTR
) (dest_device
=
3025 MUIA_String_Contents
, (IPTR
) "ata.device",
3026 MUIA_String_Reject
, " \"\'*",
3027 MUIA_HorizWeight
, 200,
3029 Child
, (IPTR
) HVSpace
,
3030 Child
, (IPTR
) LLabel("Unit:"),
3031 Child
, (IPTR
) (dest_unit
=
3033 MUIA_String_Integer
, 0,
3034 MUIA_String_Accept
, "0123456789",
3035 MUIA_HorizWeight
, 20,
3039 Child
, (IPTR
) HVSpace
,
3040 Child
, (IPTR
) (radio_part
= RadioObject
,
3042 MUIA_Radio_Entries
, (IPTR
) opt_partentries
,
3044 Child
, (IPTR
) HVSpace
,
3045 Child
, (IPTR
) ColGroup(2),
3046 Child
, (IPTR
) ColGroup(2),
3047 Child
, (IPTR
) LLabel(KMsgDestPartition
),
3048 Child
, (IPTR
) HVSpace
,
3051 Child
, (IPTR
) ColGroup(7),
3052 Child
, (IPTR
) LLabel("Filesystem:"),
3053 Child
, (IPTR
) cycle_fstypesys
,
3054 Child
, (IPTR
) LLabel("Size:"),
3055 Child
, (IPTR
) (sys_size
= StringObject
,
3056 MUIA_String_Accept
, "0123456789",
3057 MUIA_String_Integer
, 0,
3058 MUIA_Disabled
, TRUE
, End
),
3059 Child
, (IPTR
) cycle_sysunits
,
3060 Child
, (IPTR
) check_sizesys
,
3061 Child
, (IPTR
) LLabel("Specify Size"),
3063 Child
, (IPTR
) HVSpace
,
3064 Child
, (IPTR
) ColGroup(4),
3065 Child
, (IPTR
) LLabel(KMsgWorkPartition
),
3066 Child
, (IPTR
) HVSpace
,
3067 Child
, (IPTR
) check_creatework
,
3068 Child
, (IPTR
) LLabel("Create"),
3070 Child
, (IPTR
) ColGroup(7),
3071 Child
, (IPTR
) LLabel("Filesystem:"),
3072 Child
, (IPTR
) cycle_fstypework
,
3073 Child
, (IPTR
) LLabel("Size:"),
3074 Child
, (IPTR
) (work_size
= StringObject
,
3075 MUIA_String_Accept
, "0123456789",
3076 MUIA_String_Integer
, 0,
3077 MUIA_Disabled
, TRUE
, End
),
3078 Child
, (IPTR
) cycle_workunits
,
3079 Child
, (IPTR
) check_sizework
,
3080 Child
, (IPTR
) LLabel("Specify Size"),
3085 Child
, (IPTR
) VGroup
,
3086 Child
, (IPTR
) VGroup
,
3087 Child
, (IPTR
) CLabel(KMsgInstallOptions
),
3088 Child
, (IPTR
) HVSpace
,
3089 Child
, (IPTR
) ColGroup(2),
3090 Child
, (IPTR
) check_locale
,
3091 Child
, (IPTR
) LLabel("Choose Language Options"),
3092 Child
, (IPTR
) check_core
,
3093 Child
, (IPTR
) LLabel("Install AROS Core System"),
3094 Child
, (IPTR
) check_extras
,
3095 Child
, (IPTR
) LLabel("Install Extra Software"),
3096 Child
, (IPTR
) check_dev
,
3097 Child
, (IPTR
) LLabel("Install Development Software"),
3098 Child
, (IPTR
) check_bootloader
,
3099 Child
, (IPTR
) LLabel("Install Bootloader"),
3101 Child
, (IPTR
) HVSpace
,
3105 Child
, (IPTR
) VGroup
,
3106 Child
, (IPTR
) VGroup
,
3107 Child
, (IPTR
) CLabel(KMsgDestOptions
),
3108 Child
, (IPTR
) HVSpace
,
3109 Child
, (IPTR
) ColGroup(2),
3110 Child
, (IPTR
) ColGroup(2),
3111 Child
, (IPTR
) LLabel(KMsgDestVolume
),
3112 Child
, (IPTR
) HVSpace
,
3114 Child
, (IPTR
) (show_formatsys
= ColGroup(2),
3115 Child
, (IPTR
) check_formatsys
,
3116 Child
, (IPTR
) LLabel("Format Partition"),
3119 Child
, (IPTR
) HVSpace
,
3120 Child
, (IPTR
) (dest_volume
= StringObject
,
3121 MUIA_String_Contents
, (IPTR
) dest_Path
,
3123 Child
, (IPTR
) HVSpace
,
3124 Child
, (IPTR
) ColGroup(2),
3125 Child
, (IPTR
) check_work
,
3126 Child
, (IPTR
) LLabel("Use 'Work' Partition"),
3127 Child
, (IPTR
) check_copytowork
,
3128 Child
, (IPTR
) LLabel("Use 'Work' Partition for Extras and Developer Files"),
3130 Child
, (IPTR
) HVSpace
,
3132 Child
, (IPTR
) ColGroup(2),
3133 Child
, (IPTR
) ColGroup(2),
3134 Child
, (IPTR
) LLabel(KMsgWorkVolume
),
3135 Child
, (IPTR
) HVSpace
,
3137 Child
, (IPTR
) (show_formatwork
= ColGroup(2),
3138 Child
, (IPTR
) check_formatwork
,
3139 Child
, (IPTR
) LLabel("Format Partition"),
3142 Child
, (IPTR
) HVSpace
,
3143 Child
, (IPTR
) (work_volume
=
3145 MUIA_String_Contents
,
3147 MUIA_Disabled
, TRUE
,
3149 Child
, (IPTR
) HVSpace
,
3153 /* Bootloader options */
3154 Child
, (IPTR
) VGroup
,
3155 Child
, (IPTR
) VGroup
,
3156 Child
, (IPTR
) CLabel(KMsgGrubOptions
),
3157 Child
, (IPTR
) HVSpace
,
3158 Child
, (IPTR
) LLabel(KMsgGrubGOptions
),
3159 Child
, (IPTR
) LLabel(KMsgGrubDrive
),
3160 Child
, (IPTR
) HVSpace
,
3162 Child
, (IPTR
) ColGroup(5),
3163 Child
, (IPTR
) HVSpace
,
3164 Child
, (IPTR
) LLabel("Device:"),
3165 Child
, (IPTR
) (grub_device
=
3167 MUIA_String_Reject
, " \"\'*",
3168 MUIA_HorizWeight
, 200,
3170 Child
, (IPTR
) HVSpace
,
3171 Child
, (IPTR
) LLabel("Unit:"),
3172 Child
, (IPTR
) (grub_unit
=
3174 MUIA_String_Integer
, 0,
3175 MUIA_String_Accept
, "0123456789",
3176 MUIA_HorizWeight
, 20,
3180 Child
, (IPTR
) (grub_drive
= TextObject
, MUIA_Text_PreParse
, (IPTR
) "" MUIX_C
, MUIA_Text_Contents
, (IPTR
)" ",End
),
3181 Child
, (IPTR
) HVSpace
,
3182 Child
, (IPTR
) LLabel(KMsgGrubGrub
),
3183 Child
, (IPTR
) HVSpace
,
3184 Child
, (IPTR
) (grub_grub
= TextObject
, MUIA_Text_PreParse
, (IPTR
) "" MUIX_C
, MUIA_Text_Contents
, (IPTR
)" ",End
),
3185 Child
, (IPTR
) HVSpace
,
3186 Child
, (IPTR
) ColGroup(4),
3187 Child
, (IPTR
) LLabel("Menu Mode:"),
3188 Child
, (IPTR
) cycle_grub2mode
,
3189 Child
, (IPTR
) HVSpace
,
3191 Child
, (IPTR
) HVSpace
,
3195 Child
, (IPTR
) VGroup
,
3196 Child
, (IPTR
) VGroup
,
3197 Child
, (IPTR
) CLabel(KMsgPartitioning
),
3198 Child
, (IPTR
) HVSpace
,
3199 Child
, (IPTR
) VGroup
, GaugeFrame
,MUIA_Background
, MUII_HSHINEBACK
, Child
, gauge1
, End
,
3200 Child
, (IPTR
) ScaleObject
, End
,
3201 Child
, (IPTR
) HVSpace
,
3205 Child
, (IPTR
) VGroup
,
3206 Child
, (IPTR
) VGroup
,
3207 Child
, (IPTR
) CLabel(KMsgPartitioning
),
3208 Child
, (IPTR
) HVSpace
,
3209 Child
, (IPTR
) VGroup
, GaugeFrame
,MUIA_Background
, MUII_HSHINEBACK
, Child
, (IPTR
) gauge3
, End
,
3210 Child
, (IPTR
) ScaleObject
, End
,
3211 Child
, (IPTR
) HVSpace
,
3215 Child
, (IPTR
) VGroup
,
3216 Child
, (IPTR
) VGroup
,
3217 Child
, (IPTR
) (pagetitle
= CLabel(" ")),
3218 Child
, (IPTR
) HVSpace
,
3219 Child
, (IPTR
) (pageheader
= FreeCLabel(KMsgInstall
)),
3220 Child
, (IPTR
) HVSpace
,
3221 Child
, (IPTR
) (label
= FreeLLabel("YOU SHOULD NOT SEE THIS")),
3222 Child
, (IPTR
) HVSpace
,
3223 Child
, (IPTR
) (currentaction
= TextObject
,MUIA_Text_Contents
,(IPTR
)" ",End
),
3224 Child
, (IPTR
) VGroup
, GaugeFrame
,MUIA_Background
, MUII_HSHINEBACK
, Child
, gauge2
, End
,
3225 Child
, (IPTR
) HVSpace
,
3229 /* Completed page */
3230 Child
, (IPTR
) VGroup
,
3231 Child
, (IPTR
) VGroup
,
3232 MUIA_Group_SameHeight
, FALSE
,
3233 Child
, (IPTR
) (doneMsg
= FreeCLabel(KMsgDone
)),
3234 Child
, (IPTR
) HVSpace
,
3235 Child
, (IPTR
) (reboot_group
= ColGroup(2),
3238 Child
, (IPTR
) check_reboot
,
3239 Child
, (IPTR
) LLabel("Reboot AROS now"),
3249 Child
, (IPTR
) HGroup
,
3250 Child
, (IPTR
) HVSpace
,
3251 Child
, (IPTR
) gad_back
,
3252 Child
, (IPTR
) gad_proceed
,
3253 Child
, (IPTR
) gad_cancel
,
3262 D(bug("[INST-APP] Failed to create Installer GUI\n"));
3266 /* Update GUI in response to certain user actions */
3268 /* Notifications on partitioning action */
3269 DoMethod(radio_part
, MUIM_Notify
, (IPTR
) MUIA_Radio_Active
, 0,
3270 (IPTR
) check_sizesys
, 3, MUIM_Set
,
3271 MUIA_Disabled
, FALSE
);
3272 DoMethod(radio_part
, MUIM_Notify
, (IPTR
) MUIA_Radio_Active
, 1,
3273 (IPTR
) check_sizesys
, 3, MUIM_Set
,
3274 MUIA_Disabled
, FALSE
);
3275 DoMethod(radio_part
, MUIM_Notify
, (IPTR
) MUIA_Radio_Active
, 2,
3276 (IPTR
) check_sizesys
, 3, MUIM_Set
,
3277 MUIA_Disabled
, TRUE
);
3278 DoMethod(radio_part
, MUIM_Notify
, (IPTR
) MUIA_Radio_Active
, 2,
3279 (IPTR
) check_sizesys
, 3, MUIM_Set
,
3280 MUIA_Selected
, FALSE
);
3282 /* Notifications on change of enable status of 'entry size of sys volume' */
3283 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Disabled
, MUIV_EveryTime
,
3284 (IPTR
) dest_device
, 3, MUIM_Set
,
3285 MUIA_Disabled
, MUIV_TriggerValue
);
3286 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Disabled
, MUIV_EveryTime
,
3287 (IPTR
) dest_unit
, 3, MUIM_Set
,
3288 MUIA_Disabled
, MUIV_TriggerValue
);
3289 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Disabled
, MUIV_EveryTime
,
3290 (IPTR
) cycle_fstypesys
, 3, MUIM_Set
,
3291 MUIA_Disabled
, MUIV_TriggerValue
);
3293 /* Notifications on change of selected status of 'entry size of sys volume' */
3294 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3295 (IPTR
) check_creatework
, 3, MUIM_Set
,
3296 MUIA_Disabled
, MUIV_NotTriggerValue
);
3297 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3298 (IPTR
) sys_size
, 3, MUIM_Set
,
3299 MUIA_Disabled
, MUIV_NotTriggerValue
);
3300 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3301 (IPTR
) cycle_sysunits
, 3, MUIM_Set
,
3302 MUIA_Disabled
, MUIV_NotTriggerValue
);
3303 DoMethod(check_sizesys
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3304 (IPTR
) check_creatework
, 3, MUIM_Set
,
3305 MUIA_Selected
, FALSE
);
3307 /* Notifications on change of selected status of 'create work volume' */
3308 DoMethod(check_creatework
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3309 (IPTR
) check_sizework
, 3, MUIM_Set
,
3310 MUIA_Disabled
, MUIV_NotTriggerValue
);
3311 DoMethod(check_creatework
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3312 (IPTR
) cycle_fstypework
, 3, MUIM_Set
,
3313 MUIA_Disabled
, MUIV_NotTriggerValue
);
3314 DoMethod(check_creatework
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3315 (IPTR
) check_sizework
, 3, MUIM_Set
,
3316 MUIA_Selected
, FALSE
);
3318 /* Notifications on change of selected status of 'enter size of work volume' */
3319 DoMethod(check_sizework
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3320 (IPTR
) work_size
, 3, MUIM_Set
,
3321 MUIA_Disabled
, MUIV_NotTriggerValue
);
3322 DoMethod(check_sizework
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3323 (IPTR
) cycle_workunits
, 3, MUIM_Set
,
3324 MUIA_Disabled
, MUIV_NotTriggerValue
);
3326 #if 0 /* Notification doesn't seem to work on String gadgets */
3327 DoMethod(dest_volume
, MUIM_Notify
, MUIA_String_Contents
, MUIV_EveryTime
,
3328 (IPTR
) dest_volume
, 3, MUIM_WriteString
,
3329 MUIV_TriggerValue
, dest_Path
);
3331 /* Notifications on installing bootloader */
3332 DoMethod(check_bootloader
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3333 (IPTR
) cycle_grub2mode
, 3, MUIM_Set
,
3334 MUIA_Disabled
, MUIV_NotTriggerValue
);
3337 DoMethod(check_core
, MUIM_Notify
, MUIA_Selected
, FALSE
,
3338 (IPTR
) check_formatsys
, 3, MUIM_Set
,
3339 MUIA_Selected
, FALSE
);
3340 DoMethod(check_work
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3341 (IPTR
) check_copytowork
, 3, MUIM_Set
,
3342 MUIA_Disabled
, MUIV_NotTriggerValue
);
3343 DoMethod(check_work
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3344 (IPTR
) check_copytowork
, 3, MUIM_Set
,
3345 MUIA_Selected
, FALSE
);
3346 DoMethod(check_work
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3347 (IPTR
) check_formatwork
, 3, MUIM_Set
,
3348 MUIA_Disabled
, MUIV_NotTriggerValue
);
3349 DoMethod(check_work
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3350 (IPTR
) check_formatwork
, 3, MUIM_Set
,
3351 MUIA_Selected
, FALSE
);
3352 DoMethod(check_work
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
3353 (IPTR
) work_volume
, 3, MUIM_Set
,
3354 MUIA_Disabled
, MUIV_NotTriggerValue
);
3357 install_opts
->opt_license
= check_license
;
3358 install_opts
->opt_lic_box
= LicenseMsg
;
3359 install_opts
->opt_lic_mgrp
= LicenseMandGrp
;
3361 install_opts
->opt_partmethod
= radio_part
;
3363 install_opts
->opt_format
= check_format
;
3364 install_opts
->opt_locale
= check_locale
;
3365 install_opts
->opt_copycore
= check_core
;
3366 install_opts
->opt_copyextra
= check_extras
;
3367 install_opts
->opt_development
= check_dev
;
3368 install_opts
->opt_bootloader
= check_bootloader
;
3370 install_opts
->opt_reboot
= check_reboot
;
3372 grub_opts
->gopt_drive
= grub_drive
;
3373 grub_opts
->gopt_grub
= grub_grub
;
3374 grub_opts
->gopt_grub2mode
= cycle_grub2mode
;
3376 struct MUI_CustomClass
*mcc
= MUI_CreateCustomClass(NULL
, MUIC_Notify
, NULL
, sizeof(struct Install_DATA
), Install_Dispatcher
);
3377 Object
*installer
= NewObject(mcc
->mcc_Class
, NULL
,
3379 MUIA_Page
, (IPTR
) page
,
3380 MUIA_Gauge1
, (IPTR
) gauge1
,
3381 MUIA_Gauge2
, (IPTR
) gauge2
,
3382 MUIA_Install
, (IPTR
) label
,
3385 MUIA_OBJ_Installer
,(IPTR
) app
,
3387 MUIA_WelcomeMsg
, (IPTR
) welcomeMsg
,
3388 MUIA_FinishedMsg
, (IPTR
) doneMsg
,
3390 MUIA_List_Options
, (IPTR
) install_opts
,
3391 MUIA_Grub_Options
, (IPTR
) grub_opts
,
3393 MUIA_OBJ_WindowContent
,(IPTR
) wndcontents
,
3394 MUIA_OBJ_Window
,(IPTR
) wnd
,
3396 MUIA_OBJ_PageTitle
, (IPTR
) pagetitle
,
3397 MUIA_OBJ_PageHeader
, (IPTR
) pageheader
,
3398 MUIA_OBJ_CActionStrng
, (IPTR
) currentaction
,
3399 MUIA_OBJ_Back
,(IPTR
) gad_back
,
3400 MUIA_OBJ_Proceed
,(IPTR
) gad_proceed
,
3401 MUIA_OBJ_Cancel
,(IPTR
) gad_cancel
,
3403 MUIA_IC_EnableUndo
, TRUE
,
3405 // MUIA_IC_License_File,"HELP:English/license", /* License can only be viewed by highlighting text and dragging */
3406 MUIA_IC_License_Mandatory
, TRUE
,
3410 DoMethod(wnd
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
, app
,2,MUIM_Application_ReturnID
,MUIV_Application_ReturnID_Quit
);
3412 SET(wnd
,MUIA_Window_Open
,TRUE
);
3416 while (DoMethod(app
,MUIM_Application_NewInput
,&sigs
) != MUIV_Application_ReturnID_Quit
)
3420 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
3421 if (sigs
& SIGBREAKF_CTRL_C
) break;
3426 D(bug("[INST-APP] Closing Window\n"));
3428 SET(wnd
,MUIA_Window_Open
,FALSE
);
3430 D(bug("[INST-APP] Disposing of Installer Object\n"));
3432 DisposeObject(installer
);
3434 D(bug("[INST-APP] Removing Custom Class\n"));
3436 MUI_DeleteCustomClass(mcc
);
3438 D(bug("[INST-APP] Removing App Object\n"));
3440 MUI_DisposeObject(app
);