「QGISをインストールしたいがWindowsのメニューには表示したくない」などの要求に対応するためにQGISインストーラーをカスタマイズ
QGISにはインストーラーをパッケージするスクリプト「creatensis.pl」がある
最初にcreatensis.plの動作環境を構築してインストーラーの作成プロセスを確認
その後インストーラーをカスタイマイズする
※creatensis.plは最新のモジュールをQGISサーバーからダウンロードしてインストーラーをパッケージするため特定のバージョンのインストーラーは作成できない
(1)NSISをインストール
NSISをインストールして、makensis.exeのあるフォルダにPATHを通す
(2)cygwinをインストール
cygwinはCドライブ直下にインストール
(3)QGISをgithubからダウンロード
ダウンロード対象のバージョンのQGISをダウンロード
cygwinのhome直下にディレクトリsetupを作成しダウンロードしたZIPファイルを展開
(4)creatensis.pl
展開したsetup/QGIS-release-3_4/ms-windows/osgeo4wディレクトリにあるcreatensis.plを開き
$archに対象のアーキテクチャーを設定
64bitの時
1 | my $arch = "x86_64"; |
32bitの時
1 | my $arch = "x86"; |
cygwinのコンソールを開き、カレントフォルダを「以下よりベースとするQGISのバージョンのインストーラーをダウンロード
https://qgis.org/downloads/
https://qgis.org/downloads/https://qgis.org/downloads/https://qgis.org/downloads/ ~/setup/QGIS-release-3_4/ms-windows/osgeo4w」に移動
以下のコマンドを実行するとインストーラーが作成される
1 | perl creatensis.pl --verbose |
creatensis.plの流れ
(a)Untgz.zip、Inetc.zipのダウンロード
http://qgis.org/downloadsよりUntgz.zip、Inetc.zipをダウンロード
(b)setup.iniのダウンロード
http://download.osgeo.org/osgeo4w/アーキテクチャー名/setup.iniをダウンロード
setup.iniにはインストーラーに必要なパッケージ名が記載されている
※setup.iniには最新のモジュールが記載されている。よって対象のバージョンとは異なるモジュールがダウンロードされるが一旦最新をダウンロード
(c)setup.iniファイルに記載されたパッケージをダウンロードを
ダウンロードされたファイルは以下のフォルダに保存される
C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\packages-アーキテクチャー名
ダウンロードされるファイルの例
(d)ダウンロードされたファイルを展開
ダウンロードされたパッケージを以下のフォルダに展開
これがインストーラーのイメージになる
C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-アーキテクチャー名
(e)postinstall.batを作成
以下のフォルダにインストーラーから呼ばれるpostinstall.batを作成
C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\Installer-Files
※postinstall.batはインストール先のetc\postinstallフォルダにある各batファイルを呼ぶ
このフォルダはunpackedディレクトリではC:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-x86\etc\postinstallになる
(f)nsisを実行してインストーラーを作成
makensis.exeにC:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\QGIS-Installer.nsiを渡してインストーラーを作成
以上
(5)特定バージョンのインストーラを作成
上述の通りcreatensis.plを実行すると直近のバージョンのインストーラーが作成される。
ここでは特定のバージョンのインストーラーを作成する。
最初にベースとするQGISのバージョンのインストーラーをダウンロード
https://qgis.org/downloads/
ダウンロードしたインストーラーを7zipで解凍する。
※7zipはNSISで作成したインストーラーを展開できる
QGIS-OSGeo4W-3.4.13-2-Setup-x86.exeを展開したフォルダ構成
creatensis.plで作成した「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-アーキテクチャー名」フォルダ内を削除して
インストーラを展開した$_25_フォルダ内のフォルダ、ファイルを「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-アーキテクチャー名」フォルダにコピー
「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-アーキテクチャー名」フォルダにある「postinstall.bat」、「preremove.bat」を
「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\Installer-Files」に上書きコピー
次にcreatensis.plから不要な部分をコメントして現在の「「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-アーキテクチャー名」フォルダよりインストーラーを作成するように変更。
以下はcreatensis.plからファイルのダウンロード箇所をコメントアウト
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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | #!/usr/bin/env perl # creates a NSIS installer from OSGeo4W packages # note: works also on Unix # Copyright (C) 2010 J端rgen E. Fischer <jef@norbit.de> # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Download OSGeo4W packages # BEGIN { # ignore requireAdministrator execution level while producing the # uninstaller $ENV{"__COMPAT_LAYER"} = 'RUNASINVOKER'; } use strict; use warnings; use Getopt::Long; use Pod::Usage; sub pause() { print('pause'); <stdin> } my $keep = 0; my $verbose = 0; my $packagename = "QGIS"; my $releasename; #my $shortname = "qgis"; my $shortname = "qgis-ltr"; my $version; my $binary; my $root = "http://download.osgeo.org/osgeo4w"; my $ininame = "setup.ini"; #my $arch = "x86_64"; my $arch = "x86"; my $signwith; my $signpass; my $help; my $result = GetOptions( "verbose+" => \$verbose, "keep" => \$keep, "signwith=s" => \$signwith, "signpass=s" => \$signpass, "releasename=s" => \$releasename, "version=s" => \$version, "binary=i" => \$binary, "packagename=s" => \$packagename, "shortname=s" => \$shortname, "ininame=s" => \$ininame, "mirror=s" => \$root, "arch=s" => \$arch, "help" => \$help ); die "certificate not found" if defined $signwith && ! -f $signwith; pod2usage(1) if $help; my $wgetopt = $verbose ? "" : "-nv"; print "download of System.dll \n" if $verbose; #unless(-f "nsis/System.dll") { # mkdir "nsis", 0755 unless -d "nsis"; # system "wget $wgetopt -Onsis/System.dll http://qgis.org/downloads/System.dll"; # die "download of System.dll failed" if $?; #} my $archpath = $arch eq "" ? "" : "/$arch"; my $archpostfix = $arch eq "" ? "" : "-$arch"; my $unpacked = "unpacked" . ($arch eq "" ? "" : "-$arch"); my $packages = "packages" . ($arch eq "" ? "" : "-$arch"); print "mkdir $packages \n" if $verbose; mkdir $packages, 0755 unless -d $packages; print "chdir $packages \n" if $verbose; chdir $packages; print "download Untgz.zip \n" if $verbose; pause(); #system "wget $wgetopt -c http://qgis.org/downloads/Untgz.zip" unless -f "Untgz.zip"; #die "download of Untgz.zip failed" if $?; my %dep; my %file; my %lic; my %sdesc; my %md5; my $package; print "download $root$archpath/$ininame \n" if $verbose; pause(); #system "wget $wgetopt -O setup.ini $root$archpath/$ininame"; #die "download of setup.ini failed" if $?; print "read setup.ini \n" if $verbose; #open F, "setup.ini" || die "setup.ini not found"; #while(<F>) { # my $file; # my $md5; # # chop; # if(/^@ (\S+)/) { # $package = $1; # } elsif( /^requires: (.*)$/ ) { # @{$dep{$package}} = split / /, $1; # } elsif( ($file,$md5) = /^install:\s+(\S+)\s+.*\s+(\S+)$/) { # $file{$package} = $file unless exists $file{$package}; # $file =~ s/^.*\///; # $md5{$file} = $md5 unless exists $md5{$file}; # } elsif( ($file,$md5) = /^license:\s+(\S+)\s+.*\s+(\S+)$/) { # $lic{$package} = $file unless exists $lic{$package}; # $file =~ s/^.*\///; # $md5{$file} = $md5 unless exists $md5{$file}; # } elsif( /^sdesc:\s*"(.*)"\s*$/) { # $sdesc{$package} = $1 unless exists $sdesc{$package}; # } #} #close F; my %pkgs; sub getDeps { my $pkg = shift; my $deponly = $pkg =~ /-$/; $pkg =~ s/-$//; unless($deponly) { return if exists $pkgs{$pkg}; print " Including package $pkg\n" if $verbose; $pkgs{$pkg} = 1; } elsif( exists $pkgs{$pkg} ) { print " Excluding package $pkg\n" if $verbose; delete $pkgs{$pkg}; return; } else { print " Including dependencies of package $pkg\n" if $verbose; } foreach my $p ( @{ $dep{$pkg} } ) { getDeps($p); } } print "unless \n" if $verbose; #unless(@ARGV) { # print "Defaulting to qgis-full package...\n" if $verbose; # push @ARGV, "qgis-full"; #} print "getDeps \n" if $verbose; #getDeps($_) for @ARGV; #if(-f "../addons/bin/NCSEcw4_RO.dll") { # print "Enabling ECW support...\n" if $verbose; # getDeps("gdal-ecw") #} print "Download package \n" if $verbose; #my @lic; #my @desc; #foreach my $p ( keys %pkgs ) { # my @f; # unless( exists $file{$p} ) { # print "No file for package $p found.\n" if $verbose; # next; # } # push @f, "$root/$file{$p}"; # # if( exists $lic{$p} ) { # push @f, "$root/$lic{$p}"; # my($l) = $lic{$p} =~ /([^\/]+)$/; # push @lic, $l; # push @desc, $sdesc{$p}; # } # # for my $f (@f) { # $f =~ s/\/\.\//\//g; # # my($file) = $f =~ /([^\/]+)$/; # # next if -f $file; # # print "Downloading $file [$f]...\n" if $verbose; # system "wget $wgetopt -c $f"; # die "download of $f failed" if $? or ! -f $file; # # if( exists $md5{$file} ) { # my $md5; # open F, "md5sum '$file'|"; # while(<F>) { # if( /^(\S+)\s+\*?(.*)$/ && $2 eq $file ) { # $md5 = $1; # } # } # close F; # # die "No md5sum of $p determined [$file]" unless defined $md5; # if( $md5 eq $md5{$file} ) { # print "md5sum of $file verified.\n" if $verbose; # } else { # die "md5sum mismatch for $file [$md5 vs $md5{$file{$p}}]" # } # } # else # { # die "md5sum for $file not found.\n"; # } # } #} print "chdir .. \n" if $verbose; chdir ".."; # # Unpack them # Add nircmd # Add addons # #if( -d $unpacked ) { # unless( $keep ) { # print "Removing $unpacked directory\n" if $verbose; # system "rm -rf $unpacked"; # } else { # print "Keeping $unpacked directory\n" if $verbose; # } #} my $taropt = "v" x $verbose; #unless(-d $unpacked ) { # mkdir "$unpacked", 0755; # mkdir "$unpacked/bin", 0755; # mkdir "$unpacked/etc", 0755; # mkdir "$unpacked/etc/setup", 0755; # # # Create package database # open O, ">$unpacked/etc/setup/installed.db"; # print O "INSTALLED.DB 2\n"; # # foreach my $pn ( keys %pkgs ) { # my $p = $file{$pn}; # unless( defined $p ) { # print "No package found for $pn\n" if $verbose; # next; # } # # $p =~ s#^.*/#$packages/#; # # unless( -r $p ) { # print "Package $p not found.\n" if $verbose; # next; # } # # print O "$pn $p 0\n"; # # print "Unpacking $p...\n" if $verbose; # system "bash -c 'tar $taropt -C $unpacked -xjvf $p | gzip -c >$unpacked/etc/setup/$pn.lst.gz && [ \${PIPESTATUS[0]} == 0 -a \${PIPESTATUS[1]} == 0 ]'"; # die "unpacking of $p failed" if $?; # } # # close O; # # chdir $unpacked; # # mkdir "bin", 0755; # # unless( -f "bin/nircmd.exe" ) { # unless( -f "../$packages/nircmd.zip" ) { # system "cd ../$packages; wget $wgetopt -c http://www.nirsoft.net/utils/nircmd.zip"; # die "download of nircmd.zip failed" if $?; # } # # mkdir "apps", 0755; # mkdir "apps/nircmd", 0755; # system "cd apps/nircmd; unzip ../../../$packages/nircmd.zip && mv nircmd.exe nircmdc.exe ../../bin"; # die "unpacking of nircmd failed" if $?; # } # # if( -d "../addons" ) { # print " Including addons...\n" if $verbose; # system "tar -C ../addons -cf - . | tar $taropt -xf -"; # die "copying of addons failed" if $?; # } # # chdir ".."; #} print "read cmakelist \n" if $verbose; my($major, $minor, $patch); open F, "../../CMakeLists.txt"; while(<F>) { if(/SET\(CPACK_PACKAGE_VERSION_MAJOR "(\d+)"\)/) { $major = $1; } elsif(/SET\(CPACK_PACKAGE_VERSION_MINOR "(\d+)"\)/) { $minor = $1; } elsif(/SET\(CPACK_PACKAGE_VERSION_PATCH "(\d+)"\)/) { $patch = $1; } elsif(/SET\(RELEASE_NAME "(.+)"\)/) { $releasename = $1 unless defined $releasename; } } close F; print "major $major \n" if $verbose; print "minor $minor \n" if $verbose; print "patch $patch \n" if $verbose; print "releasename $releasename \n" if $verbose; $version = "$major.$minor.$patch" unless defined $version; my($pmajor,$pminor,$ppatch) = $version =~ /^(\d+)\.(\d+)\.(\d+)$/; die "Invalid version $version" unless defined $ppatch; unless( defined $binary ) { if( -f "binary$archpostfix-$version" ) { open P, "binary$archpostfix-$version"; $binary = <P>; close P; $binary++; } else { $binary = 1; } } print "binary $binary \n" if $verbose; # # Create postinstall.bat # # print "Create postinstall.bat \n" if $verbose; # #open F, ">../Installer-Files/postinstall.bat"; # #my $r = ">>postinstall.log 2>&1\r\n"; # #print F "\@echo off\r\n"; #print F "if exist postinstall.log del postinstall.log\r\n"; #print F "set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\\=/%$r"; #print F "if \"%OSGEO4W_ROOT_MSYS:~1,1%\"==\":\" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%$r"; # #print F "del preremove-conf.bat$r"; #my $c = ">>preremove-conf.bat\r\n"; #print F "echo set OSGEO4W_ROOT=%OSGEO4W_ROOT%$c"; #print F "echo set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%$c"; #print F "echo set OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%$c"; #print F "echo set OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%$c"; # #print F "echo OSGEO4W_ROOT=%OSGEO4W_ROOT%$r"; #print F "echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%$r"; #print F "echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%$r"; #print F "echo OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%$r"; #print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%$r"; #print F "cd /d %OSGEO4W_ROOT%$r"; chdir $unpacked; #for my $p (<etc/postinstall/*.bat>) { # $p =~ s/\//\\/g; # my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/; # # print F "echo Running postinstall $file...$r"; # print F "%COMSPEC% /c $p$r"; # print F "ren $p $file.done$r"; #} chdir ".."; # #print F "ren postinstall.bat postinstall.bat.done$r"; # #close F; # #open F, ">../Installer-Files/preremove.bat"; # #$r = ">>%TEMP%\\$packagename-OSGeo4W-$version-$binary-preremove.log 2>&1\r\n"; # #print F "\@echo off\r\n"; #print F "call \"%~dp0\\preremove-conf.bat\"$r"; #print F "echo OSGEO4W_ROOT=%OSGEO4W_ROOT%$r"; #print F "echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%$r"; #print F "echo OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%$r"; #print F "set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\\=/%$r"; #print F "if \"%OSGEO4W_ROOT_MSYS:~1,1%\"==\":\" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%$r"; #print F "echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%$r"; #print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%$r"; #print F "cd /d \"%OSGEO4W_ROOT%\"$r"; chdir $unpacked; #for my $p (<etc/preremove/*.bat>) { # $p =~ s/\//\\/g; # my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/; # # print F "echo Running preremove $file...$r"; # print F "%COMSPEC% /c $p$r"; # print F "ren $p $file.done$r"; #} chdir ".."; # #print F "ren preremove.bat preremove.bat.done$r"; # #close F; #unless(-d "untgz") { # system "unzip $packages/Untgz.zip"; # die "unpacking Untgz.zip failed" if $?; #} chdir ".."; print "Creating license file\n" if $verbose; #open O, ">license.tmp"; #my $lic; #for my $l ( ( "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE", "../COPYING", "./Installer-Files/LICENSE.txt" ) ) { # next unless -f $l; # $lic = $l; # last; #} # #die "no license found" unless defined $lic; #my $i = 0; #if( @lic ) { # print O "License overview:\n"; # print O "1. QGIS\n"; # $i = 1; # for my $l ( @desc ) { # print O ++$i . ". $l\n"; # } # $i = 0; # print O "\n\n----------\n\n" . ++$i . ". License of 'QGIS'\n\n"; #} #print " Including QGIS license $lic\n" if $verbose; #open I, $lic; #while(<I>) { # s/\s*$/\n/; # print O; #} #close I; #for my $l (@lic) { # print " Including license $l\n" if $verbose; # # open I, "osgeo4w/$packages/$l" or die "License $l not found."; # print O "\n\n----------\n\n" . ++$i . ". License of '" . shift(@desc) . "'\n\n"; # while(<I>) { # s/\s*$/\n/; # print O; # } # close I; #} # #close O; # my $license = "license.tmp"; #if( -f "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE" ) { # open O, ">osgeo4w/$unpacked/apps/$shortname/doc/LICENSE"; # open I, $license; # while(<I>) { # print O; # } # close O; # close I; # # $license = "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE"; #} # kernel $license = "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE"; print "Running NSIS\n" if $verbose; my $installerbase = "$packagename-OSGeo4W-$version-$binary-Setup$archpostfix"; print "installerbase $installerbase \n" if $verbose; my $run; my $instdest; if($^O eq "cygwin") { $run = "cygstart "; $instdest = `cygpath -w \$PWD`; } else { $run = "wine "; $instdest = `winepath -w \$PWD`; } $instdest =~ s/\s+$//; $instdest =~ s/\\/\\\\/g; print "instdest $instdest \n" if $verbose; pause(); my $args = ""; $args .= " -V$verbose"; $args .= " -DVERSION_NAME='$releasename'"; $args .= " -DVERSION_NUMBER='$version'"; $args .= " -DBINARY_REVISION=$binary"; $args .= sprintf( " -DVERSION_INT='%d%02d%02d%02d'", $pmajor, $pminor, $ppatch, $binary ); $args .= sprintf( " -DQGIS_BASE='$packagename %d.%d'", $pmajor, $pminor ); $args .= " -DDISPLAYED_NAME=\"$packagename $version '$releasename'\""; $args .= " -DPACKAGE_FOLDER=osgeo4w/$unpacked"; $args .= " -DLICENSE_FILE='$license'"; $args .= " -DARCH='$arch'"; $args .= " QGIS-Installer.nsi"; sub sign { print "sign \n" if $verbose; pause(); my $base = shift; my $cmd = "osslsigncode sign"; $cmd .= " -pkcs12 \"$signwith\""; $cmd .= " -pass \"$signpass\"" if defined $signpass; $cmd .= " -n \"$packagename $version '$releasename'\""; $cmd .= " -h sha256"; $cmd .= " -i \"https://qgis.org\""; $cmd .= " -t \"http://timestamp.digicert.com\""; $cmd .= " -in \"$base.exe\""; $cmd .= " $base-signed.exe"; system $cmd; die "signing failed [$cmd]" if $?; rename("$base-signed.exe", "$base.exe") or die "rename failed: $!"; } print "start makensis makeuinst.exe \n" if $verbose; pause(); my $cmd; unlink "makeuinst.exe"; $cmd = "makensis -DINNER=1 -DUNINSTALLERDEST='$instdest' -DINSTALLER_NAME='makeuinst.exe' $args"; system $cmd; die "running makensis failed [$cmd]" if $?; die "makeuinst.exe not created" unless -f "makeuinst.exe"; print "${run}makeuinst.exe \n" if $verbose; pause(); unlink "uninstall.exe"; chmod 0755, "makeuinst.exe"; system "${run}makeuinst.exe"; sleep 5; die "uninstall.exe not created" unless -f "uninstall.exe"; unlink "makeuinst.exe"; sign "uninstall" if $signwith; #print "makensis $installerbase.exe \n" if $verbose; #pause(); $cmd = "makensis -DINSTALLER_NAME='$installerbase.exe' $args"; system $cmd; die "running makensis failed [$cmd]" if $?; sign "$installerbase" if $signwith; open P, ">osgeo4w/binary$archpostfix-$version"; print P $binary; close P; print "md5sum \n" if $verbose; pause(); system "md5sum $installerbase.exe >$installerbase.exe.md5sum"; print "end \n" if $verbose; pause(); __END__ =head1 NAME creatensis.pl - create NSIS package from OSGeo4W packages =head1 SYNOPSIS creatensis.pl [options] [packages...] Options: -verbose increase verbosity -releasename=name name of release (defaults to CMakeLists.txt setting) -keep don't start with a fresh unpacked directory -signwith=cert.p12 optionall sign package with certificate (requires osslsigncode) -signpass=password password of certificate -version=m.m.p package version (defaults to CMakeLists.txt setting) -binary=b binary version of package -ininame=filename name of the setup.ini (defaults to setup.ini) -packagename=s name of package (defaults to 'QGIS') -shortname=s shortname used for batch file (defaults to 'qgis') -mirror=s default mirror (defaults to 'http://download.osgeo.org/osgeo4w') -arch=s architecture (x86 or x86_64; defaults to 'x86_64') -help this help If no packages are given 'qgis-full' and it's dependencies will be retrieved and packaged. Packages with a appended '-' are excluded, but their dependencies are included. =cut |
再度、以下のコマンドを実行するとインストーラーが作成される
1 | perl creatensis.pl --verbose |
(6)インストーラのカスタマイズ
(6-1)起動を早くするためにインストールするプラグインを最小限にする
プラグインにはC++、Pythonで実装されたプラグインの2種類がある
C++プラグインを削除
「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-x86\apps\qgis-ltr\plugins」フォルダにはプラグインのDLL以外にもデータプロバイダー、その他の必要なDLLがあるので
*provider.dll、*method.dll以外を削除
Pythonプラグインを削除
QGIS-Installer.nsiのpython_plugins.nshのインクルードをコメント
1 2 3 4 5 6 7 8 | !ifndef INNER Section "QGIS" SecQGIS SectionIn RO ;Added by Tim to set the reg key so we get default plugin loading !include plugins.nsh ;Added by Tim to set the reg key so we get default python & py plugins !include python_plugins.nsh |
アンパックドフォルダ内のPythonプラグインを削除
C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-x86\apps\qgis-ltr\python\pluginsフォルダ内のフォルダを削除
以上でプラグインなしのインストーラーを作成する用意ができたので
再度、以下のコマンドを実行するとインストーラーが作成される
1 | perl creatensis.pl --verbose |
(6-2)QGISメニューやショートカットを作成しない
NSISファイル「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\QGIS-Installer.nsi」の以下の行を編集
編集前
1 | CreateDirectory "$SMPROGRAMS\${QGIS_BASE}" |
編集後
1 | ;CreateDirectory "$SMPROGRAMS\${QGIS_BASE}" |
「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\Installer-Files\postinstall.bat」から呼ばれるBATファイルを編集してメニューやショートカットを作成している個所をコメント
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 87 88 | @echo off if exist postinstall.log del postinstall.log set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT:\=/%>>postinstall.log 2>&1 if "%OSGEO4W_ROOT_MSYS:~1,1%"==":" set OSGEO4W_ROOT_MSYS=/%OSGEO4W_ROOT_MSYS:~0,1%/%OSGEO4W_ROOT_MSYS:~3%>>postinstall.log 2>&1 del preremove-conf.bat>>postinstall.log 2>&1 echo set OSGEO4W_ROOT=%OSGEO4W_ROOT%>>preremove-conf.bat echo set OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%>>preremove-conf.bat echo set OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%>>preremove-conf.bat echo set OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%>>preremove-conf.bat echo OSGEO4W_ROOT=%OSGEO4W_ROOT%>>postinstall.log 2>&1 echo OSGEO4W_ROOT_MSYS=%OSGEO4W_ROOT_MSYS%>>postinstall.log 2>&1 echo OSGEO4W_STARTMENU=%OSGEO4W_STARTMENU%>>postinstall.log 2>&1 echo OSGEO4W_DESKTOP=%OSGEO4W_DESKTOP%>>postinstall.log 2>&1 PATH %OSGEO4W_ROOT%\bin;%PATH%>>postinstall.log 2>&1 cd /d %OSGEO4W_ROOT%>>postinstall.log 2>&1 echo Running postinstall gdal-python.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\gdal-python.bat>>postinstall.log 2>&1 ren etc\postinstall\gdal-python.bat gdal-python.bat.done>>postinstall.log 2>&1 echo Running postinstall grass.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\grass.bat>>postinstall.log 2>&1 ren etc\postinstall\grass.bat grass.bat.done>>postinstall.log 2>&1 echo Running postinstall liblas.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\liblas.bat>>postinstall.log 2>&1 ren etc\postinstall\liblas.bat liblas.bat.done>>postinstall.log 2>&1 echo Running postinstall msvcrt2008.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\msvcrt2008.bat>>postinstall.log 2>&1 ren etc\postinstall\msvcrt2008.bat msvcrt2008.bat.done>>postinstall.log 2>&1 echo Running postinstall msvcrt2010.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\msvcrt2010.bat>>postinstall.log 2>&1 ren etc\postinstall\msvcrt2010.bat msvcrt2010.bat.done>>postinstall.log 2>&1 echo Running postinstall msvcrt2013.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\msvcrt2013.bat>>postinstall.log 2>&1 ren etc\postinstall\msvcrt2013.bat msvcrt2013.bat.done>>postinstall.log 2>&1 echo Running postinstall msvcrt2015.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\msvcrt2015.bat>>postinstall.log 2>&1 ren etc\postinstall\msvcrt2015.bat msvcrt2015.bat.done>>postinstall.log 2>&1 echo Running postinstall netcdf.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\netcdf.bat>>postinstall.log 2>&1 ren etc\postinstall\netcdf.bat netcdf.bat.done>>postinstall.log 2>&1 echo Running postinstall opencl.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\opencl.bat>>postinstall.log 2>&1 ren etc\postinstall\opencl.bat opencl.bat.done>>postinstall.log 2>&1 echo Running postinstall openssl.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\openssl.bat>>postinstall.log 2>&1 ren etc\postinstall\openssl.bat openssl.bat.done>>postinstall.log 2>&1 echo Running postinstall pyqt5.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\pyqt5.bat>>postinstall.log 2>&1 ren etc\postinstall\pyqt5.bat pyqt5.bat.done>>postinstall.log 2>&1 echo Running postinstall python-core.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\python-core.bat>>postinstall.log 2>&1 ren etc\postinstall\python-core.bat python-core.bat.done>>postinstall.log 2>&1 echo Running postinstall python3-setuptools.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\python3-setuptools.bat>>postinstall.log 2>&1 ren etc\postinstall\python3-setuptools.bat python3-setuptools.bat.done>>postinstall.log 2>&1 echo Running postinstall qgis-ltr-common.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\qgis-ltr-common.bat>>postinstall.log 2>&1 ren etc\postinstall\qgis-ltr-common.bat qgis-ltr-common.bat.done>>postinstall.log 2>&1 echo Running postinstall qgis-ltr-grass-plugin-common.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\qgis-ltr-grass-plugin-common.bat>>postinstall.log 2>&1 ren etc\postinstall\qgis-ltr-grass-plugin-common.bat qgis-ltr-grass-plugin-common.bat.done>>postinstall.log 2>&1 echo Running postinstall qgis-ltr-grass-plugin7.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\qgis-ltr-grass-plugin7.bat>>postinstall.log 2>&1 echo %errorlevel%>>postinstall.log 2>&1 echo ren qgis-ltr-grass-plugin7.bat >>postinstall.log 2>&1 ren etc\postinstall\qgis-ltr-grass-plugin7.bat qgis-ltr-grass-plugin7.bat.done>>postinstall.log 2>&1 echo %errorlevel%>>postinstall.log 2>&1 echo Running postinstall qgis-ltr.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\qgis-ltr.bat>>postinstall.log 2>&1 echo %errorlevel%>>postinstall.log 2>&1 echo ren qgis-ltr.bat >>postinstall.log 2>&1 ren etc\postinstall\qgis-ltr.bat qgis-ltr.bat.done>>postinstall.log 2>&1 echo %errorlevel%>>postinstall.log 2>&1 echo Running postinstall qt5-libs.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\qt5-libs.bat>>postinstall.log 2>&1 ren etc\postinstall\qt5-libs.bat qt5-libs.bat.done>>postinstall.log 2>&1 echo Running postinstall saga-ltr.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\saga-ltr.bat>>postinstall.log 2>&1 ren etc\postinstall\saga-ltr.bat saga-ltr.bat.done>>postinstall.log 2>&1 echo Running postinstall setup.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\setup.bat>>postinstall.log 2>&1 ren etc\postinstall\setup.bat setup.bat.done>>postinstall.log 2>&1 echo Running postinstall shell.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\shell.bat>>postinstall.log 2>&1 ren etc\postinstall\shell.bat shell.bat.done>>postinstall.log 2>&1 echo Running postinstall sip-qt5.bat...>>postinstall.log 2>&1 %COMSPEC% /c etc\postinstall\sip-qt5.bat>>postinstall.log 2>&1 ren etc\postinstall\sip-qt5.bat sip-qt5.bat.done>>postinstall.log 2>&1 ren postinstall.bat postinstall.bat.done>>postinstall.log 2>&1 |
C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-x86\etc\postinstall\grass.bat
編集前
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 | set ICON=%OSGEO4W_ROOT%\apps\grass\grass78\gui\icons\grass_osgeo.ico set BATCH=%OSGEO4W_ROOT%\bin\grass78.bat textreplace -std -t "%BATCH%" textreplace -std -t "%OSGEO4W_ROOT%"\apps\grass\grass-78\etc\fontcap if not %OSGEO4W_MENU_LINKS%==0 xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS 7.8.1.lnk" "%BATCH%" "--gui" \ "Launch GRASS GIS 7.8.1" 1 "%ICON%" if not %OSGEO4W_DESKTOP_LINKS%==0 xxmklink "%OSGEO4W_DESKTOP%\GRASS GIS 7.8.1.lnk" "%BATCH%" "--gui" \ "Launch GRASS GIS 7.8.1" 1 "%ICON%" rem run g.mkfontcap outside a GRASS session during rem an OSGeo4W installation for updating paths to fonts rem set gisbase set GISBASE=%OSGEO4W_ROOT%\apps\grass\grass78 rem set path to freetype dll and its dependencies set FREETYPEBASE=%OSGEO4W_ROOT%\bin;%OSGEO4W_ROOT%\apps\msys\bin;%GISBASE%\lib rem set dependencies to path set PATH=%FREETYPEBASE%;%PATH% rem GISRC must be set set GISRC=dummy rem run g.mkfontcap outside a GRASS session "%GISBASE%\bin\g.mkfontcap.exe" -o del "%BATCH%.tmpl |
編集後
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 | set ICON=%OSGEO4W_ROOT%\apps\grass\grass78\gui\icons\grass_osgeo.ico set BATCH=%OSGEO4W_ROOT%\bin\grass78.bat textreplace -std -t "%BATCH%" textreplace -std -t "%OSGEO4W_ROOT%"\apps\grass\grass-78\etc\fontcap REM if not %OSGEO4W_MENU_LINKS%==0 xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS 7.8.1.lnk" "%BATCH%" "--gui" \ "Launch GRASS GIS 7.8.1" 1 "%ICON%" REM if not %OSGEO4W_DESKTOP_LINKS%==0 xxmklink "%OSGEO4W_DESKTOP%\GRASS GIS 7.8.1.lnk" "%BATCH%" "--gui" \ "Launch GRASS GIS 7.8.1" 1 "%ICON%" rem run g.mkfontcap outside a GRASS session during rem an OSGeo4W installation for updating paths to fonts rem set gisbase set GISBASE=%OSGEO4W_ROOT%\apps\grass\grass78 rem set path to freetype dll and its dependencies set FREETYPEBASE=%OSGEO4W_ROOT%\bin;%OSGEO4W_ROOT%\apps\msys\bin;%GISBASE%\lib rem set dependencies to path set PATH=%FREETYPEBASE%;%PATH% rem GISRC must be set set GISRC=dummy rem run g.mkfontcap outside a GRASS session "%GISBASE%\bin\g.mkfontcap.exe" -o del "%BATCH%.tmpl |
C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-x86\etc\postinstall\qgis-ltr-grass-plugin7.bat
編集前
1 2 3 4 5 6 7 8 9 10 11 12 13 | textreplace -std -t bin\qgis-ltr-grass7.bat if "%OSGEO4W_DESKTOP%"=="" set OSGEO4W_DESKTOP=~$folder.common_desktop$ copy bin\qgis-ltr-bin.exe bin\qgis-ltr-bin-g7.exe copy bin\qgis-ltr-bin.vars bin\qgis-ltr-bin-g7.vars call "%OSGEO4W_ROOT%\bin\qgis-ltr-grass7.bat" --postinstall if not %OSGEO4W_MENU_LINKS%==0 mkdir "%OSGEO4W_STARTMENU%" if not %OSGEO4W_DESKTOP_LINKS%==0 mkdir "%OSGEO4W_DESKTOP%" if not %OSGEO4W_MENU_LINKS%==0 nircmd shortcut "%OSGEO4W_ROOT%\bin\qgis-ltr-bin-g7.exe" "%OSGEO4W_STARTMENU%" "QGIS Desktop 3.4.13 with GRASS 7.8.0" "" "" "" "" "~$folder.mydocuments$" if not %OSGEO4W_DESKTOP_LINKS%==0 nircmd shortcut "%OSGEO4W_ROOT%\bin\qgis-ltr-bin-g7.exe" "%OSGEO4W_DESKTOP%" "QGIS Desktop 3.4.13 with GRASS 7.8.0" "" "" "" "" "~$folder.mydocuments$" |
編集後
1 2 3 4 5 6 7 8 9 10 11 12 13 | textreplace -std -t bin\qgis-ltr-grass7.bat REM if "%OSGEO4W_DESKTOP%"=="" set OSGEO4W_DESKTOP=~$folder.common_desktop$ copy bin\qgis-ltr-bin.exe bin\qgis-ltr-bin-g7.exe copy bin\qgis-ltr-bin.vars bin\qgis-ltr-bin-g7.vars call "%OSGEO4W_ROOT%\bin\qgis-ltr-grass7.bat" --postinstall REM if not %OSGEO4W_MENU_LINKS%==0 mkdir "%OSGEO4W_STARTMENU%" REM if not %OSGEO4W_DESKTOP_LINKS%==0 mkdir "%OSGEO4W_DESKTOP%" REM if not %OSGEO4W_MENU_LINKS%==0 nircmd shortcut "%OSGEO4W_ROOT%\bin\qgis-ltr-bin-g7.exe" "%OSGEO4W_STARTMENU%" "QGIS Desktop 3.4.13 with GRASS 7.8.0" "" "" "" "" "~$folder.mydocuments$" REM if not %OSGEO4W_DESKTOP_LINKS%==0 nircmd shortcut "%OSGEO4W_ROOT%\bin\qgis-ltr-bin-g7.exe" "%OSGEO4W_DESKTOP%" "QGIS Desktop 3.4.13 with GRASS 7.8.0" "" "" "" "" "~$folder.mydocuments$" |
C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-x86\etc\postinstall\qgis-ltr.bat
編集前
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | textreplace -std -t bin\qgis-ltr.bat textreplace -std -t bin\qgis-ltr-designer.bat textreplace -std -t bin\python-qgis-ltr.bat REM get short path without blanks for %%i in ("%OSGEO4W_ROOT%") do set O4W_ROOT=%%~fsi if "%OSGEO4W_DESKTOP%"=="" set OSGEO4W_DESKTOP=~$folder.common_desktop$ call "%OSGEO4W_ROOT%\bin\qgis-ltr.bat" --postinstall if not %OSGEO4W_MENU_LINKS%==0 mkdir "%OSGEO4W_STARTMENU%" if not %OSGEO4W_DESKTOP_LINKS%==0 mkdir "%OSGEO4W_DESKTOP%" if not %OSGEO4W_MENU_LINKS%==0 nircmd shortcut "%O4W_ROOT%\bin\qgis-ltr-bin.exe" "%OSGEO4W_STARTMENU%" "QGIS Desktop 3.4.13" "" "" "" "" "~$folder.mydocuments$" if not %OSGEO4W_DESKTOP_LINKS%==0 nircmd shortcut "%O4W_ROOT%\bin\qgis-ltr-bin.exe" "%OSGEO4W_DESKTOP%" "QGIS Desktop 3.4.13" "" "" "" "" "~$folder.mydocuments$" if not %OSGEO4W_MENU_LINKS%==0 nircmd shortcut "%O4W_ROOT%\bin\nircmd.exe" "%OSGEO4W_STARTMENU%" "Qt Designer with QGIS 3.4.13 custom widgets" "exec hide """%OSGEO4W_ROOT%\bin\qgis-ltr-designer.bat"" "%O4W_ROOT%\apps\qgis-ltr\icons\QGIS.ico" "" "" "~$folder.mydocuments$" if not %OSGEO4W_DESKTOP_LINKS%==0 nircmd shortcut "%O4W_ROOT%\bin\nircmd.exe" "%OSGEO4W_DESKTOP%" "Qt Designer with QGIS 3.4.13 custom widgets" "exec hide %O4W_ROOT%\bin\qgis-ltr-designer.bat" "%O4W_ROOT%\apps\qgis-ltr\icons\QGIS.ico" "" "" "~$folder.mydocuments$" set OSGEO4W_ROOT=%OSGEO4W_ROOT:\=\\% textreplace -std -t "%O4W_ROOT%\apps\qgis-ltr\bin\qgis.reg" nircmd elevate "%WINDIR%\regedit" /s "%O4W_ROOT%\apps\qgis-ltr\bin\qgis.reg" del /s /q "%OSGEO4W_ROOT%\apps\qgis-ltr\python\*.pyc" exit /b 0 |
編集後
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 | echo qgis-ltr.bat 1 textreplace -std -t bin\qgis-ltr.bat textreplace -std -t bin\qgis-ltr-designer.bat textreplace -std -t bin\python-qgis-ltr.bat echo qgis-ltr.bat 2 REM get short path without blanks for %%i in ("%OSGEO4W_ROOT%") do set O4W_ROOT=%%~fsi REM if "%OSGEO4W_DESKTOP%"=="" set OSGEO4W_DESKTOP=~$folder.common_desktop$ echo qgis-ltr.bat 3 call "%OSGEO4W_ROOT%\bin\qgis-ltr.bat" --postinstall echo qgis-ltr.bat 4 if not %OSGEO4W_MENU_LINKS%==0 mkdir "%OSGEO4W_STARTMENU%" REM if not %OSGEO4W_DESKTOP_LINKS%==0 mkdir "%OSGEO4W_DESKTOP%" echo qgis-ltr.bat 5 REM if not %OSGEO4W_MENU_LINKS%==0 nircmd shortcut "%O4W_ROOT%\bin\qgis-ltr-bin.exe" "%OSGEO4W_STARTMENU%" "QGIS Desktop 3.4.13" "" "" "" "" "~$folder.mydocuments$" REM if not %OSGEO4W_DESKTOP_LINKS%==0 nircmd shortcut "%O4W_ROOT%\bin\qgis-ltr-bin.exe" "%OSGEO4W_DESKTOP%" "QGIS Desktop 3.4.13" "" "" "" "" "~$folder.mydocuments$" echo qgis-ltr.bat 6 REM if not %OSGEO4W_MENU_LINKS%==0 nircmd shortcut "%O4W_ROOT%\bin\nircmd.exe" "%OSGEO4W_STARTMENU%" "Qt Designer with QGIS 3.4.13 custom widgets" "exec hide """%OSGEO4W_ROOT%\bin\qgis-ltr-designer.bat"" "%O4W_ROOT%\apps\qgis-ltr\icons\QGIS.ico" "" "" "~$folder.mydocuments$" REM if not %OSGEO4W_DESKTOP_LINKS%==0 nircmd shortcut "%O4W_ROOT%\bin\nircmd.exe" "%OSGEO4W_DESKTOP%" "Qt Designer with QGIS 3.4.13 custom widgets" "exec hide %O4W_ROOT%\bin\qgis-ltr-designer.bat" "%O4W_ROOT%\apps\qgis-ltr\icons\QGIS.ico" "" "" "~$folder.mydocuments$" echo qgis-ltr.bat 7 set OSGEO4W_ROOT=%OSGEO4W_ROOT:\=\\% echo qgis-ltr.bat 8 textreplace -std -t "%O4W_ROOT%\apps\qgis-ltr\bin\qgis.reg" echo qgis-ltr.bat 9 nircmd elevate "%WINDIR%\regedit" /s "%O4W_ROOT%\apps\qgis-ltr\bin\qgis.reg" echo qgis-ltr.bat 10 del /s /q "%OSGEO4W_ROOT%\apps\qgis-ltr\python\*.pyc" echo qgis-ltr.bat 11 exit /b 0 |
C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-x86\etc\postinstall\saga-ltr.bat
編集前
1 2 3 4 5 6 7 | if "%OSGEO4W_DESKTOP%"=="" set OSGEO4W_DESKTOP=%ALLUSERSPROFILE%\Desktop if not %OSGEO4W_DESKTOP_LINKS%==0 mkdir "%OSGEO4W_DESKTOP%" if not %OSGEO4W_DESKTOP_LINKS%==0 nircmd shortcut "%OSGEO4W_ROOT%\bin\nircmd.exe" "%OSGEO4W_DESKTOP%" "SAGA GIS (2.3.2)" "exec hide ~q%OSGEO4W_ROOT%\bin\saga-ltr_gui.bat~q" "%OSGEO4W_ROOT%\apps\saga-ltr\saga_gui.exe" if not %OSGEO4W_MENU_LINKS%==0 mkdir "%OSGEO4W_STARTMENU%" if not %OSGEO4W_MENU_LINKS%==0 nircmd shortcut "%OSGEO4W_ROOT%\bin\nircmd.exe" "%OSGEO4W_STARTMENU%" "SAGA GIS (2.3.2)" "exec hide ~q%OSGEO4W_ROOT%\bin\saga-ltr_gui.bat~q" "%OSGEO4W_ROOT%\apps\saga-ltr\saga_gui.exe" |
編集後
1 2 3 4 5 6 7 | REM if "%OSGEO4W_DESKTOP%"=="" set OSGEO4W_DESKTOP=%ALLUSERSPROFILE%\Desktop REM if not %OSGEO4W_DESKTOP_LINKS%==0 mkdir "%OSGEO4W_DESKTOP%" REM if not %OSGEO4W_DESKTOP_LINKS%==0 nircmd shortcut "%OSGEO4W_ROOT%\bin\nircmd.exe" "%OSGEO4W_DESKTOP%" "SAGA GIS (2.3.2)" "exec hide ~q%OSGEO4W_ROOT%\bin\saga-ltr_gui.bat~q" REM "%OSGEO4W_ROOT%\apps\saga-ltr\saga_gui.exe" REM if not %OSGEO4W_MENU_LINKS%==0 mkdir "%OSGEO4W_STARTMENU%" REM if not %OSGEO4W_MENU_LINKS%==0 nircmd shortcut "%OSGEO4W_ROOT%\bin\nircmd.exe" "%OSGEO4W_STARTMENU%" "SAGA GIS (2.3.2)" "exec hide ~q%OSGEO4W_ROOT%\bin\saga-ltr_gui.bat~q" REM "%OSGEO4W_ROOT%\apps\saga-ltr\saga_gui.exe" |
C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-x86\etc\postinstall\setup.bat
編集前
1 2 3 | nircmd shortcut "%OSGEO4W_ROOT%\bin\nircmd.exe" "%OSGEO4W_STARTMENU%" "Setup" "exec hide ~q%OSGEO4W_ROOT%\bin\setup.bat~q" "%OSGEO4W_ROOT%\OSGeo4W.ico" textreplace -std -t bin/setup.bat textreplace -std -t bin/setup-test.bat |
編集後
1 2 3 | REM nircmd shortcut "%OSGEO4W_ROOT%\bin\nircmd.exe" "%OSGEO4W_STARTMENU%" "Setup" "exec hide ~q%OSGEO4W_ROOT%\bin\setup.bat~q" "%OSGEO4W_ROOT%\OSGeo4W.ico" textreplace -std -t bin/setup.bat textreplace -std -t bin/setup-test.bat |
C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-x86\etc\postinstall\shell.bat
編集前
1 2 3 4 | if not %OSGEO4W_MENU_LINKS%==0 mkdir "%OSGEO4W_STARTMENU%" if not %OSGEO4W_MENU_LINKS%==0 xxmklink "%OSGEO4W_STARTMENU%\OSGeo4W Shell.lnk" "%OSGEO4W_ROOT%\OSGeo4W.bat" " " \ "OSGeo for Windows command shell" 1 "%OSGEO4W_ROOT%\OSGeo4W.ico" if not %OSGEO4W_DESKTOP_LINKS%==0 mkdir "%OSGEO4W_DESKTOP%" if not %OSGEO4W_DESKTOP_LINKS%==0 xxmklink "%OSGEO4W_DESKTOP%\OSGeo4W Shell.lnk" "%OSGEO4W_ROOT%\OSGeo4W.bat" " " \ "OSGeo for Windows command shell" 1 "%OSGEO4W_ROOT%\OSGeo4W.ico" |
編集後
1 2 3 4 | REM if not %OSGEO4W_MENU_LINKS%==0 mkdir "%OSGEO4W_STARTMENU%" REM if not %OSGEO4W_MENU_LINKS%==0 xxmklink "%OSGEO4W_STARTMENU%\OSGeo4W Shell.lnk" "%OSGEO4W_ROOT%\OSGeo4W.bat" " " \ "OSGeo for Windows command shell" 1 "%OSGEO4W_ROOT%\OSGeo4W.ico" REM if not %OSGEO4W_DESKTOP_LINKS%==0 mkdir "%OSGEO4W_DESKTOP%" REM if not %OSGEO4W_DESKTOP_LINKS%==0 xxmklink "%OSGEO4W_DESKTOP%\OSGeo4W Shell.lnk" "%OSGEO4W_ROOT%\OSGeo4W.bat" " " \ "OSGeo for Windows command shell" 1 "%OSGEO4W_ROOT%\OSGeo4W.ico" |