mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-28 02:34:34 +00:00
fix documentation about creating shortcuts
This commit is contained in:
parent
d57c8660c0
commit
c9440980df
@ -5,136 +5,15 @@ Disabling shortcuts for multi targets distribution Kit in the Qt Installer frame
|
||||
Some times we need to disable creating automaticly shortcuts for some applications.
|
||||
For solve this problem i recomendet override the default qt installer framework template.
|
||||
|
||||
For this you need to extract default template for your case. You can get more infrmation in this [page](ExtractDefaultsTemplates.md).
|
||||
# Примечание
|
||||
В CQtDeployer 1.5.1 вы можете добавить опцию -disableShortcuts для отключения автоматизации создания ярлыков.
|
||||
|
||||
## Case
|
||||
### Пример:
|
||||
|
||||
I have a distribution that deployed using next command:
|
||||
|
||||
``` bash
|
||||
cqtdeployer -bin myExecutableFile1,myExecutableFile2 -qmake /qmake/path qif -targetPackage MyDistribution
|
||||
```bash
|
||||
cqtdeployer -disableShortCut targetName,target2Name
|
||||
```
|
||||
### where:
|
||||
|
||||
* **-bin myExecutableFile1,myExecutableFile2** - sets executable files.
|
||||
* **-qmake /qmake/path** - sets path to your qmake.
|
||||
* **qif** - option for enabling Qt Installer FrameWork Distributions.
|
||||
* **-targetPackage MyDistribution** - sets new name for distribution pacakge.
|
||||
|
||||
To add myExecutableFile2 to the shortcut creation exception list you need to do the following steps:
|
||||
|
||||
1. Extract default template.
|
||||
For extraction default template you need to add into your commnad the getDefaultTemplate option. Alsu you should add targetDir option to sets path of output files.
|
||||
|
||||
``` bash
|
||||
cqtdeployer -bin myExecutableFile1,myExecutableFile2 -qmake /qmake/path qif getDefaultTemplate -targetDir qifTemplate -targetPackage MyDistribution
|
||||
```
|
||||
|
||||
### where:
|
||||
* **-targetDir qifTemplate** - sets target dir for tempalte.
|
||||
* **getDefaultTemplate** - option for extract default template.
|
||||
|
||||
|
||||
So after this you get a default qif template in the targetDir.
|
||||
|
||||
``` bash
|
||||
~/qifTemplate$ tree
|
||||
.
|
||||
└── defaultQIFWTemplate
|
||||
├── config
|
||||
│ ├── config.xml
|
||||
│ └── controlScript.qs
|
||||
└── packages
|
||||
└── Application
|
||||
└── meta
|
||||
├── installscript.qs
|
||||
└── package.xml
|
||||
|
||||
5 directories, 4 files
|
||||
|
||||
```
|
||||
|
||||
2. Change you default template.
|
||||
For disabling shortcuts you need to change the generateShortCutCmd method of the your package. In the my case it is **defaultQIFWTemplate/packages/Application/meta/installscript.qs**
|
||||
|
||||
This is default implementation of install script:
|
||||
``` js
|
||||
function Component() {
|
||||
|
||||
}
|
||||
|
||||
function extractFileName(path) {
|
||||
const fullName = path.substring(path.lastIndexOf('/') + 1);
|
||||
|
||||
const index = fullName.lastIndexOf('.');
|
||||
if (index >= 0) {
|
||||
return fullName.substring(0, index)
|
||||
}
|
||||
|
||||
return fullName;
|
||||
}
|
||||
|
||||
function generateShortCutCmd(cmd) {
|
||||
if (systemInfo.kernelType === "winnt") {
|
||||
|
||||
console.log("create icons!!! on Windows");
|
||||
|
||||
component.addOperation(
|
||||
"CreateShortcut",
|
||||
"@TargetDir@/" + cmd + ".bat",
|
||||
"@DesktopDir@/" + extractFileName(cmd) + ".lnk",
|
||||
"iconPath=@TargetDir@/icons/Icon.png",
|
||||
"iconId=0");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (systemInfo.kernelType === "linux") {
|
||||
console.log("create icons!!! on LINUX");
|
||||
const name = extractFileName(cmd);
|
||||
component.addOperation("CreateDesktopEntry",
|
||||
"@HomeDir@/.local/share/applications/" + name + ".desktop",
|
||||
"Version=@Version@\n
|
||||
Type=Application\n
|
||||
Terminal=false\n
|
||||
Exec=\"@TargetDir@/" + cmd + ".sh\"\n
|
||||
Name=" + name + "\n
|
||||
Icon=@TargetDir@/icons/Icon.png\n
|
||||
Name[en_US]=" + name);
|
||||
|
||||
console.log("create icons!!! on LINUX done");
|
||||
}
|
||||
}
|
||||
|
||||
Component.prototype.createOperations = function() {
|
||||
// call default implementation to actually install README.txt!
|
||||
component.createOperations();
|
||||
|
||||
const cmdArray = []; // will be changed in cqtdeployer
|
||||
|
||||
cmdArray.forEach( function (item){
|
||||
generateShortCutCmd(item);
|
||||
});
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Add into begin of the generateShortCutCmd method next lines for disable generate shorcuts of the *"myExecutableFile2"* application:
|
||||
|
||||
``` js
|
||||
function generateShortCutCmd(cmd) {
|
||||
if (cmd.include("myExecutableFile2"))
|
||||
return;
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
3. Add your overriden template into your deploy command.
|
||||
``` bash
|
||||
cqtdeployer -bin myExecutableFile1,myExecutableFile2 -qmake /qmake/path qif qifTemplate/defaultQIFWTemplate
|
||||
```
|
||||
|
||||
All done. Now you have a distribution with disabled shortcut for the myExecutableFile2 application.
|
||||
|
||||
|
||||
## Note If you use config File or another deploy command then your deploy configuration should be equals with generate template configuration.
|
||||
```bash
|
||||
cqtdeployer -bin myProgramm.exe -disableShortCut myProgramm
|
||||
```
|
||||
|
@ -128,8 +128,8 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
|
||||
| Option | Descriptiion |
|
||||
|-----------------------------|-----------------------------------------------------------|
|
||||
| -icon [target;val,val] | Sets path to icon for a targets |
|
||||
| -disableRunScript [target;val,val] | Disables a generation of run script for selected targets|
|
||||
| -disableShortCut [target;val,val] | Disables a generation of shortcut for selected targets |
|
||||
| -disableRunScript [target,target2,target3] | Disables a generation of run script for selected targets|
|
||||
| -disableShortCut [target,target2,target3] | Disables a generation of shortcut for selected targets |
|
||||
| -runScript [target;val,val] | forces cqtdeployer swap default run script to new from the arguments of option. This option copy all content from input file and insert all code into runScript.sh or .bat. Example of use: cqtdeployer -runScript "myTargetMame;path/to/my/myCustomLaunchScript.sh,myTargetSecondMame;path/to/my/mySecondCustomLaunchScript.sh" For get more information about customScript see the documentation [page](CustomScripts.md)|
|
||||
|
||||
### Plugins Controll Options
|
||||
|
@ -5,135 +5,15 @@
|
||||
Иногда нам нужно отключить автоматическое создание ярлыков для некоторых приложений.
|
||||
Для решения этой проблемы я рекомендую переопределить шаблон фреймворка установщика qt по умолчанию.
|
||||
|
||||
Для этого вам нужно извлечь шаблон по умолчанию для вашего случая. Вы можете получить дополнительную информацию на этой [странице](ExtractDefaultsTemplates.md).
|
||||
# Note
|
||||
From CQtDeployer 1.5.1 you can add option -disableShortcuts for disable automation create shortcuts.
|
||||
|
||||
## Кейс
|
||||
### Example:
|
||||
|
||||
У меня есть дистрибутив, развернутый с помощью следующей команды:
|
||||
```bash
|
||||
cqtdeployer -disableShortCut targetName,target2Name
|
||||
```
|
||||
|
||||
```bash
|
||||
cqtdeployer -bin myExecutableFile1,myExecutableFile2 -qmake /qmake/path qif
|
||||
cqtdeployer -bin myProgramm.exe -disableShortCut myProgramm
|
||||
```
|
||||
### где:
|
||||
|
||||
* **-bin myExecutableFile1, myExecutableFile2** - устанавливает исполняемые файлы.
|
||||
* **-qmake /qmake/path** - устанавливает путь к вашему qmake.
|
||||
* **qif** - опция для включения дистрибутивов Qt Installer FrameWork.
|
||||
* **-targetPackage MyDistribution** - устанавливает новое имя для пакета распространения.
|
||||
|
||||
Чтобы добавить myExecutableFile2 в список исключений создания ярлыка, вам необходимо проделать следующие шаги:
|
||||
|
||||
|
||||
|
||||
1. Извлеките шаблон по умолчанию.
|
||||
Для извлечения шаблона по умолчанию вам необходимо добавить в свою команду параметр getDefaultTemplate. Также вам следует добавить опцию targetDir для установки пути к выходным файлам.
|
||||
|
||||
```bash
|
||||
cqtdeployer -bin myExecutableFile1,myExecutableFile2 -qmake /qmake/path qif getDefaultTemplate -targetDir qifTemplate
|
||||
```
|
||||
|
||||
### где:
|
||||
* **- targetDir qifTemplate** - устанавливает целевой каталог для tempalte.
|
||||
* **getDefaultTemplate** - опция для извлечения шаблона по умолчанию.
|
||||
|
||||
Итак, после этого вы получите шаблон qif по умолчанию в targetDir.
|
||||
```bash
|
||||
~/qifTemplate$ tree
|
||||
.
|
||||
└── defaultQIFWTemplate
|
||||
├── config
|
||||
│ ├── config.xml
|
||||
│ └── controlScript.qs
|
||||
└── packages
|
||||
└── Application
|
||||
└── meta
|
||||
├── installscript.qs
|
||||
└── package.xml
|
||||
|
||||
5 directories, 4 files
|
||||
|
||||
```
|
||||
|
||||
2. Измените шаблон по умолчанию.
|
||||
Для отключения ярлыков вам необходимо изменить метод generateShortCutCmd вашего пакета. В моем случае это **defaultQIFWTemplate/packages/Application/meta/installscript.qs**
|
||||
|
||||
Это реализация сценария установки по умолчанию:
|
||||
``` js
|
||||
function Component() {
|
||||
|
||||
}
|
||||
|
||||
function extractFileName(path) {
|
||||
const fullName = path.substring(path.lastIndexOf('/') + 1);
|
||||
|
||||
const index = fullName.lastIndexOf('.');
|
||||
if (index >= 0) {
|
||||
return fullName.substring(0, index)
|
||||
}
|
||||
|
||||
return fullName;
|
||||
}
|
||||
|
||||
function generateShortCutCmd(cmd) {
|
||||
if (systemInfo.kernelType === "winnt") {
|
||||
|
||||
console.log("create icons!!! on Windows");
|
||||
|
||||
component.addOperation(
|
||||
"CreateShortcut",
|
||||
"@TargetDir@/" + cmd + ".bat",
|
||||
"@DesktopDir@/" + extractFileName(cmd) + ".lnk",
|
||||
"iconPath=@TargetDir@/icons/Icon.png",
|
||||
"iconId=0");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (systemInfo.kernelType === "linux") {
|
||||
console.log("create icons!!! on LINUX");
|
||||
const name = extractFileName(cmd);
|
||||
component.addOperation("CreateDesktopEntry",
|
||||
"@HomeDir@/.local/share/applications/" + name + ".desktop",
|
||||
"Version=@Version@\n
|
||||
Type=Application\n
|
||||
Terminal=false\n
|
||||
Exec=\"@TargetDir@/" + cmd + ".sh\"\n
|
||||
Name=" + name + "\n
|
||||
Icon=@TargetDir@/icons/Icon.png\n
|
||||
Name[en_US]=" + name);
|
||||
|
||||
console.log("create icons!!! on LINUX done");
|
||||
}
|
||||
}
|
||||
|
||||
Component.prototype.createOperations = function() {
|
||||
// call default implementation to actually install README.txt!
|
||||
component.createOperations();
|
||||
|
||||
const cmdArray = []; // will be changed in cqtdeployer
|
||||
|
||||
cmdArray.forEach( function (item){
|
||||
generateShortCutCmd(item);
|
||||
});
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Добавьте в начало метода generateShortCutCmd следующие строки для отключения генерации ярлыков приложения *"myExecutableFile2"*:
|
||||
|
||||
``` js
|
||||
function generateShortCutCmd(cmd) {
|
||||
if (cmd.include("myExecutableFile2"))
|
||||
return;
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
3. Добавьте измененный шаблон в команду развертывания.
|
||||
```bash
|
||||
cqtdeployer -bin myExecutableFile1,myExecutableFile2 -qmake /qmake/path qif qifTemplate/defaultQIFWTemplate
|
||||
```
|
||||
|
||||
Все сделано. Теперь у вас есть дистрибутив с отключенным ярлыком для приложения myExecutableFile2.
|
||||
|
||||
## Примечание. Если вы используете файл конфигурации или другую команду развертывания, ваша конфигурация развертывания должна соответствовать конфигурации генерации шаблона.
|
@ -133,8 +133,8 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
|
||||
| Option | Descriptiion |
|
||||
| ----------------------------|---------------------------------------------------------- |
|
||||
| -extraPlugin [пакет; val1; val2, SingeleVal] | Устанавливает дополнительный путь к стороннему плагину приложения |
|
||||
| -enablePlugins [пакет; val1; val2, SingeleVal] | Включает дополнительные плагины для распространения. |
|
||||
| -disablePlugins [пакет; val1; val2, SingeleVal] | Отключает плагины для распространения. |
|
||||
| -enablePlugins [target,target2,target3] | Включает дополнительные плагины для распространения. |
|
||||
| -disablePlugins [target,target2,target3] | Отключает плагины для распространения. |
|
||||
| | Вы можете отключить любой плагин вашей сборки Qt, просто проверте список доступных плагинов в свой qlFolder/plugins папке.
|
||||
| | Пример: Если вы хотите отключить плагин qxcb: -disablePlugins qxcb. Обратите внимание, что имя плагина указывается без его расширения.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user