add installer

This commit is contained in:
Andrei Yankovich 2019-05-15 14:56:38 +03:00
parent 9f5bf7ea9e
commit 5ad8f19a43
22 changed files with 544 additions and 1 deletions

4
.gitignore vendored
View File

@ -21,6 +21,7 @@ object_script.*.Debug
*.qbs.user *.qbs.user
*.qbs.user.* *.qbs.user.*
*.moc *.moc
*.qm
moc_*.cpp moc_*.cpp
moc_*.h moc_*.h
qrc_*.cpp qrc_*.cpp
@ -58,6 +59,9 @@ sharedQtWin32/
sharedQtWin64/ sharedQtWin64/
distro/ distro/
Distro/
deployTests/
installer/packages/cqtdeployer/data/
staticQt/ staticQt/
staticQtWin32/ staticQtWin32/

View File

@ -32,6 +32,8 @@ QuasarAppLib.file = $$PWD/QuasarAppLib/QuasarApp.pro
Pe.file = $$PWD/pe/pe-parser-library/pe-parser-library.pro Pe.file = $$PWD/pe/pe-parser-library/pe-parser-library.pro
win32:include('$$PWD/CQtDeployerWinBuild.pri') win32:include('$$PWD/CQtDeployerWinBuild.pri')
include('$$PWD/installer/installer.pri')
include($$PWD/test.pri)
DISTFILES += \ DISTFILES += \
snapBuild.sh \ snapBuild.sh \

@ -1 +1 @@
Subproject commit a984e8d6d0387d32cbbc39483a68aa8cc64f0302 Subproject commit 9556d4d100bc79f9851ee9e8553fb2c73cc6cc3e

BIN
installer/config/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<WizardDefaultWidth>640px</WizardDefaultWidth>
<WizardDefaultHeight>400px</WizardDefaultHeight>
<Name>CQtDeployer</Name>
<Version>1.2.1</Version>
<Title>CQtDeployer</Title>
<Publisher>QuasarApp</Publisher>
<StartMenuDir>CQtDeployer</StartMenuDir>
<TargetDir>@HomeDir@/CQtDeployer</TargetDir>
<InstallActionColumnVisible>true</InstallActionColumnVisible>
<RemoveTargetDir>true</RemoveTargetDir>
<ControlScript>controlScript.js</ControlScript>
<MaintenanceToolName>CQtDeployerTool</MaintenanceToolName>
<WizardStyle>Classic</WizardStyle>
<StyleSheet>style.css</StyleSheet>
<Banner>banner.png</Banner>
<Logo>logo.png</Logo>
<RemoteRepositories>
<Repository>
<Url>http://178.124.160.6:3030/CQtDeployer/Linux</Url>
<Enabled>1</Enabled>
<DisplayName>QuasarApp</DisplayName>
</Repository>
</RemoteRepositories>
</Installer>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<WizardDefaultWidth>640px</WizardDefaultWidth>
<WizardDefaultHeight>400px</WizardDefaultHeight>
<Name>CQtDeployer</Name>
<Version>1.2.1</Version>
<Title>CQtDeployer</Title>
<Publisher>QuasarApp</Publisher>
<StartMenuDir>CQtDeployer</StartMenuDir>
<TargetDir>@HomeDir@/CQtDeployer</TargetDir>
<InstallActionColumnVisible>true</InstallActionColumnVisible>
<RemoveTargetDir>true</RemoveTargetDir>
<ControlScript>controlScript.js</ControlScript>
<MaintenanceToolName>CQtDeployerTool</MaintenanceToolName>
<WizardStyle>Classic</WizardStyle>
<StyleSheet>style.css</StyleSheet>
<Banner>banner.png</Banner>
<Logo>logo.png</Logo>
<RemoteRepositories>
<Repository>
<Url>http://178.124.160.6:3030/CQtDeployer/Windows</Url>
<Enabled>1</Enabled>
<DisplayName>QuasarApp</DisplayName>
</Repository>
</RemoteRepositories>
</Installer>

View File

