mirror of https://gitlab.com/basile.b/dexed.git
setup, refact using array of Resource, + fix zip script + update ver
This commit is contained in:
parent
6ef2178d3e
commit
a5fc2d59d1
|
@ -7,9 +7,9 @@ object CurrentProject: TCENativeProject
|
||||||
outputOptions.boundsCheck = offAlways
|
outputOptions.boundsCheck = offAlways
|
||||||
outputOptions.optimizations = True
|
outputOptions.optimizations = True
|
||||||
outputOptions.release = True
|
outputOptions.release = True
|
||||||
pathsOptions.outputFilename = 'output\coedit.2alpha1.win32.setup.exe'
|
pathsOptions.outputFilename = 'output/coedit.2alpha2.win32.setup'
|
||||||
pathsOptions.importStringPaths.Strings = (
|
pathsOptions.importStringPaths.Strings = (
|
||||||
'win32\'
|
'win32/'
|
||||||
)
|
)
|
||||||
preBuildProcess.executable = 'cmd'
|
preBuildProcess.executable = 'cmd'
|
||||||
preBuildProcess.workingDirectory = '<CPP>'
|
preBuildProcess.workingDirectory = '<CPP>'
|
||||||
|
@ -29,16 +29,17 @@ object CurrentProject: TCENativeProject
|
||||||
outputOptions.boundsCheck = offAlways
|
outputOptions.boundsCheck = offAlways
|
||||||
outputOptions.optimizations = True
|
outputOptions.optimizations = True
|
||||||
outputOptions.release = True
|
outputOptions.release = True
|
||||||
pathsOptions.outputFilename = 'output\coedit.2alpha1.linux32.setup'
|
pathsOptions.outputFilename = 'output/coedit.2alpha2.linux32.setup'
|
||||||
pathsOptions.importStringPaths.Strings = (
|
pathsOptions.importStringPaths.Strings = (
|
||||||
'nux32\'
|
'nux32/'
|
||||||
)
|
)
|
||||||
preBuildProcess.executable = 'sh'
|
preBuildProcess.executable = 'sh'
|
||||||
preBuildProcess.workingDirectory = '<CPP>'
|
preBuildProcess.options = [poUsePipes, poStderrToOutPut]
|
||||||
preBuildProcess.parameters.Strings = (
|
preBuildProcess.parameters.Strings = (
|
||||||
'zip-nux32.sh'
|
'zip-nux32.sh'
|
||||||
)
|
)
|
||||||
postBuildProcess.executable = 'sh'
|
postBuildProcess.executable = 'sh'
|
||||||
|
postBuildProcess.options = [poUsePipes, poStderrToOutPut]
|
||||||
postBuildProcess.parameters.Strings = (
|
postBuildProcess.parameters.Strings = (
|
||||||
'setupzip-nux-noarch.sh'
|
'setupzip-nux-noarch.sh'
|
||||||
'<CPO>'
|
'<CPO>'
|
||||||
|
@ -50,16 +51,17 @@ object CurrentProject: TCENativeProject
|
||||||
outputOptions.boundsCheck = offAlways
|
outputOptions.boundsCheck = offAlways
|
||||||
outputOptions.optimizations = True
|
outputOptions.optimizations = True
|
||||||
outputOptions.release = True
|
outputOptions.release = True
|
||||||
pathsOptions.outputFilename = 'output\coedit.2alpha1.linux64.setup'
|
pathsOptions.outputFilename = 'output/coedit.2alpha2.linux64.setup'
|
||||||
pathsOptions.importStringPaths.Strings = (
|
pathsOptions.importStringPaths.Strings = (
|
||||||
'nux64\'
|
'nux64/'
|
||||||
)
|
)
|
||||||
preBuildProcess.executable = 'sh'
|
preBuildProcess.executable = 'sh'
|
||||||
preBuildProcess.workingDirectory = '<CPP>'
|
preBuildProcess.options = [poUsePipes, poStderrToOutPut]
|
||||||
preBuildProcess.parameters.Strings = (
|
preBuildProcess.parameters.Strings = (
|
||||||
'zip-nux64.sh'
|
'zip-nux64.sh'
|
||||||
)
|
)
|
||||||
postBuildProcess.executable = 'sh'
|
postBuildProcess.executable = 'sh'
|
||||||
|
postBuildProcess.options = [poUsePipes, poStderrToOutPut]
|
||||||
postBuildProcess.parameters.Strings = (
|
postBuildProcess.parameters.Strings = (
|
||||||
'setupzip-nux-noarch.sh'
|
'setupzip-nux-noarch.sh'
|
||||||
'<CPO>'
|
'<CPO>'
|
||||||
|
@ -72,13 +74,13 @@ object CurrentProject: TCENativeProject
|
||||||
outputOptions.boundsCheck = offAlways
|
outputOptions.boundsCheck = offAlways
|
||||||
outputOptions.optimizations = True
|
outputOptions.optimizations = True
|
||||||
outputOptions.release = True
|
outputOptions.release = True
|
||||||
pathsOptions.outputFilename = 'output\coedit.2alpha1.win32.setup.exe'
|
pathsOptions.outputFilename = 'output/coedit.2alpha2.win32.setup'
|
||||||
pathsOptions.importStringPaths.Strings = (
|
pathsOptions.importStringPaths.Strings = (
|
||||||
'win32\'
|
'win32/'
|
||||||
)
|
)
|
||||||
end>
|
end>
|
||||||
Sources.Strings = (
|
Sources.Strings = (
|
||||||
'cesetup.d'
|
'cesetup.d'
|
||||||
)
|
)
|
||||||
ConfigurationIndex = 0
|
ConfigurationIndex = 2
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,18 +25,22 @@ struct Resource
|
||||||
immutable bool isExe;
|
immutable bool isExe;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResType coedit = Resource(cast(ImpType) import("coedit" ~ exeExt), "coedit" ~ exeExt, true);
|
Resource[] ceResources =
|
||||||
ResType cesyms = Resource(cast(ImpType) import("cesyms" ~ exeExt), "cesyms" ~ exeExt, true);
|
[
|
||||||
ResType cetodo = Resource(cast(ImpType) import("cetodo" ~ exeExt), "cetodo" ~ exeExt, true);
|
Resource(cast(ImpType) import("coedit" ~ exeExt), "coedit" ~ exeExt, true),
|
||||||
|
Resource(cast(ImpType) import("cesyms" ~ exeExt), "cesyms" ~ exeExt, true),
|
||||||
|
Resource(cast(ImpType) import("cetodo" ~ exeExt), "cetodo" ~ exeExt, true),
|
||||||
|
Resource(cast(ImpType) import("coedit.ico"), "coedit.ico", false),
|
||||||
|
Resource(cast(ImpType) import("coedit.png"), "coedit.png", false),
|
||||||
|
Resource(cast(ImpType) import("coedit.license.txt"), "coedit.license.txt", false)
|
||||||
|
];
|
||||||
|
|
||||||
ResType dcd_server = Resource(cast(ImpType) import("dcd-server" ~ exeExt), "dcd-server" ~ exeExt, true);
|
Resource[] dcdResources =
|
||||||
ResType dcd_client = Resource(cast(ImpType) import("dcd-client" ~ exeExt), "dcd-client" ~ exeExt, true);
|
[
|
||||||
|
Resource(cast(ImpType) import("dcd-server" ~ exeExt), "dcd-server" ~ exeExt, true),
|
||||||
ResType icon = Resource(cast(ImpType) import("coedit.ico"), "coedit.ico", false);
|
Resource(cast(ImpType) import("dcd-client" ~ exeExt), "dcd-client" ~ exeExt, true),
|
||||||
ResType png = Resource(cast(ImpType) import("coedit.png"), "coedit.png", false);
|
Resource(cast(ImpType) import("dcd.license.txt"), "dcd.license.txt", false)
|
||||||
|
];
|
||||||
ResType celic = Resource(cast(ImpType) import("coedit.license.txt"), "coedit.license.txt", false);
|
|
||||||
ResType dcdlic = Resource(cast(ImpType) import("dcd.license.txt"), "dcd.license.txt", false);
|
|
||||||
|
|
||||||
|
|
||||||
static struct Formater
|
static struct Formater
|
||||||
|
@ -52,9 +56,13 @@ static struct Formater
|
||||||
separator[$-1] = '+';
|
separator[$-1] = '+';
|
||||||
}
|
}
|
||||||
|
|
||||||
static void justify(char A, string s)()
|
static void justify(char A)(string s)
|
||||||
|
in
|
||||||
|
{
|
||||||
|
assert (s.length <= width, "too long to fit on a line...");
|
||||||
|
}
|
||||||
|
body
|
||||||
{
|
{
|
||||||
static assert (s.length <= width, "too long to fit on a line...");
|
|
||||||
static if (A == 'L')
|
static if (A == 'L')
|
||||||
writeln("| ", leftJustify(s, width, ' '), " |");
|
writeln("| ", leftJustify(s, width, ' '), " |");
|
||||||
else static if (A == 'C')
|
else static if (A == 'C')
|
||||||
|
@ -66,12 +74,13 @@ static struct Formater
|
||||||
|
|
||||||
static void separate(){separator.writeln;}
|
static void separate(){separator.writeln;}
|
||||||
|
|
||||||
static void emptyLine(){justify!('L', "");}
|
static void emptyLine(){justify!'L'("");}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static immutable string exePath, appDataPath, shortCutPath;
|
static immutable string exePath, appDataPath, shortCutPath;
|
||||||
version(win32){} else immutable bool asSu;
|
version(linux) immutable bool asSu;
|
||||||
|
|
||||||
|
|
||||||
static this()
|
static this()
|
||||||
{
|
{
|
||||||
|
@ -103,102 +112,138 @@ void main(string[] args)
|
||||||
{
|
{
|
||||||
bool nodcd;
|
bool nodcd;
|
||||||
bool uninstall;
|
bool uninstall;
|
||||||
|
bool listfiles;
|
||||||
|
|
||||||
getopt(args, config.passThrough,
|
getopt(args, config.passThrough,
|
||||||
"nodcd", &nodcd,
|
"nodcd", &nodcd,
|
||||||
"u|uninstall", &uninstall
|
"u|uninstall", &uninstall,
|
||||||
|
"l|list", &listfiles
|
||||||
);
|
);
|
||||||
|
|
||||||
Formater.separate;
|
Formater.separate;
|
||||||
if (!uninstall) Formater.justify!('C', "Coedit 2 alpha 1 - setup");
|
|
||||||
else Formater.justify!('C', "Coedit uninstaller");
|
|
||||||
|
if (listfiles)
|
||||||
|
{
|
||||||
|
static immutable fmtRes = "%s installed: %s";
|
||||||
|
string fname;
|
||||||
|
|
||||||
Formater.separate;
|
Formater.separate;
|
||||||
version(win32) Formater.justify!('L', "the setup program must be run as admin");
|
Formater.justify!'C'("files list and status");
|
||||||
|
Formater.separate;
|
||||||
|
|
||||||
|
foreach(res; ceResources)
|
||||||
|
{
|
||||||
|
fname = res.isExe ? exePath ~ res.destName : appDataPath ~ res.destName;
|
||||||
|
writefln(fmtRes, fname, exists(fname));
|
||||||
|
}
|
||||||
|
foreach(res; dcdResources)
|
||||||
|
{
|
||||||
|
fname = res.isExe ? exePath ~ res.destName : appDataPath ~ res.destName;
|
||||||
|
writefln(fmtRes, fname, exists(fname));
|
||||||
|
}
|
||||||
|
|
||||||
|
Formater.separate;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!uninstall) Formater.justify!'C'("Coedit 2 alpha 2 - setup");
|
||||||
|
else Formater.justify!'C'("Coedit uninstaller");
|
||||||
|
|
||||||
|
Formater.separate;
|
||||||
|
version(win32) Formater.justify!'L'("the setup program must be run as admin");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!asSu) Formater.justify!('L', "Coedit can also be setup globally (sudo)");
|
if(!asSu) Formater.justify!'L'("Coedit can also be setup globally (sudo)");
|
||||||
else Formater.justify!('L', "Coedit will be accessible from all the accounts");
|
else Formater.justify!'L'("Coedit will be accessible from all the accounts");
|
||||||
}
|
}
|
||||||
|
|
||||||
Formater.separate;
|
Formater.separate;
|
||||||
Formater.justify!('L', "options:");
|
Formater.justify!'L'("options:");
|
||||||
Formater.emptyLine;
|
Formater.emptyLine;
|
||||||
|
Formater.justify!'L'("-l | --list: list files and status");
|
||||||
if (!uninstall)
|
if (!uninstall)
|
||||||
{
|
{
|
||||||
if (!nodcd) Formater.justify!('L', "--nodcd: skip DCD setup");
|
if (!nodcd) Formater.justify!'L'("--nodcd: skip DCD setup");
|
||||||
Formater.justify!('L', "-u: uninstall");
|
Formater.justify!'L'("-u | --uninstall: uninstall");
|
||||||
}
|
}
|
||||||
else if (!nodcd) Formater.justify!('L', "--nodcd: do not remove DCD");
|
else if (!nodcd) Formater.justify!'L'("--nodcd: do not remove DCD");
|
||||||
Formater.justify!('L', "press A to abort or another key to start...");
|
Formater.justify!'L'("press A to abort or another key to start...");
|
||||||
Formater.separate;
|
Formater.separate;
|
||||||
|
|
||||||
const string inp = readln.strip;
|
const string inp = readln.strip;
|
||||||
if (inp.toLower == "a") return;
|
if (inp.toLower == "a") return;
|
||||||
|
|
||||||
Formater.separate;
|
Formater.separate;
|
||||||
|
|
||||||
size_t failures;
|
size_t failures;
|
||||||
|
bool done;
|
||||||
if(!uninstall)
|
if(!uninstall)
|
||||||
{
|
{
|
||||||
if (installResource(coedit, exePath))
|
static immutable extractMsg = [": FAILURE", ": extracted"];
|
||||||
Formater.justify!('L', "Coedit main application extracted");
|
foreach(res; ceResources)
|
||||||
else failures++;
|
|
||||||
if (installResource(cesyms, exePath))
|
|
||||||
Formater.justify!('L', "Coedit symbol list builder extracted");
|
|
||||||
else failures++;
|
|
||||||
if (installResource(cetodo, exePath))
|
|
||||||
Formater.justify!('L', "Coedit todo comment parser extracted");
|
|
||||||
else failures++;
|
|
||||||
if (installResource(celic, appDataPath))
|
|
||||||
Formater.justify!('L', "Coedit license file extracted");
|
|
||||||
else failures++;
|
|
||||||
if (installResource(icon, appDataPath))
|
|
||||||
Formater.justify!('L', "Coedit icon file extracted");
|
|
||||||
else failures++;
|
|
||||||
if (installResource(png, appDataPath))
|
|
||||||
Formater.justify!('L', "Coedit big png logo extracted");
|
|
||||||
else failures++;
|
|
||||||
|
|
||||||
if (!nodcd)
|
|
||||||
{
|
{
|
||||||
if (installResource(dcd_server, exePath))
|
if (res.isExe)
|
||||||
Formater.justify!('L', "Completion daemon server extracted");
|
done = installResource(res, exePath);
|
||||||
else failures++;
|
else
|
||||||
if (installResource(dcd_client, exePath))
|
done = installResource(res, appDataPath);
|
||||||
Formater.justify!('L', "Completion daemon client extracted");
|
Formater.justify!'L'(res.destName ~ extractMsg[done]);
|
||||||
else failures++;
|
failures += !done;
|
||||||
if (installResource(dcdlic, appDataPath))
|
}
|
||||||
Formater.justify!('L', "Completion daemon license extracted");
|
if (!nodcd) foreach(res; dcdResources)
|
||||||
else failures++;
|
{
|
||||||
|
if (res.isExe)
|
||||||
|
done = installResource(res, exePath);
|
||||||
|
else
|
||||||
|
done = installResource(res, appDataPath);
|
||||||
|
Formater.justify!'L'(res.destName ~ extractMsg[done]);
|
||||||
|
failures += !done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Formater.separate;
|
Formater.separate;
|
||||||
if (failures)
|
if (failures)
|
||||||
Formater.justify!('L', "there are ERRORS, plz contact the support");
|
Formater.justify!'L'("there are ERRORS, plz contact the support");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
version(win32) win32PostInstall();
|
version(win32) win32PostInstall();
|
||||||
else nuxPostInstall();
|
else nuxPostInstall();
|
||||||
Formater.justify!('L', "the files are correctly extracted...");
|
Formater.justify!'L'("the files are correctly extracted...");
|
||||||
}
|
}
|
||||||
Formater.emptyLine;
|
|
||||||
Formater.justify!('R', "...press a key to exit");
|
|
||||||
Formater.separate;
|
|
||||||
readln;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
failures += !uninstallResource(coedit, exePath);
|
if (!asSu && exists("/usr/bin/coedit"))
|
||||||
failures += !uninstallResource(cesyms, exePath);
|
|
||||||
failures += !uninstallResource(cetodo, exePath);
|
|
||||||
failures += !uninstallResource(celic, appDataPath);
|
|
||||||
failures += !uninstallResource(icon, appDataPath);
|
|
||||||
failures += !uninstallResource(png, appDataPath);
|
|
||||||
if (!nodcd)
|
|
||||||
{
|
{
|
||||||
failures += !uninstallResource(dcd_client, exePath);
|
Formater.separate;
|
||||||
failures += !uninstallResource(dcd_server, exePath);
|
Formater.justify!'L'("warning, CE seems to be installed with sudo");
|
||||||
failures += !uninstallResource(dcdlic, appDataPath);
|
Formater.justify!'L'("but the uninstaller is not launched with sudo.");
|
||||||
|
Formater.separate;
|
||||||
|
}
|
||||||
|
else if (asSu && exists("/home/" ~ environment.get("USER") ~ "/bin/coedit"))
|
||||||
|
{
|
||||||
|
Formater.separate;
|
||||||
|
Formater.justify!'L'("warning, CE seems not to be installed with sudo");
|
||||||
|
Formater.justify!'L'("...but the uninstaller is launched with sudo.");
|
||||||
|
Formater.separate;
|
||||||
|
}
|
||||||
|
static immutable rmMsg = [": FAILURE", ": deleted"];
|
||||||
|
foreach(res; ceResources)
|
||||||
|
{
|
||||||
|
if (res.isExe)
|
||||||
|
done = uninstallResource(res, exePath);
|
||||||
|
else
|
||||||
|
done = uninstallResource(res, appDataPath);
|
||||||
|
Formater.justify!'L'(res.destName ~ rmMsg[done]);
|
||||||
|
failures += !done;
|
||||||
|
}
|
||||||
|
if (!nodcd) foreach(res; dcdResources)
|
||||||
|
{
|
||||||
|
if (res.isExe)
|
||||||
|
done = uninstallResource(res, exePath);
|
||||||
|
else
|
||||||
|
done = uninstallResource(res, appDataPath);
|
||||||
|
Formater.justify!'L'(res.destName ~ rmMsg[done]);
|
||||||
|
failures += !done;
|
||||||
}
|
}
|
||||||
|
|
||||||
version(win32)
|
version(win32)
|
||||||
|
@ -207,19 +252,20 @@ void main(string[] args)
|
||||||
catch(FileException e) failures++;
|
catch(FileException e) failures++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Formater.separate;
|
||||||
if (failures)
|
if (failures)
|
||||||
Formater.justify!('L', "there are ERRORS, plz contact the support");
|
Formater.justify!'L'("there are ERRORS, plz contact the support");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
version(win32) win32PostUninstall();
|
version(win32) win32PostUninstall();
|
||||||
else nuxPostUninstall();
|
else nuxPostUninstall();
|
||||||
Formater.justify!('L', "the files are correctly removed...");
|
Formater.justify!'L'("the files are correctly removed...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Formater.emptyLine;
|
Formater.emptyLine;
|
||||||
Formater.justify!('R', "...press a key to exit");
|
Formater.justify!'R'("...press a key to exit");
|
||||||
Formater.separate;
|
Formater.separate;
|
||||||
readln;
|
readln;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string extractedName(Resource resource, string path)
|
string extractedName(Resource resource, string path)
|
||||||
|
@ -290,7 +336,7 @@ version (win32) void win32PostInstall()
|
||||||
import std.conv: to;
|
import std.conv: to;
|
||||||
import std.random: uniform;
|
import std.random: uniform;
|
||||||
|
|
||||||
// shortcut prior to v 1 upd 2 was actually and url.
|
// shortcut prior to v 1 upd 2 was actually an url.
|
||||||
tryRemove(shortCutPath ~ "Coedit.url");
|
tryRemove(shortCutPath ~ "Coedit.url");
|
||||||
|
|
||||||
string target = exePath ~ "coedit.exe";
|
string target = exePath ~ "coedit.exe";
|
||||||
|
@ -315,7 +361,7 @@ version (win32) void win32PostInstall()
|
||||||
|
|
||||||
version (win32) void win32PostUninstall()
|
version (win32) void win32PostUninstall()
|
||||||
{
|
{
|
||||||
// shortcut prior to v 1 upd 2 was actually and url.
|
// shortcut prior to v 1 upd 2 was actually an url.
|
||||||
tryRemove(shortCutPath ~ "Coedit.url");
|
tryRemove(shortCutPath ~ "Coedit.url");
|
||||||
tryRemove(shortCutPath ~ "Coedit.lnk");
|
tryRemove(shortCutPath ~ "Coedit.lnk");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
cd output
|
cd output
|
||||||
zip -9 -j $1.zip $1
|
zip -9 -j $1.zip $1
|
||||||
rm -f $1
|
wait
|
||||||
rm -f $1.o
|
ofile=`basename $1 .setup`
|
||||||
|
rm -f $ofile.o
|
Loading…
Reference in New Issue