.bat-files: move duplicated code to separate file

This commit is contained in:
Karlson2k
2016-04-05 14:14:46 +03:00
parent a7b0cf62a6
commit 7b3055f9d7
5 changed files with 79 additions and 86 deletions

View File

@@ -1,8 +1,8 @@
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
pkgname=filesystem
pkgver=2016.03
pkgrel=2
pkgver=2016.04
pkgrel=1
pkgdesc='Base filesystem'
arch=('i686' 'x86_64')
license=('BSD')
@@ -23,6 +23,7 @@ source=('bash.bash_logout'
'dot.inputrc'
'dot.profile'
'fstab'
'start_shell.cmd'
'mingw32_shell.bat'
'mingw64_shell.bat'
'msys2_shell.bat'
@@ -51,9 +52,10 @@ sha256sums=('6d651f6b0b2d173961a3fa21acd9d44c783ed9cd73a031687698c8b9ed1f6dee'
'b896abbbd7187184045e42e2646d4cb25f5484a27558f780137c7ec9ca9bdc47'
'50c3746d621e682e3560e1b37cc1ac5d988460064a20ed15f107c203ac5ad622'
'9620bdf1c82ea3f14c3553c44a2006ea61ff3f5a775a2a053130a59cc186daf5'
'91e1dc387c06af1f222df8fa067a335c15723a6af1eaefae303060083d193b98'
'41368f93b01436eb9a0ff978d751612adde1245e3eb1e69321dbf109463fd7a3'
'6afb20f651f340b3b45875177212979636eaae92f7fa9f85c5fdaec1ba76806a'
'5137f56e2bbdf51cca60f1f8033aeda7f383e3dc86b2ad0fa1c6b732b91866bc'
'147773db7cb87fe09f735b5f47ff0dc3e1ffb8bf3149a51636341f7f61feec11'
'fd6d475058e122823aa8665d8c8bf6bde251524fbba954c1f1c941c10ea46f7f'
'eae2795591117fd3d7665d94a7b1827e13176580bc5a16d65350c584df5aaa7e'
'7d6994d7caf52a459b562cfb0da1d758a4b7bca478d1df00de3a96686e59008e'
'91f1f918cf13deab0124082086e990786113b0e710dbda4678d8fc14905ad94d'
'c2f0bd7714f4909c8be30217e6f68929ab5ea2856ebb04663e9e709cc35416d5'
@@ -108,6 +110,7 @@ package() {
install -m644 ${srcdir}/profile.lang.sh etc/profile.d/lang.sh
install -m644 ${srcdir}/msys2.ico msys2.ico
install -m755 ${srcdir}/start_shell.cmd start_shell.cmd
install -m755 ${srcdir}/msys2_shell.bat msys2_shell.bat
install -m755 ${srcdir}/mingw32_shell.bat mingw32_shell.bat
install -m755 ${srcdir}/mingw64_shell.bat mingw64_shell.bat

View File

@@ -1,12 +1,6 @@
:
@echo off
set "WD=%__CD__%"
if NOT EXIST "%WD%msys-2.0.dll" set "WD=%~dp0usr\bin\"
set MSYSTEM=MINGW32
rem To activate windows native symlinks uncomment next line
rem set MSYS=winsymlinks:nativestrict
@@ -16,25 +10,5 @@ rem set MSYS=error_start:%WD%../../mingw32/bin/qtcreator.exe^|-debug^|^<process-
rem To export full current PATH from environment into MSYS2 uncomment next line
rem set SET_FULL_PATH=1
if "x%~1" == "x-consolez" shift& set MSYSCON=console.exe
if "x%~1" == "x-mintty" shift& set MSYSCON=mintty.exe
if "x%MSYSCON%" == "xmintty.exe" goto startmintty
if "x%MSYSCON%" == "xconsole.exe" goto startconsolez
if NOT EXIST "%WD%mintty.exe" goto startsh
set MSYSCON=mintty.exe
:startmintty
start "%MSYSTEM%" "%WD%mintty" -i /msys2.ico /usr/bin/bash --login %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
:startconsolez
cd %WD%..\lib\ConsoleZ
start console -t "MinGW" -r %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
:startsh
start "%MSYSTEM%" "%WD%sh" --login -i %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
call "%~dp0start_shell.cmd" -mingw32 %*
:EOF

View File

@@ -1,12 +1,6 @@
:
@echo off
set "WD=%__CD__%"
if NOT EXIST "%WD%msys-2.0.dll" set "WD=%~dp0usr\bin\"
set MSYSTEM=MINGW64
rem To activate windows native symlinks uncomment next line
rem set MSYS=winsymlinks:nativestrict
@@ -16,25 +10,5 @@ rem set MSYS=error_start:%WD%../../mingw64/bin/qtcreator.exe^|-debug^|^<process-
rem To export full current PATH from environment into MSYS2 uncomment next line
rem set SET_FULL_PATH=1
if "x%~1" == "x-consolez" shift& set MSYSCON=console.exe
if "x%~1" == "x-mintty" shift& set MSYSCON=mintty.exe
if "x%MSYSCON%" == "xmintty.exe" goto startmintty
if "x%MSYSCON%" == "xconsole.exe" goto startconsolez
if NOT EXIST "%WD%mintty.exe" goto startsh
set MSYSCON=mintty.exe
:startmintty
start "%MSYSTEM%" "%WD%mintty" -i /msys2.ico /usr/bin/bash --login %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
:startconsolez
cd %WD%..\lib\ConsoleZ
start console -t "MinGW" -r %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
:startsh
start "%MSYSTEM%" "%WD%sh" --login -i %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
call "%~dp0start_shell.cmd" -mingw64 %*
:EOF

View File

@@ -1,12 +1,6 @@
:
@echo off
set "WD=%__CD__%"
if NOT EXIST "%WD%msys-2.0.dll" set "WD=%~dp0usr\bin\"
set MSYSTEM=MSYS
rem To activate windows native symlinks uncomment next line
rem set MSYS=winsymlinks:nativestrict
@@ -16,25 +10,5 @@ rem set MSYS=error_start:%WD%../../mingw32/bin/qtcreator.exe^|-debug^|^<process-
rem To export full current PATH from environment into MSYS2 uncomment next line
rem set SET_FULL_PATH=1
if "x%~1" == "x-consolez" shift& set MSYSCON=console.exe
if "x%~1" == "x-mintty" shift& set MSYSCON=mintty.exe
if "x%MSYSCON%" == "xmintty.exe" goto startmintty
if "x%MSYSCON%" == "xconsole.exe" goto startconsolez
if NOT EXIST "%WD%mintty.exe" goto startsh
set MSYSCON=mintty.exe
:startmintty
start "%MSYSTEM%" "%WD%mintty" -i /msys2.ico /usr/bin/bash --login %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
:startconsolez
cd %WD%..\lib\ConsoleZ
start console -t "MSys2" -r %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
:startsh
start "%MSYSTEM%" "%WD%sh" --login -i %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
call "%~dp0start_shell.cmd" -msys %*
:EOF

View File

@@ -0,0 +1,68 @@
@echo off
set "WD=%__CD__%"
if NOT EXIST "%WD%msys-2.0.dll" set "WD=%~dp0usr\bin\"
rem To activate windows native symlinks uncomment next line
rem set MSYS=winsymlinks:nativestrict
rem Set debugging program for errors
rem set MSYS=error_start:%WD%../../mingw64/bin/qtcreator.exe^|-debug^|^<process-id^>
rem To export full current PATH from environment into MSYS2 uncomment next line
rem set SET_FULL_PATH=1
:checkparams
rem Shell types
if "x%~1" == "x-msys" shift& set MSYSTEM=MSYS& goto :checkparams
if "x%~1" == "x-msys2" shift& set MSYSTEM=MSYS& goto :checkparams
if "x%~1" == "x-mingw32" shift& set MSYSTEM=MINGW32& goto :checkparams
if "x%~1" == "x-mingw64" shift& set MSYSTEM=MINGW64& goto :checkparams
if "x%~1" == "x-mingw" shift& (
if exist "%WD%..\..\mingw64" (set MSYSTEM=MINGW64) else (set MSYSTEM=MINGW32)
)& goto :checkparams
rem Console types
if "x%~1" == "x-consolez" shift& set MSYSCON=console.exe& goto :checkparams
if "x%~1" == "x-mintty" shift& set MSYSCON=mintty.exe& goto :checkparams
if "x%~1" == "x-defterm" shift& set MSYSCON=defterm& goto :checkparams
rem Autodetect shell type if not specified
if not defined MSYSTEM (
if exist "%WD%..\..\mingw64" (
set MSYSTEM=MINGW64
) else if exist "%WD%..\..\mingw32" (
set MSYSTEM=MINGW32
) else (set MSYSTEM=MSYS)
)
rem Setup proper title
if "%MSYSTEM%" == "MSYS" (
set CONTITLE=MSys2
) else if "%MSYSTEM%" == "MINGW32" (
set "CONTITLE=MinGW x32"
) else if "%MSYSTEM%" == "MINGW64" (
set "CONTITLE=MinGW x64"
)
if "x%MSYSCON%" == "xmintty.exe" goto startmintty
if "x%MSYSCON%" == "xconsole.exe" goto startconsolez
if "x%MSYSCON%" == "xdefterm" goto startsh
if NOT EXIST "%WD%mintty.exe" goto startsh
set MSYSCON=mintty.exe
:startmintty
start "%CONTITLE%" "%WD%mintty" -i /msys2.ico /usr/bin/bash --login %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
:startconsolez
cd %WD%..\lib\ConsoleZ
start console -t "%CONTITLE%" -r %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
:startsh
set MSYSCON=
start "%CONTITLE%" "%WD%bash" --login %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %ERRORLEVEL%
:EOF