@ -0,0 +1,73 @@
function Controller()
{
generateTr();
installer.setMessageBoxAutomaticAnswer("OverwriteTargetDirectory", QMessageBox.Yes);
installer.uninstallationFinished.connect(this, Controller.prototype.uninstallationFinished);
installer.installationFinished.connect(this, Controller.prototype.installationFinished);
}
function generateTr() {
console.log("generate tr start ")
installer.setValue("Name", qsTr("CQtDeployer"));
installer.setValue("Title", qsTr("Install CQtDeployer"));
}
Controller.prototype.uninstallationFinished = function()
{
console.log("hometDir " + homeDir)
if (systemInfo.kernelType === "winnt") {
if (!installer.gainAdminRights()) {
QMessageBox["warning"](qsTr("install in system"), qsTr("Installer"),
qsTr("To uninstall cqtdeployer on your system, you need administrator rights!. "), QMessageBox.Ok);
return;
}
installer.execute("DELETE", ["C:\Windows\system32\cqtdeployer.exe"])
installer.dropAdminRights();
} else {
installer.execute("rm", ["-f", homeDir + "/.local/bin/cqtdeployer"])
}
}
Controller.prototype.installationFinished = function()
{
targetDir = installer.value("TargetDir", "");
homeDir = installer.value("HomeDir", "");
console.log("targetDir " + targetDir)
console.log("hometDir " + homeDir)
if (systemInfo.kernelType === "winnt") {
if (!installer.gainAdminRights()) {
QMessageBox["warning"](qsTr("install in system"), qsTr("Installer"),
qsTr("To install cqtdeployer on your system, you need administrator rights!. ") +
qsTr("The installation was successful, but cqtdeployer will not be available from the console. ") +
qsTr("To take advantage of this program you will need to enter the full path to it. ") +
qsTr("Example: ") + targetDir + "\cqtdeployer.exe", QMessageBox.Ok);
return;
}
installer.execute("DELETE", ["C:\Windows\system32\cqtdeployer.exe"])
installer.execute("mklink", [targetDir + "\cqtdeployer.exe", "C:\Windows\system32\cqtdeployer.exe"])
installer.dropAdminRights();
} else {
installer.execute("ln", ["-sf", targetDir + "/cqtdeployer.sh",
homeDir + "/.local/bin/cqtdeployer"])
}
QMessageBox["information"](qsTr("install in system"), qsTr("Installer"),
qsTr("CQtDeployer successfully installed on your computer to use the call \"cqtdeployer\"."),
QMessageBox.Ok);
}

BIN
installer/config/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
installer/config/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

62
installer/config/ru.ts Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>controlScript</name>
<message>
<location filename="controlScript.js" line="13"/>
<source>CQtDeployer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="controlScript.js" line="14"/>
<source>Install CQtDeployer</source>
<oldsource>Install Snake</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="controlScript.js" line="23"/>
<location filename="controlScript.js" line="51"/>
<location filename="controlScript.js" line="70"/>
<source>install in system</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="controlScript.js" line="23"/>
<location filename="controlScript.js" line="51"/>
<location filename="controlScript.js" line="70"/>
<source>Installer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="controlScript.js" line="24"/>
<source>To uninstall cqtdeployer on your system, you need administrator rights!. </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="controlScript.js" line="52"/>
<source>To install cqtdeployer on your system, you need administrator rights!. </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="controlScript.js" line="53"/>
<source>The installation was successful, but cqtdeployer will not be available from the console. </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="controlScript.js" line="54"/>
<source>To take advantage of this program you will need to enter the full path to it. </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="controlScript.js" line="55"/>
<source>Example: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="controlScript.js" line="71"/>
<source>CQtDeployer successfully installed on your computer to use the call &quot;cqtdeployer&quot;.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,62 @@
.QWidget {
background-color: rgb(255, 255, 255);
min-width: 640px;
}
.QLabel {
color: #000000;
}
.QPushButton {
background-color: transparent;
border: 2px solid #ffffff;
border-radius: 3px;
height: 30px;
min-width: 100px;
padding: 0 15px;
}
.QPushButton:pressed,
.QPushButton:checked {
background-color: #2ed3ed;
}
.QPushButton:focus {
background-color: #aaf2ff;
}
.QPushButton:hover {
border: 2px solid #2ed3ed;
}
.QProgressBar {
background: #b1dbcc;
border: 1px solid #cdcdcd;
border-radius: 2px;
padding: 0;
margin: 0;
color: #ffffff;
height: 30px;
text-align: center;
}
.QProgressBar::chunk {
background: #16dbcc;
border-radius: 2px;
margin: 0;
}
.QProgressBar:hover {
border-color: #2ed3ed;
}
.QLineEdit {
background-color: transparent;
border-color: #cdcdcd;
height: 30px;
}
.QLineEdit:hover {
border-color: #2ed3ed;
}

