|
@@ -74,10 +74,12 @@ program install;
|
|
{$IFDEF DLL}
|
|
{$IFDEF DLL}
|
|
unzipdll,
|
|
unzipdll,
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
- app,dialogs,views,menus,msgbox,tabs;
|
|
|
|
|
|
+ app,dialogs,views,menus,msgbox,colortxt,tabs;
|
|
|
|
|
|
|
|
|
|
const
|
|
const
|
|
|
|
+ installerversion='0.99.12b';
|
|
|
|
+
|
|
maxpackages=20;
|
|
maxpackages=20;
|
|
maxsources=20;
|
|
maxsources=20;
|
|
maxdefcfgs=1024;
|
|
maxdefcfgs=1024;
|
|
@@ -113,6 +115,7 @@ program install;
|
|
|
|
|
|
datarec=packed record
|
|
datarec=packed record
|
|
basepath : DirStr;
|
|
basepath : DirStr;
|
|
|
|
+ cfgval : word;
|
|
packmask : word;
|
|
packmask : word;
|
|
srcmask : word;
|
|
srcmask : word;
|
|
end;
|
|
end;
|
|
@@ -226,6 +229,44 @@ program install;
|
|
file_exists:=fsearch(f,path)<>'';
|
|
file_exists:=fsearch(f,path)<>'';
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ function createdir(s:string):boolean;
|
|
|
|
+ var
|
|
|
|
+ s1,start : string;
|
|
|
|
+ err : boolean;
|
|
|
|
+ i : longint;
|
|
|
|
+ begin
|
|
|
|
+ err:=false;
|
|
|
|
+ {$I-}
|
|
|
|
+ getdir(0,start);
|
|
|
|
+{$ifndef linux}
|
|
|
|
+ if (s[2]=':') and (s[3]=DirSep) then
|
|
|
|
+ begin
|
|
|
|
+ chdir(Copy(s,1,3));
|
|
|
|
+ Delete(S,1,3);
|
|
|
|
+ end;
|
|
|
|
+{$endif}
|
|
|
|
+ repeat
|
|
|
|
+ i:=Pos(DirSep,s);
|
|
|
|
+ if i=0 then
|
|
|
|
+ i:=255;
|
|
|
|
+ s1:=Copy(s,1,i-1);
|
|
|
|
+ Delete(s,1,i);
|
|
|
|
+ ChDir(s1);
|
|
|
|
+ if ioresult<>0 then
|
|
|
|
+ begin
|
|
|
|
+ mkdir(s1);
|
|
|
|
+ chdir(s1);
|
|
|
|
+ if ioresult<>0 then
|
|
|
|
+ begin
|
|
|
|
+ err:=true;
|
|
|
|
+ break;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ until s='';
|
|
|
|
+ chdir(start);
|
|
|
|
+ {$I+}
|
|
|
|
+ createdir:=err;
|
|
|
|
+ end;
|
|
|
|
|
|
function DiskSpaceN(const zipfile : string) : longint;
|
|
function DiskSpaceN(const zipfile : string) : longint;
|
|
var
|
|
var
|
|
@@ -249,11 +290,8 @@ program install;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
- function createdir(s : string) : boolean;
|
|
|
|
|
|
+ function createinstalldir(s : string) : boolean;
|
|
var
|
|
var
|
|
- start,
|
|
|
|
- s1 : string;
|
|
|
|
- i : longint;
|
|
|
|
err : boolean;
|
|
err : boolean;
|
|
dir : searchrec;
|
|
dir : searchrec;
|
|
params : array[0..0] of pointer;
|
|
params : array[0..0] of pointer;
|
|
@@ -263,55 +301,25 @@ program install;
|
|
FindFirst(s,AnyFile,dir);
|
|
FindFirst(s,AnyFile,dir);
|
|
if doserror=0 then
|
|
if doserror=0 then
|
|
begin
|
|
begin
|
|
-(* TH - check the directory attribute! *)
|
|
|
|
if Dir.Attr and Directory = 0 then
|
|
if Dir.Attr and Directory = 0 then
|
|
begin
|
|
begin
|
|
messagebox('A file with the name chosen as the installation '+
|
|
messagebox('A file with the name chosen as the installation '+
|
|
'directory exists already. Cannot create this directory!',nil,
|
|
'directory exists already. Cannot create this directory!',nil,
|
|
mferror+mfokbutton);
|
|
mferror+mfokbutton);
|
|
- createdir:=false;
|
|
|
|
|
|
+ createinstalldir:=false;
|
|
end else
|
|
end else
|
|
- createdir:=messagebox('The installation directory exists already. '+
|
|
|
|
- 'Do you want to enter a new installation directory ?',nil,
|
|
|
|
- mferror+mfyesbutton+mfnobutton)=cmNo;
|
|
|
|
|
|
+ createinstalldir:=messagebox('The installation directory exists already. '+
|
|
|
|
+ 'Do you want to continue ?',nil,
|
|
|
|
+ mferror+mfyesbutton+mfnobutton)=cmYes;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
- err:=false;
|
|
|
|
- {$I-}
|
|
|
|
- getdir(0,start);
|
|
|
|
-{$ifndef linux}
|
|
|
|
- if (s[2]=':') and (s[3]=DirSep) then
|
|
|
|
- begin
|
|
|
|
- chdir(Copy(s,1,3));
|
|
|
|
- Delete(S,1,3);
|
|
|
|
- end;
|
|
|
|
-{$endif}
|
|
|
|
- repeat
|
|
|
|
- i:=Pos(DirSep,s);
|
|
|
|
- if i=0 then
|
|
|
|
- i:=255;
|
|
|
|
- s1:=Copy(s,1,i-1);
|
|
|
|
- Delete(s,1,i);
|
|
|
|
- ChDir(s1);
|
|
|
|
- if ioresult<>0 then
|
|
|
|
- begin
|
|
|
|
- mkdir(s1);
|
|
|
|
- chdir(s1);
|
|
|
|
- if ioresult<>0 then
|
|
|
|
- begin
|
|
|
|
- err:=true;
|
|
|
|
- break;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
- until s='';
|
|
|
|
- chdir(start);
|
|
|
|
- {$I+}
|
|
|
|
|
|
+ err:=Createdir(s);
|
|
if err then
|
|
if err then
|
|
begin
|
|
begin
|
|
params[0]:=@s;
|
|
params[0]:=@s;
|
|
messagebox('The installation directory %s couldn''t be created',
|
|
messagebox('The installation directory %s couldn''t be created',
|
|
@params,mferror+mfokbutton);
|
|
@params,mferror+mfokbutton);
|
|
- createdir:=false;
|
|
|
|
|
|
+ createinstalldir:=false;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
{$ifndef TP}
|
|
{$ifndef TP}
|
|
@@ -319,9 +327,10 @@ program install;
|
|
FindClose (dir);
|
|
FindClose (dir);
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
{$endif}
|
|
{$endif}
|
|
- createdir:=true;
|
|
|
|
|
|
+ createinstalldir:=true;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
function GetProgDir: DirStr;
|
|
function GetProgDir: DirStr;
|
|
var
|
|
var
|
|
D: DirStr;
|
|
D: DirStr;
|
|
@@ -345,14 +354,23 @@ program install;
|
|
s : string;
|
|
s : string;
|
|
dir : searchrec;
|
|
dir : searchrec;
|
|
params : array[0..0] of pointer;
|
|
params : array[0..0] of pointer;
|
|
|
|
+ d : dirstr;
|
|
|
|
+ n : namestr;
|
|
|
|
+ e : extstr;
|
|
begin
|
|
begin
|
|
|
|
+ { already exists }
|
|
findfirst(fn,AnyFile,dir);
|
|
findfirst(fn,AnyFile,dir);
|
|
if doserror=0 then
|
|
if doserror=0 then
|
|
begin
|
|
begin
|
|
params[0]:=@fn;
|
|
params[0]:=@fn;
|
|
- MessageBox(#3'Default config not written.'#13#3'%s'#13#3'already exists',@params,mfinformation+mfokbutton);
|
|
|
|
- exit;
|
|
|
|
|
|
+ if MessageBox('Config %s already exists, continue writing default config?',@params,
|
|
|
|
+ mfinformation+mfyesbutton+mfnobutton)=cmNo then
|
|
|
|
+ exit;
|
|
end;
|
|
end;
|
|
|
|
+ { create directory }
|
|
|
|
+ fsplit(fn,d,n,e);
|
|
|
|
+ createdir(d);
|
|
|
|
+ { create the ppc386.cfg }
|
|
assign(t,fn);
|
|
assign(t,fn);
|
|
{$I-}
|
|
{$I-}
|
|
rewrite(t);
|
|
rewrite(t);
|
|
@@ -527,6 +545,9 @@ program install;
|
|
labpath : plabel;
|
|
labpath : plabel;
|
|
ilpath : pinputline;
|
|
ilpath : pinputline;
|
|
tab : ptab;
|
|
tab : ptab;
|
|
|
|
+ titletext : pcoloredtext;
|
|
|
|
+ labcfg : plabel;
|
|
|
|
+ cfgcb : pcheckboxes;
|
|
begin
|
|
begin
|
|
{ walk packages reverse and insert a newsitem for each, and set the mask }
|
|
{ walk packages reverse and insert a newsitem for each, and set the mask }
|
|
items:=nil;
|
|
items:=nil;
|
|
@@ -564,7 +585,7 @@ program install;
|
|
end;
|
|
end;
|
|
|
|
|
|
r.assign(x1,y1,x2,y2);
|
|
r.assign(x1,y1,x2,y2);
|
|
- inherited init(r,cfg.title+' Installation');
|
|
|
|
|
|
+ inherited init(r,'');
|
|
GetExtent(R);
|
|
GetExtent(R);
|
|
R.Grow(-2,-1);
|
|
R.Grow(-2,-1);
|
|
Dec(R.B.Y,2);
|
|
Dec(R.B.Y,2);
|
|
@@ -575,14 +596,28 @@ program install;
|
|
|
|
|
|
{-------- Sheet 1 ----------}
|
|
{-------- Sheet 1 ----------}
|
|
R.Copy(TabIR);
|
|
R.Copy(TabIR);
|
|
- r.b.x:=r.a.x+6;
|
|
|
|
|
|
+ r.move(0,1);
|
|
|
|
+ r.b.x:=r.a.x+40;
|
|
r.b.y:=r.a.y+1;
|
|
r.b.y:=r.a.y+1;
|
|
- new(labpath,init(r,'~P~ath',f));
|
|
|
|
|
|
+ new(titletext,init(r,cfg.title,$71));
|
|
|
|
|
|
|
|
+ r.move(0,2);
|
|
|
|
+ r.b.x:=r.a.x+40;
|
|
|
|
+ new(labpath,init(r,'~B~ase path',f));
|
|
r.move(0,1);
|
|
r.move(0,1);
|
|
r.b.x:=r.a.x+40;
|
|
r.b.x:=r.a.x+40;
|
|
|
|
+ r.b.y:=r.a.y+1;
|
|
new(ilpath,init(r,high(DirStr)));
|
|
new(ilpath,init(r,high(DirStr)));
|
|
|
|
|
|
|
|
+ r.move(0,2);
|
|
|
|
+ r.b.x:=r.a.x+40;
|
|
|
|
+ new(labcfg,init(r,'Con~f~ig',f));
|
|
|
|
+ r.move(0,1);
|
|
|
|
+ r.b.x:=r.a.x+40;
|
|
|
|
+ r.b.y:=r.a.y+1;
|
|
|
|
+ new(cfgcb,init(r,newsitem('create ppc386.cfg',nil)));
|
|
|
|
+ data.cfgval:=1;
|
|
|
|
+
|
|
{-------- Sheet 2 ----------}
|
|
{-------- Sheet 2 ----------}
|
|
R.Copy(TabIR);
|
|
R.Copy(TabIR);
|
|
new(packcbs,init(r,items));
|
|
new(packcbs,init(r,items));
|
|
@@ -598,9 +633,12 @@ program install;
|
|
{--------- Main ---------}
|
|
{--------- Main ---------}
|
|
New(Tab, Init(TabR,
|
|
New(Tab, Init(TabR,
|
|
NewTabDef('~G~eneral',IlPath,
|
|
NewTabDef('~G~eneral',IlPath,
|
|
|
|
+ NewTabItem(TitleText,
|
|
NewTabItem(LabPath,
|
|
NewTabItem(LabPath,
|
|
NewTabItem(ILPath,
|
|
NewTabItem(ILPath,
|
|
- nil)),
|
|
|
|
|
|
+ NewTabItem(LabCfg,
|
|
|
|
+ NewTabItem(CfgCB,
|
|
|
|
+ nil))))),
|
|
NewTabDef('~P~ackages',PackCbs,
|
|
NewTabDef('~P~ackages',PackCbs,
|
|
NewTabItem(PackCbs,
|
|
NewTabItem(PackCbs,
|
|
nil),
|
|
nil),
|
|
@@ -646,6 +684,7 @@ program install;
|
|
{$endif}
|
|
{$endif}
|
|
begin
|
|
begin
|
|
data.basepath:=cfg.basepath;
|
|
data.basepath:=cfg.basepath;
|
|
|
|
+ data.cfgval:=0;
|
|
data.srcmask:=0;
|
|
data.srcmask:=0;
|
|
data.packmask:=0;
|
|
data.packmask:=0;
|
|
|
|
|
|
@@ -656,51 +695,55 @@ program install;
|
|
if (c=cmok) then
|
|
if (c=cmok) then
|
|
begin
|
|
begin
|
|
if Data.BasePath = '' then
|
|
if Data.BasePath = '' then
|
|
- messagebox('Please, choose the directory for installation first.',nil,
|
|
|
|
- mferror+mfokbutton) else
|
|
|
|
|
|
+ messagebox('Please, choose the directory for installation first.',nil,mferror+mfokbutton)
|
|
|
|
+ else
|
|
begin
|
|
begin
|
|
- if (data.srcmask>0) or (data.packmask>0) then
|
|
|
|
- begin
|
|
|
|
-(* TH - check the available disk space here *)
|
|
|
|
|
|
+ if (data.srcmask>0) or (data.packmask>0) then
|
|
|
|
+ begin
|
|
{$IFNDEF LINUX}
|
|
{$IFNDEF LINUX}
|
|
- DSize := 0;
|
|
|
|
- for i:=1 to cfg.packages do
|
|
|
|
- begin
|
|
|
|
- if data.packmask and packagemask(i)<>0 then
|
|
|
|
- Inc (DSize, DiskSpaceN(cfg.package[i].zip));
|
|
|
|
- end;
|
|
|
|
- for i:=1 to cfg.sources do
|
|
|
|
- begin
|
|
|
|
- if data.srcmask and packagemask(i)<>0 then
|
|
|
|
- Inc (DSize, DiskSpaceN(cfg.source[i].zip));
|
|
|
|
- end;
|
|
|
|
- if data.mask and packagemask(i)<>0 then
|
|
|
|
- Inc (DSize, DiskSpaceN(cfg.package[i].zip));
|
|
|
|
- end;
|
|
|
|
- S := FExpand (Data.BasePath);
|
|
|
|
- if S [Length (S)] = DirSep then Dec (S [0]);
|
|
|
|
- Space := DiskFree (byte (S [1]) - 64) shr 10;
|
|
|
|
- if Space < DSize then S := 'is not' else S := '';
|
|
|
|
- if Space < DSize + 500 then
|
|
|
|
- begin
|
|
|
|
- if S = '' then S := 'might not be';
|
|
|
|
- if messagebox('There ' + S + ' enough space on the target ' +
|
|
|
|
- 'drive for all the selected components. Do you ' +
|
|
|
|
- 'want to change the installation path?',nil,
|
|
|
|
- mferror+mfyesbutton+mfnobutton) = cmYes then Continue;
|
|
|
|
- end;
|
|
|
|
|
|
+ { TH - check the available disk space here }
|
|
|
|
+ DSize := 0;
|
|
|
|
+ for i:=1 to cfg.packages do
|
|
|
|
+ begin
|
|
|
|
+ if data.packmask and packagemask(i)<>0 then
|
|
|
|
+ Inc (DSize, DiskSpaceN(cfg.package[i].zip));
|
|
|
|
+ end;
|
|
|
|
+ for i:=1 to cfg.sources do
|
|
|
|
+ begin
|
|
|
|
+ if data.srcmask and packagemask(i)<>0 then
|
|
|
|
+ Inc (DSize, DiskSpaceN(cfg.source[i].zip));
|
|
|
|
+ end;
|
|
|
|
+ if data.packmask and packagemask(i)<>0 then
|
|
|
|
+ Inc (DSize, DiskSpaceN(cfg.package[i].zip));
|
|
|
|
+ S := FExpand (Data.BasePath);
|
|
|
|
+ if S [Length (S)] = DirSep then
|
|
|
|
+ Dec (S [0]);
|
|
|
|
+ Space := DiskFree (byte (S [1]) - 64) shr 10;
|
|
|
|
+ if Space < DSize then
|
|
|
|
+ S := 'is not'
|
|
|
|
+ else
|
|
|
|
+ S := '';
|
|
|
|
+ if Space < DSize + 500 then
|
|
|
|
+ begin
|
|
|
|
+ if S = '' then
|
|
|
|
+ S := 'might not be';
|
|
|
|
+ if messagebox('There ' + S + ' enough space on the target ' +
|
|
|
|
+ 'drive for all the selected components. Do you ' +
|
|
|
|
+ 'want to change the installation path?',nil,
|
|
|
|
+ mferror+mfyesbutton+mfnobutton) = cmYes then
|
|
|
|
+ Continue;
|
|
|
|
+ end;
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
- if createdir(data.basepath) then
|
|
|
|
- break;
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- result:=messagebox('No components selected.'#13#13'Abort installation?',nil,
|
|
|
|
- mferror+mfyesbutton+mfnobutton);
|
|
|
|
- if result=cmYes then
|
|
|
|
- exit;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
|
|
+ if createinstalldir(data.basepath) then
|
|
|
|
+ break;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ result:=messagebox('No components selected.'#13#13'Abort installation?',nil,mferror+mfyesbutton+mfnobutton);
|
|
|
|
+ if result=cmYes then
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
exit;
|
|
exit;
|
|
@@ -731,7 +774,8 @@ program install;
|
|
dispose(p2,done);
|
|
dispose(p2,done);
|
|
|
|
|
|
{ write config }
|
|
{ write config }
|
|
- writedefcfg(data.basepath+cfg.binsub+DirSep+cfg.defcfgfile);
|
|
|
|
|
|
+ if (data.cfgval and 1)<>0 then
|
|
|
|
+ writedefcfg(data.basepath+cfg.binsub+DirSep+cfg.defcfgfile);
|
|
|
|
|
|
{ show end message }
|
|
{ show end message }
|
|
p3:=new(penddialog,init);
|
|
p3:=new(penddialog,init);
|
|
@@ -869,7 +913,7 @@ program install;
|
|
getextent(r);
|
|
getextent(r);
|
|
r.b.y:=r.a.y+1;
|
|
r.b.y:=r.a.y+1;
|
|
menubar:=new(pmenubar,init(r,newmenu(
|
|
menubar:=new(pmenubar,init(r,newmenu(
|
|
- newsubmenu('~F~ree Pascal '+cfg.version,hcnocontext,newmenu(nil
|
|
|
|
|
|
+ newsubmenu('~F~ree Pascal Installer '+installerversion,hcnocontext,newmenu(nil
|
|
),
|
|
),
|
|
nil))));
|
|
nil))));
|
|
end;
|
|
end;
|
|
@@ -1000,7 +1044,12 @@ begin
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.7 1999-07-01 07:56:58 hajny
|
|
|
|
|
|
+ Revision 1.8 1999-07-17 14:24:47 peter
|
|
|
|
+ * updates for new installer
|
|
|
|
+ + checkbox if ppc386.cfg needs to be written, also createdir() is used
|
|
|
|
+ for ppc386.cfg creation
|
|
|
|
+
|
|
|
|
+ Revision 1.7 1999/07/01 07:56:58 hajny
|
|
* installation to root fixed
|
|
* installation to root fixed
|
|
|
|
|
|
Revision 1.6 1999/06/29 22:20:19 peter
|
|
Revision 1.6 1999/06/29 22:20:19 peter
|