QWidget上にQToolbarを配置するとQToolbarが黒く表示されることがある
色を設定するにはQToolbarのsetStyleSheetを使用
toolbar = QToolBar(親のWidget)
toolbar.setStyleSheet(“background-color: rgb(240, 240, 240)”)
QWidget上にQToolbarを配置するとQToolbarが黒く表示されることがある
色を設定するにはQToolbarのsetStyleSheetを使用
toolbar = QToolBar(親のWidget)
toolbar.setStyleSheet(“background-color: rgb(240, 240, 240)”)
タグを追加
git tag -a タグ名 -m "コメント"
タグをリモートリポジトリに反映
git push origin --tag
タグの一覧
git tag
予めVisualCodeをインストール
C:\Users\ユーザー名\.gitconfigを開いて以下を追加
[core] quotepath = off editor = "code --wait"
git reset --soft HEAD^
※softをhardにすると作業ディレクトリの内容もロールバックされる
git reset --soft ハッシュ値
ハッシュ値はgit logで確認
git push -f origin master
git checkout .
QgsFillSymbolはポリゴンレイヤのシンボルとして使用する
QgsFillSymbolのインスタンスは通常QgsFillSymbolクラスのstaticな関数createSimpleで作成
kvs = {} # 内部色 kvs['color'] = '0,0,0,0' # 線色 kvs['outline_color'] = '255,0,0,255' # 線幅 kvs['outline_width'] = '1' # インスタンス作成 fillSymbol= QgsFillSymbol.createSimple(kvs)
QgsFillSymbolのデフォルトの線幅の単位はミリメートルのためピクセル値で幅を設定するには単位をピクセルに設定する
kvs['outline_width_unit'] = '1'
単位の定数
enum RenderUnit { RenderMillimeters = 0, //!< Millimeters RenderMapUnits, //!< Map units RenderPixels, //!< Pixels RenderPercentage, //!< Percentage of another measurement (e.g., canvas size, feature size) RenderPoints, //!< Points (e.g., for font sizes) RenderInches, //!< Inches RenderUnknownUnit, //!< Mixed or unknown units RenderMetersInMapUnits, //!< Meters value as Map units };
ちなみにQGISではdpi=96なので25.4mm=96pix、よって1pixは0.26mm
※outline_widthのデフォルト値はqgis.hのDEFAULT_LINE_WIDTHであり0.26
git log
git log -1
git log -1 --name-only
git reset --soft HEAD~
HEAD~とHEAD^は同じ
git reset --hard HEAD~
QgsTextAnnotationはQgsAnnotationから派生された地図上の注釈クラス
QgsMapToolAnnotationクラスのC++ソースを参考にPythonでQgsTextAnnotationをMapCanvas上に追加する
間違ったコード
txt = QTextDocument('HELLO\r\nHELLO') annotation = QgsTextAnnotation() annotation.setDocument(txt) mapPos = QgsPointXY(138.9776,35.6712) annotation.setMapPosition(mapPos) annotation.setMapPositionCrs(iface.mapCanvas().mapSettings().destinationCrs()) annotation.setRelativePosition(QPointF(0, 0)) #annotation.setFrameSize(QSize(100, 50)) annotation.setFrameSize(txt.size()) annotationManager = QgsProject.instance().annotationManager() annotationManager.addAnnotation(annotation)
※setMapPositionには緯度、経度をセットしているが必要があればMapCanvasのDestinationCrsの座標系に変換が行う。
全てのAnnotationはQgsAnnotationManagerのannotationsに入っている
annotations= QgsProject.instance().annotationManager().annotations() for annotation in annotations : print(annotation.document().toPlainText())
座標を指定してMapCanvas上のAnnotationを照会するにはMapCanvasのitemsを使用する
items = iface.mapCanvas().items(QPoint(10,10)) for item in items : if item.__class__.__name__ == 'QgsMapToolAnnotation' : print(item.document().toPlainText())
ところがここでitemsにQgsMapToolAnnotationが存在しない。
全てがQGraphicsItemになっている
どうやらPythonでQgsAnnotationをMapCanvasに追加するには「annotationManager.addAnnotation」ではなく
「QgsMapCanvasAnnotationItem」を使うみたい
正しいコード
txt = QTextDocument('HELLO\r\nHELLO') annotation = QgsTextAnnotation() annotation.setDocument(txt) mapPos = QgsPointXY(138.9776,35.6712) annotation.setMapPosition(mapPos) annotation.setMapPositionCrs(iface.mapCanvas().mapSettings().destinationCrs()) #annotation.setRelativePosition(QPointF(0, 0)) annotation.setFrameOffsetFromReferencePoint(QtCore.QPointF(30, 30)) #annotation.setFrameSize(QSize(100, 50)) annotation.setFrameSize(txt.size()) i = QgsMapCanvasAnnotationItem(annotation, iface.mapCanvas())
setRelativePositionではなく、setFrameOffsetFromReferencePointを使用して吹き出しの位置を設定
参考
久しぶりにGeoServerを起動しようとしたら、またもTOMCATが起動しない。
ということでJREのバージョンアップを確認。
現行のJREの情報
イベントビューアーを確認すると11/05にJREが更新されており、バージョンが「jre1.8.0_191」に更新されている。
よってJAVA_HOMEを「C:\Program Files\Java\jre1.8.0_151\bin」から「C:\Program Files\Java\jre1.8.0_191\bin」に変更
「C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\Tomcat7w.exe」を起動してJREの設定を変更
「C:\Program Files\Java\jre1.8.0_151\bin\server\jvm.dll」を「C:\Program Files\Java\jre1.8.0_191\bin\server\jvm.dll」に変更
以上、PCを再起動して終了
複数のPythonプラグインから呼ばれるユーザーライブラリを作成する
「C:\OSGeo4W\apps\Python37\lib」フォルダに「mylibs」フォルダを作成
mylibsフォルダには空の__init__.pyファイルと関数、クラスを定義したmyfunc.pyファイルを作成
__init__.py
# -*- coding: utf-8 -*- """ __init__.py """
myfunc.py
# -*- coding: utf-8 -*- def myproc(): print('Hello') class MyClass: def __init__(self): self.name = 'Hello' def print_name(self): print(self.name)
QGISのPythonコンソールからの呼び出し
from test import myfunc mc = MyClass() from test.myfunc import MyClass c = MyClass() c.print_name()
「QGISをインストールしたいがWindowsのメニューには表示したくない」などの要求に対応するためにQGISインストーラーをカスタマイズ
QGISにはインストーラーをパッケージするスクリプト「creatensis.pl」がある
最初にcreatensis.plの動作環境を構築してインストーラーの作成プロセスを確認
その後インストーラーをカスタイマイズする
※creatensis.plは最新のモジュールをQGISサーバーからダウンロードしてインストーラーをパッケージするため特定のバージョンのインストーラーは作成できない
NSISをインストールして、makensis.exeのあるフォルダにPATHを通す
cygwinはCドライブ直下にインストール
ダウンロード対象のバージョンのQGISをダウンロード
cygwinのhome直下にディレクトリsetupを作成しダウンロードしたZIPファイルを展開
展開したsetup/QGIS-release-3_4/ms-windows/osgeo4wディレクトリにあるcreatensis.plを開き
$archに対象のアーキテクチャーを設定
64bitの時
my $arch = "x86_64";
32bitの時
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」に移動
以下のコマンドを実行するとインストーラーが作成される
perl creatensis.pl --verbose
(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を渡してインストーラーを作成
以上
上述の通り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からファイルのダウンロード箇所をコメントアウト
#!/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
再度、以下のコマンドを実行するとインストーラーが作成される
perl creatensis.pl --verbose
プラグインにはC++、Pythonで実装されたプラグインの2種類がある
「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\osgeo4w\unpacked-x86\apps\qgis-ltr\plugins」フォルダにはプラグインのDLL以外にもデータプロバイダー、その他の必要なDLLがあるので
*provider.dll、*method.dll以外を削除
QGIS-Installer.nsiのpython_plugins.nshのインクルードをコメント
!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フォルダ内のフォルダを削除
以上でプラグインなしのインストーラーを作成する用意ができたので
再度、以下のコマンドを実行するとインストーラーが作成される
perl creatensis.pl --verbose
NSISファイル「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\QGIS-Installer.nsi」の以下の行を編集
編集前
CreateDirectory "$SMPROGRAMS\${QGIS_BASE}"
編集後
;CreateDirectory "$SMPROGRAMS\${QGIS_BASE}"
「C:\cygwin64\home\tarumi\setup\QGIS-release-3_4\ms-windows\Installer-Files\postinstall.bat」から呼ばれるBATファイルを編集してメニューやショートカットを作成している個所をコメント
@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
編集前
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
編集後
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
編集前
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$"
編集後
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
編集前
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
編集後
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
編集前
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"
編集後
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
編集前
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
編集後
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
編集前
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"
編集後
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"