View File

@ -0,0 +1,33 @@
!isEmpty(INSTALL_REFIX_PRI_INCLUDED):error("install_prefix.pri already included")
INSTALL_REFIX_PRI_INCLUDED = 1
unix:libfiletype=*.so*
win32:libfiletype=*.dll
unix:runfiletype=*
win32:runfiletype=*.exe
isEmpty(PREFIX_BIN) {
isEmpty(PREFIX) {
PREFIX_BIN = $$PWD/distro
} else {
unix:PREFIX_BIN = $$PREFIX/bin
win32:PREFIX_BIN = $$PREFIX
}
}
isEmpty(PREFIX_LIB) {
isEmpty(PREFIX) {
PREFIX_LIB = $$PWD/distro
} else {
unix:PREFIX_LIB = $$PREFIX/lib
win32:PREFIX_LIB = $$PREFIX
}
}
target_bin.path = $$PREFIX_BIN
target_bin.CONFIG += no_check_exist
target_lib.path = $$PREFIX_LIB
target_lib.CONFIG += no_check_exist
INSTALLS += target_bin target_lib

148
installer/installer.pri Normal file
View File

@ -0,0 +1,148 @@
QT_DIR = $$dirname(QMAKE_QMAKE)
#QML_DIR = $$PWD/../Snake/
DEPLOY_TARGET = $$PWD/../CQtDeployer/build/release
win32:LUPDATE = $$QT_DIR/lupdate.exe
win32:LRELEASE = $$QT_DIR/lrelease.exe
win32:DEPLOYER = cqtdeployer.exe
win32:OUT_FILE = CQtDeployerInstaller.exe
contains(QMAKE_HOST.os, Linux):{
LUPDATE = $$QT_DIR/lupdate
LRELEASE = $$QT_DIR/lrelease
DEPLOYER = cqtdeployer
OUT_FILE = CQtDeployerInstaller
}
BINARY_LIST
REPO_LIST
exists( $$QT_DIR/../../../Tools/QtInstallerFramework/3.0/bin/ ) {
message( "QtInstallerFramework v3.0: yes" )
BINARY_LIST += $$QT_DIR/../../../Tools/QtInstallerFramework/3.0/bin/binarycreator
REPO_LIST += $$QT_DIR/../../../Tools/QtInstallerFramework/3.0/bin/repogen
}
exists( $$QT_DIR/../../../Tools/QtInstallerFramework/2.0/bin/ ) {
message( "QtInstallerFramework v2.0: yes" )
BINARY_LIST += $$QT_DIR/../../../Tools/QtInstallerFramework/2.0/bin/binarycreator
REPO_LIST += $$QT_DIR/../../../Tools/QtInstallerFramework/2.0/bin/repogen
}
isEmpty (BINARY_LIST) {
error( "QtInstallerFramework not found!" )
}
win32:EXEC=$$first(BINARY_LIST).exe
win32:REPOGEN=$$first(REPO_LIST).exe
contains(QMAKE_HOST.os, Linux):{
unix:EXEC=$$first(BINARY_LIST)
win32:EXEC=wine $$first(BINARY_LIST).exe
REPOGEN=$$first(REPO_LIST)
}
message( selected $$EXEC and $$REPOGEN)
SUPPORT_LANGS = ru
defineReplace(findFiles) {
patern = $$1
path = $$2
all_files = $$files(*$${patern}, true)
win32:all_files ~= s|\\\\|/|g
win32:path ~= s|\\\\|/|g
for(file, all_files) {
result += $$find(file, $$path)
}
return($$result)
}
XML_FILES = $$files(*.xml, true)
for(LANG, SUPPORT_LANGS) {
for(XML, XML_FILES) {
FILE_PATH = $$dirname(XML)
JS_FILES = $$findFiles(".js", $$FILE_PATH)
UI_FILES = $$findFiles(".ui", $$FILE_PATH)
commands += "$$LUPDATE $$JS_FILES $$UI_FILES -ts $$FILE_PATH/$${LANG}.ts"
TS_FILES += $$FILE_PATH/$${LANG}.ts
}
for(TS, TS_FILES) {
commands += "$$LRELEASE $$TS"
}
}
for(command, commands) {
system($$command)|error("Failed to run: $$command")
}
BASE_DEPLOY_FLAGS = clear -qmake $$QMAKE_QMAKE -libDir $$PWD/../ -recursiveDepth 3
BASE_DEPLOY_FLAGS_SNAKE = $$BASE_DEPLOY_FLAGS -targetDir $$PWD/packages/cqtdeployer/data
deploy_dep.commands += $$DEPLOYER -bin $$DEPLOY_TARGET $$BASE_DEPLOY_FLAGS_SNAKE
mkpath( $$PWD/../Distro)
win32:CONFIG_FILE = $$PWD/config/configWin.xml
unix:CONFIG_FILE = $$PWD/config/configLinux.xml
deploy.commands = $$EXEC \
--offline-only \
-c $$CONFIG_FILE \
-p $$PWD/packages \
$$PWD/../Distro/$$OUT_FILE
deploy.depends = deploy_dep
win32:ONLINE_REPO_DIR = $$ONLINE/CQtDeployer/Windows
unix:ONLINE_REPO_DIR = $$ONLINE/CQtDeployer/Linux
create_repo.commands = $$REPOGEN \
--update-new-components \
-p $$PWD/packages \
$$ONLINE_REPO_DIR
message( ONLINE_REPO_DIR $$ONLINE_REPO_DIR)
!isEmpty( ONLINE ) {
message(online)
release.depends = create_repo
deploy.commands = $$EXEC \
--online-only \
-c $$CONFIG_FILE \
-p $$PWD/packages \
$$PWD/../Distro/$$OUT_FILE
}
OTHER_FILES += \
$$PWD/config/*.xml \
$$PWD/config/*.js \
$$PWD/config/*.ts \
$$PWD/config/*.css \
$$PWD/packages/Installer/meta/* \
$$PWD/packages/Installer/data/app.check \
$$PWD/packages/cqtdeployer/meta/* \
QMAKE_EXTRA_TARGETS += \
deploy_dep \
deploy \
create_repo \
release \

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,13 @@
// Constructor
function Component()
{
generateTr();
}
function generateTr() {
console.log("generate tr start ")
component.setValue("DisplayName", qsTr("Installer"));
component.setValue("Description", qsTr("This package contains information of installer"));
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<Package>
<DisplayName>from script</DisplayName>
<Description>from script</Description>
<Version>1.0.0</Version>
<Default>true</Default>
<ForcedInstallation>true</ForcedInstallation>
<Script>installscript.js</Script>
<ReleaseDate>2018-08-25</ReleaseDate>
<SortingPriority>201</SortingPriority>
<Translations>
<Translation>ru.qm</Translation>
</Translations>
</Package>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>installscript</name>
<message>
<location filename="installscript.js" line="10"/>
<source>Installer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="installscript.js" line="11"/>
<source>This package contains information of installer</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,17 @@
function Component()
{
generateTr();
}
function generateTr() {
component.setValue("DisplayName", qsTr("CQtDeployer"));
component.setValue("Description", qsTr("This package contains CQtDeployer"));
}
Component.prototype.createOperations = function()
{
// // call default implementation to actually install README.txt!
component.createOperations();
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<Package>
<DisplayName>CQtDeployer</DisplayName>
<Description>CQtDeployer</Description>
<Version>1.2.1</Version>
<Default>true</Default>
<ForcedInstallation>false</ForcedInstallation>
<Script>installscript.js</Script>
<ReleaseDate>2019-05-14</ReleaseDate>
<SortingPriority>200</SortingPriority>
<Translations>
<Translation>ru.qm</Translation>
</Translations>
</Package>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>installscript</name>
<message>
<location filename="installscript.js" line="7"/>
<source>CQtDeployer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="installscript.js" line="8"/>
<source>This package contains CQtDeployer</source>
<oldsource>This package contains Snake</oldsource>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

12
test.pri Normal file
View File

@ -0,0 +1,12 @@
unix:exec = $$PWD/UnitTests/build/release/UnitTests
win32:exec = $$PWD/UnitTests/build/release/UnitTests.exe
deployTest.commands = cqtdeployer -bin $$exec clear -qmake $$QMAKE_QMAKE -targetDir $$PWD/deployTests -libDir $$PWD -recursiveDepth 3
test.depends = deployTest
unix:test.commands = $$PWD/deployTests/UnitTests.sh
win32:test.commands = $$PWD/deployTests/UnitTests.exe
QMAKE_EXTRA_TARGETS += \
deployTest \
test