From 089a5023fbbb6e06ae8314b9b2e27f500fada85a Mon Sep 17 00:00:00 2001 From: Hisataka Kasuga Date: Wed, 19 Apr 2023 00:14:39 +0900 Subject: [PATCH] Initial commit. --- .gitignore | 6 ++++ bin/Apache Archiva.url | 2 ++ bin/run-archiva.cmd | 12 +++++++ bin/run-pgcmd-local.cmd | 8 +++++ bin/run-pgcmd.cmd | 8 +++++ bin/run-pgcreatedb.cmd | 58 +++++++++++++++++++++++++++++++++ bin/run-pginit.cmd | 15 +++++++++ bin/run-pgserver-stop.cmd | 9 ++++++ bin/run-pgserver.cmd | 14 ++++++++ bin/start_py26.cmd | 13 ++++++++ bin/start_py27.cmd | 13 ++++++++ bin/start_vagrant.cmd | 12 +++++++ doc/postgresql.md | 26 +++++++++++++++ doc/readme.md | 67 +++++++++++++++++++++++++++++++++++++++ etc/env-app.cmd | 9 ++++++ etc/env-archiva.cmd | 4 +++ etc/env-jre8.cmd | 4 +++ etc/env-pgbase.cmd | 4 +++ etc/env-pglocal.cmd | 8 +++++ etc/env-proxy.cmd | 7 ++++ etc/pgpwfile | 1 + 21 files changed, 300 insertions(+) create mode 100644 .gitignore create mode 100644 bin/Apache Archiva.url create mode 100755 bin/run-archiva.cmd create mode 100755 bin/run-pgcmd-local.cmd create mode 100755 bin/run-pgcmd.cmd create mode 100755 bin/run-pgcreatedb.cmd create mode 100755 bin/run-pginit.cmd create mode 100755 bin/run-pgserver-stop.cmd create mode 100755 bin/run-pgserver.cmd create mode 100755 bin/start_py26.cmd create mode 100755 bin/start_py27.cmd create mode 100755 bin/start_vagrant.cmd create mode 100644 doc/postgresql.md create mode 100644 doc/readme.md create mode 100644 etc/env-app.cmd create mode 100644 etc/env-archiva.cmd create mode 100644 etc/env-jre8.cmd create mode 100644 etc/env-pgbase.cmd create mode 100644 etc/env-pglocal.cmd create mode 100644 etc/env-proxy.cmd create mode 100644 etc/pgpwfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9478251 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/Vagrant/ +/apache-*/ +/jdk8u*/ +/pgsql*/ +/doc/local-*.md +/etc/local-*.cmd diff --git a/bin/Apache Archiva.url b/bin/Apache Archiva.url new file mode 100644 index 0000000..2df2f91 --- /dev/null +++ b/bin/Apache Archiva.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=http://localhost:8080/#welcome diff --git a/bin/run-archiva.cmd b/bin/run-archiva.cmd new file mode 100755 index 0000000..c160adc --- /dev/null +++ b/bin/run-archiva.cmd @@ -0,0 +1,12 @@ +@echo off +setlocal + +call %~dp0..\etc\env-jre8.cmd +call %~dp0..\etc\env-archiva.cmd + +cd /d %ARCHIVA_HOME% + +call bin\archiva.bat console + +endlocal +pause diff --git a/bin/run-pgcmd-local.cmd b/bin/run-pgcmd-local.cmd new file mode 100755 index 0000000..06444b0 --- /dev/null +++ b/bin/run-pgcmd-local.cmd @@ -0,0 +1,8 @@ +@echo off +setlocal + +call %~dp0..\etc\env-pglocal.cmd + +start "postgres localhost:5432" /D %PGBASE% + +endlocal diff --git a/bin/run-pgcmd.cmd b/bin/run-pgcmd.cmd new file mode 100755 index 0000000..498c29b --- /dev/null +++ b/bin/run-pgcmd.cmd @@ -0,0 +1,8 @@ +@echo off +setlocal + +call %~dp0..\etc\env-pgbase.cmd + +start "postgres" /D %PGBASE% + +endlocal diff --git a/bin/run-pgcreatedb.cmd b/bin/run-pgcreatedb.cmd new file mode 100755 index 0000000..14287ca --- /dev/null +++ b/bin/run-pgcreatedb.cmd @@ -0,0 +1,58 @@ +@echo off +setlocal + +call %~dp0..\etc\env-pglocal.cmd + +:get_locale +set locale=1 +echo 1 unix(UTF-8) +echo 2 windows(CP932) +echo 3 C +echo q quit +echo locale: + +set /p locale= + +if "%locale%" equ "1" ( + set locale=ja_JP.UTF8 +) else if "%locale%" equ "2" ( + set locale=Japanese_Japan.932 +) else if "%locale%" equ "3" ( + set locale=C +) else if /I "%locale%" equ "q" ( + goto :end +) else ( + goto :get_locale +) + +:get_dbname +echo dbname: +set dbname= +set /p dbname= + +if "%dbname%" equ "" ( + goto :get_dbname +) + +:get_confirm +echo createdb -T template0 -E UTF8 -l %locale% -U %PGUSER% "%dbname%" +echo proceed? (y / n): + +set confirm= +set /p confirm= + +if /I "%confirm%" equ "y" ( + rem +) else if /I "%confirm%" equ "n" ( + goto :end +) else if /I "%confirm%" equ "q" ( + goto :end +) else ( + goto :get_confirm +) + +createdb -T template0 -E UTF8 -l %locale% -U %PGUSER% "%dbname%" + +:end +endlocal +pause diff --git a/bin/run-pginit.cmd b/bin/run-pginit.cmd new file mode 100755 index 0000000..f8395d0 --- /dev/null +++ b/bin/run-pginit.cmd @@ -0,0 +1,15 @@ +@echo off +setlocal + +call %~dp0..\etc\env-pglocal.cmd + +rem ### Initialize DB Cluster +if exist %PGDATA% ( + echo Already exists: %PGDATA% +) else ( + initdb -D %PGDATA% --encoding=UTF8 --locale=C --username=postgres --pwfile=%~dp0..\etc\pgpwfile + rem --auth-host=md5 +) + +endlocal +pause diff --git a/bin/run-pgserver-stop.cmd b/bin/run-pgserver-stop.cmd new file mode 100755 index 0000000..2782158 --- /dev/null +++ b/bin/run-pgserver-stop.cmd @@ -0,0 +1,9 @@ +@echo off +setlocal + +call %~dp0..\etc\env-pglocal.cmd + +pg_ctl -w -m immediate -D %PGBASE%\data stop + +endlocal +pause diff --git a/bin/run-pgserver.cmd b/bin/run-pgserver.cmd new file mode 100755 index 0000000..f11b51b --- /dev/null +++ b/bin/run-pgserver.cmd @@ -0,0 +1,14 @@ +@echo off +setlocal + +call %~dp0..\etc\env-pglocal.cmd + +rem ### Start PostgreSQL in background +rem ### Terminates after pause +rem pg_ctl -D %PGBASE%\data -l %PGBASE%\data\startup.log start + +rem ### Start PostgreSQL in foreground +postgres -D %PGBASE%\data + +endlocal +pause diff --git a/bin/start_py26.cmd b/bin/start_py26.cmd new file mode 100755 index 0000000..ed3cd75 --- /dev/null +++ b/bin/start_py26.cmd @@ -0,0 +1,13 @@ +@echo off +setlocal + +call %~dp0..\etc\env-app.cmd + +set PATH=%PY26DIR%;%PY26DIR%\Scripts;%PATH% + +rem craete shortcut +rem C:\Windows\System32\cmd.exe /A /Q /K %~0 + +start "Python 2.6" /D %PY26DIR% + +endlocal diff --git a/bin/start_py27.cmd b/bin/start_py27.cmd new file mode 100755 index 0000000..ae1ebd1 --- /dev/null +++ b/bin/start_py27.cmd @@ -0,0 +1,13 @@ +@echo off +setlocal + +call %~dp0..\etc\env-app.cmd + +set PATH=%PY27DIR%;%PY27DIR%\Scripts;%PATH% + +rem craete shortcut +rem C:\Windows\System32\cmd.exe /A /Q /K %~0 + +start "Python 2.7" /D %PY27DIR% + +endlocal diff --git a/bin/start_vagrant.cmd b/bin/start_vagrant.cmd new file mode 100755 index 0000000..e1b1cb9 --- /dev/null +++ b/bin/start_vagrant.cmd @@ -0,0 +1,12 @@ +@echo off +setlocal + +call %~dp0..\etc\env-app.cmd + +rem set PATH=%VAGRANTDIR%\bin;%PATH% + +rem C:\Windows\System32\cmd.exe /k cd %VAGRANTDIR% && C: + +start "Vagrant" /D %VAGRANTDIR% + +endlocal diff --git a/doc/postgresql.md b/doc/postgresql.md new file mode 100644 index 0000000..446d7f7 --- /dev/null +++ b/doc/postgresql.md @@ -0,0 +1,26 @@ +PostgreSQLのバージョンが変わったら +============================================================ + +共通 +------------------------------------------------------------ + +`env-pgbase.cmd`の`PGBASE`を編集する。 + + +新規の場合 +------------------------------------------------------------ + +`PGDATA=%PGBASE%\data` + +1. DBクラスタの初期化 `run-pginit.cmd` +2. サーバーの起動 `run-pgserver.cmd` +3. DBの作成 `run-pgcreatedb.cmd` + + +DBを引き継ぐ場合(マイナーアップデート) +------------------------------------------------------------ + + +DBを引き継ぐ場合(メジャーアップデート) +------------------------------------------------------------ + diff --git a/doc/readme.md b/doc/readme.md new file mode 100644 index 0000000..eea94f6 --- /dev/null +++ b/doc/readme.md @@ -0,0 +1,67 @@ +README +============================================================ + +ƒfƒBƒŒƒNƒgƒŠ\¬ +------------------------------------------------------------ + +- bin +- etc +- doc + +- apache-ant-1.10.13 + + https://ant.apache.org/bindownload.cgi + +- apache-maven-3.9.1 + + https://maven.apache.org/download.cgi + +- apache-archiva-2.2.10 + + https://archiva.apache.org/download.cgi + +- apache-archiva-var + +- pgsql-15.2 + + https://www.enterprisedb.com/download-postgresql-binaries + +- jdk8u362-b09-jre + + https://adoptium.net/temurin/releases + + +Ý’èƒtƒ@ƒCƒ‹ +------------------------------------------------------------ + +- env-archiva.cmd + + Apache Archiva + +- env-jre8.cmd + + Java SE 8 + +- env-pgbase.cmd + + PostgreSQL + +- env-pglocal.cmd + + PostgreSQL‚ðƒ[ƒJƒ‹‚Å‹N“®‚·‚邽‚߂̐ݒè + +- pgpwfile + + PostgreSQLƒf[ƒ^ƒx[ƒX‚̏‰ŠúŠÇ—ŽÒƒpƒXƒ[ƒh + +- env-app.cmd + + VagrantAPython2.6APython2.7‚̃pƒX + +- local-app.cmd + + `env-app.cmd`‚̏㏑‚«Ý’è + +- env-proxy.cmd + + ƒvƒƒLƒVÝ’è diff --git a/etc/env-app.cmd b/etc/env-app.cmd new file mode 100644 index 0000000..afc945a --- /dev/null +++ b/etc/env-app.cmd @@ -0,0 +1,9 @@ +@echo off + +set PY26DIR=%~dp0..\Python2.6 +set PY27DIR=%~dp0..\Python2.7 +set VAGRANTDIR=%~dp0..\Vagrant + +if exist %~dp0local-app.cmd ( + call %~dp0local-app.cmd +) diff --git a/etc/env-archiva.cmd b/etc/env-archiva.cmd new file mode 100644 index 0000000..69d1b39 --- /dev/null +++ b/etc/env-archiva.cmd @@ -0,0 +1,4 @@ +@echo off + +set ARCHIVA_HOME=%~dp0..\apache-archiva-2.2.10 +set ARCHIVA_BASE=%~dp0..\apache-archiva-var diff --git a/etc/env-jre8.cmd b/etc/env-jre8.cmd new file mode 100644 index 0000000..a302a97 --- /dev/null +++ b/etc/env-jre8.cmd @@ -0,0 +1,4 @@ +@echo off + +set JAVA_HOME=%~dp0..\jdk8u362-b09-jre +set PATH=%JAVA_HOME%\bin;%PATH% diff --git a/etc/env-pgbase.cmd b/etc/env-pgbase.cmd new file mode 100644 index 0000000..c5b083e --- /dev/null +++ b/etc/env-pgbase.cmd @@ -0,0 +1,4 @@ +@echo off + +set PGBASE=%~dp0..\pgsql-15.2 +set PATH=%PGBASE%\bin;%PATH% diff --git a/etc/env-pglocal.cmd b/etc/env-pglocal.cmd new file mode 100644 index 0000000..f41348f --- /dev/null +++ b/etc/env-pglocal.cmd @@ -0,0 +1,8 @@ +@echo off + +call %~dp0env-pgbase.cmd + +set PGDATA=%PGBASE%\data +set PGHOSTADDR=127.0.0.1 +set PGPORT=5432 +set PGUSER=postgres diff --git a/etc/env-proxy.cmd b/etc/env-proxy.cmd new file mode 100644 index 0000000..74b60cf --- /dev/null +++ b/etc/env-proxy.cmd @@ -0,0 +1,7 @@ +@echo off + +rem set PROXYUSER= +rem set PROXYPASS= +rem set PROXYSERVER=proxy.example.com:8080 +rem set http_proxy=http://%PROXYUSER%:%PROXYPASS%@%PROXYSERVER% +rem set https_proxy=http://%PROXYUSER%:%PROXYPASS%@%PROXYSERVER% diff --git a/etc/pgpwfile b/etc/pgpwfile new file mode 100644 index 0000000..bb55c59 --- /dev/null +++ b/etc/pgpwfile @@ -0,0 +1 @@ +postgres -- 2.24.4