-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.pas
87 lines (69 loc) · 1.78 KB
/
main.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
unit Main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TMainFRM }
TMainFRM = class(TForm)
ActivateDeactivateBTN: TButton;
CloseBTN: TButton;
ExplainMMO: TMemo;
procedure ActivateDeactivateBTNClick(Sender: TObject);
procedure CloseBTNClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
_Activate: boolean;
public
end;
var
MainFRM: TMainFRM;
implementation
{$R *.frm}
const
FORCEFSCKFILE = '/forcefsck';
{ TMainFRM }
procedure TMainFRM.CloseBTNClick(Sender: TObject);
begin
Close;
end;
procedure TMainFRM.FormCreate(Sender: TObject);
begin
if FileExists(FORCEFSCKFILE) then
begin
_Activate:= true;
ActivateDeactivateBTN.Caption:= 'Deactivate';
ExplainMMO.Lines.Clear;
ExplainMMO.Lines.Add('If you click on Deactivate button');
ExplainMMO.Lines.Add('you remove /forcefsck file and');
ExplainMMO.Lines.Add('indicate to the system that it doesn''t');
ExplainMMO.Lines.Add('check devices/partion on next boot !');
end
else
begin
_Activate:= false;
ActivateDeactivateBTN.Caption:= 'Activate';
ExplainMMO.Lines.Clear;
ExplainMMO.Lines.Add('If you click on Activate button');
ExplainMMO.Lines.Add('you configure /forcefsck file to');
ExplainMMO.Lines.Add('indicate to the system to check');
ExplainMMO.Lines.Add('devices/partion on next boot !');
end;
end;
procedure TMainFRM.ActivateDeactivateBTNClick(Sender: TObject);
var
_File: TextFile;
begin
if not _Activate then
begin
AssignFile(_File, FORCEFSCKFILE);
CloseFile(_File);
ActivateDeactivateBTN.Caption:= 'Deactivate';
end
else
begin
DeleteFile(FORCEFSCKFILE);
ActivateDeactivateBTN.Caption:= 'Activate';
end;
end;
end.