msys2-installer: Split into its own repository -- https://github.com/msys2/msys2-installer

This commit is contained in:
David Macek
2017-02-05 12:35:44 +01:00
parent 74f9468ce4
commit e18d7bc4bb
11 changed files with 0 additions and 405 deletions

View File

@@ -1,78 +0,0 @@
// Run with:
// ./msys2-x86_64-$(date +'%Y%m%d').exe --platform minimal --script auto-install.js -v
// Currently it gets stuck on the last page.
// To see graphically what's happening, remove "--platform minimal"
function Controller()
{
print("(print) Hello Installer World!\n");
console.log("(console.log) Hello Installer World!\n");
installer.setDefaultPageVisible(QInstaller.Introduction, true);
installer.setDefaultPageVisible(QInstaller.TargetDirectory, false);
var page = gui.pageWidgetByObjectName( "ComponentSelectionPage" );
page.selectComponent( "com.msys2.root" );
page.selectComponent( "com.msys2.root.base" );
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false);
installer.setDefaultPageVisible(QInstaller.PerformInstallation, true);
installer.setDefaultPageVisible(QInstaller.InstallationFinished, true);
installer.setDefaultPageVisible(QInstaller.FinishedPage, true);
ComponentSelectionPage.selectAll();
installer.autoRejectMessageBoxes();
var result = QMessageBox.question("quit.question", "Installer", "Do you want to quit the installer?",
QMessageBox.Yes | QMessageBox.No);
console.log("(console.log) result " + result);
installer.setDefaultPageVisible(QInstaller.TargetDirectory, false);
installer.setMessageBoxAutomaticAnswer("OverwriteTargetDirectory", QMessageBox.Yes);
installer.setMessageBoxAutomaticAnswer("stopProcessesForUpdates", QMessageBox.Ignore);
}
Controller.prototype.IntroductionPageCallback = function()
{
gui.clickButton(buttons.NextButton);
}
Controller.prototype.PerformInstallationPageCallback = function()
{
var page = gui.pageWidgetByObjectName("PerformInstallationPage");
installer.setAutomatedPageSwitchEnabled(true);
gui.clickButton(buttons.NextButton);
}
Controller.prototype.InstallationFinishedPageCallback = function()
{
console.log("(console.log) InstallationFinishedPageCallback ");
var checkBox = gui.pageWidgetByObjectName("RunItCheckBox");
console.log("typeof checkBox is " + typeof checkBox);
assert(typeof checkBox === 'object');
var page = gui.pageWidgetByObjectName("InstallationFinishedPage");
gui.clickButton(buttons.NexthButton);
}
Controller.prototype.FinishedPageCallback = function()
{
console.log("(console.log) FinishedPageCallback ");
// var checkBox = gui.pageWidgetByObjectName("RunItCheckBox");
// console.log("typeof checkBox is " + typeof checkBox);
// assert(typeof checkBox === 'object');
var page = gui.pageWidgetByObjectName("FinishedPage");
page.RunItCheckBox.checked = false;
gui.clickButton(buttons.FinishButton);
}
/*
Controller.prototype.ComponentSelectionPageCallback = function()
{
var page = gui.pageWidgetByObjectName( "ComponentSelectionPage" )
page.deselectComponent( "com.nokia.ndk.tools.maemo.usbdriver" )
gui.clickButton( buttons.NextButton )
}
*/

View File

@@ -1,32 +0,0 @@
#!/usr/bin/env bash
_arch=$(uname -m)
_date=$(date +'%Y%m%d')
_filename=${_arch}-msys2-${_date}.tar.xz
_log=/tmp/compress.log
echo "Creating MSYS2 archive /tmp/$_filename"
if [ -f /tmp/$_filename ]; then
rm -f /tmp/$_filename
fi
_dirs=
for curr_dir in /etc /include /lib /libexec /sbin /share /ssl /tmp /usr /var /msys2.ico /msys2_shell.cmd; do
if [[ -d $curr_dir || -f $curr_dir ]]; then
_dirs="$_dirs $curr_dir"
fi
done
if [ -n "$_dirs" ]; then
_compress_cmd="/usr/bin/tar --transform='s/:/_/g' --dereference --hard-dereference -cvJf /tmp/${_filename} $_dirs -X /etc/compress_exclude"
cd /
eval ${_compress_cmd} | tee $_log 2>&1
_result=$?
if [ "$_result" -eq "0" ]; then
echo " done"
else
die "MSYS2 compressing fail. See $_log"
fi
fi
exit 0

View File

@@ -1,13 +0,0 @@
/etc/postinstall/postinstall.marker
/etc/group
/etc/passwd
/etc/mtab
/etc/fstab
/etc/hosts
/etc/networks
/etc/protocols
/etc/services
/home/*
/dev/*
/tmp/*
/var/tmp/*

View File

@@ -1,149 +0,0 @@
#!/usr/bin/env bash
_thisdir="$(dirname $0)"
test "${_thisdir}" = "." && _thisdir=${PWD}
_ifwroot="${_thisdir}"/qt-ifw
_arch=$(uname -m)
_date=$(date +'%Y%m%d')
_dateqif=$(date +'%Y-%m-%d')
_version=${_date}
_filename=msys2-${_arch}-${_date}.exe
_filename2=msys2-base-${_arch}-${_date}.tar.xz
_log=/tmp/installer-${_arch}-${_date}.log
if [ "${_arch}" = "x86_64" ]; then
_bitness=64
else
_bitness=32
fi
_archivegen=/mingw${_bitness}/bin/archivegen.exe
_binarycreator=/mingw${_bitness}/bin/binarycreator.exe
_installerbase=/mingw${_bitness}/bin/installerbase.exe
_newmsysbase=/tmp/newmsys
_newmsys=${_newmsysbase}/msys"${_bitness}"
declare -a undo_commands
_exitcode=5
exit_with_undo() {
for _cmd in ${undo_commands[@]}; do
eval "${_cmd}" | tee -a ${_log}
done
exit ${_exitcode}
}
exit_cleanly() {
_exitcode=$1; shift;
local _message=$1; shift;
echo "${_message}" | tee -a ${_log}
exit_with_undo
}
do_seds() {
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" \) -exec sed -i "s|@DATE@|${_dateqif}|g" "{}" \;
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" \) -exec sed -i "s|@VERSION@|${_version}|g" "{}" \;
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" -or -name "installscript.js" \) -exec sed -i "s|@BITNESS@|${_bitness}|g" "{}" \;
undo_commands+=("undo_seds")
}
undo_seds() {
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" \) -exec sed -i "s|<ReleaseDate>${_dateqif}<|<ReleaseDate>@DATE@<|g" "{}" \;
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" \) -exec sed -i "s|<Version>${_version}<|<Version>@VERSION@<|g" "{}" \;
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" -or -name "installscript.js" \) -exec sed -i "s|msys${_bitness}|msys@BITNESS@|g" "{}" \;
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" -or -name "installscript.js" \) -exec sed -i "s|${_bitness}bit|@BITNESS@bit|g" "{}" \;
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" -or -name "installscript.js" \) -exec sed -i "s|if (\"@BITNESS@bit\" === \"@BITNESS@bit\")|if (\"@BITNESS@bit\" === \"32bit\")|g" "{}" \;
}
create_archives() {
local _data="${_ifwroot}"/packages/com.msys2.root.base/data
[ -d "${_data}" ] && rm -rf "${_data}"
mkdir -p "${_data}"
local _dirs=
for curr_dir in /etc /var /tmp /usr /mingw32 /mingw64 /msys2_shell.cmd /msys2.exe /mingw32.exe /mingw64.exe /msys2.ini /mingw32.ini /mingw64.ini /msys2.ico /autorebase.bat autorebasebase1st.bat; do
if [[ -d ${_newmsys}${curr_dir} || -f ${_newmsys}${curr_dir} ]]; then
_dirs="${_dirs} ${_newmsys}$curr_dir"
fi
done
if [ -n "${_dirs}" ]; then
local _compress_cmd="${_archivegen} ${_data}/msys${_bitness}.7z ${_dirs}"
pushd / > /dev/null
echo "Run: ${_compress_cmd} ..." | tee -a ${_log}
eval "${_compress_cmd}" 2>&1 | tee -a ${_log}
_result=$?
if [ "${_result}" -eq "0" ]; then
echo " archivegen succeeded. Created ${_data}/msys${_bitness}.7z" | tee -a ${_log}
else
exit_cleanly "3" "archivegen failed. See ${_log}"
fi
popd > /dev/null
pushd ${_newmsysbase} > /dev/null
local _compress_cmd2="/usr/bin/tar --transform='s/:/_/g' --dereference --hard-dereference -cJf ${_thisdir}/${_filename2} msys${_bitness}"
echo "Run: ${_compress_cmd2} ..." | tee -a ${_log}
eval "${_compress_cmd2}" 2>&1 | tee -a ${_log}
_result=$?
if [ "${_result}" -eq "0" ]; then
echo " tar succeeded. Created " | tee -a ${_log}
else
die "MSYS2 compressing fail. See ${_log}"
fi
popd > /dev/null
fi
}
# Add -v to get more information.
make_installer() {
eval "\"${_binarycreator}\" \
-t \"${_installerbase}\" \
-p \"${_ifwroot}/packages\" \
-c \"${_ifwroot}/config/config.xml\" \
--offline-only \
\"${_filename}\" \
-v" | tee -a ${_log}
}
trap exit_with_undo 1 2 15
create_chroot_system() {
[ -d ${_newmsysbase} ] && rm -rf ${_newmsysbase}
mkdir -p "${_newmsys}"
pushd "${_newmsys}" > /dev/null
mkdir -p var/lib/pacman
mkdir -p var/log
mkdir -p tmp
eval "pacman -Syu --root \"${_newmsys}\"" | tee -a ${_log}
eval "pacman -S base --noconfirm --root \"${_newmsys}\"" | tee -a ${_log}
_result=$?
if [ "${_result}" -ne "0" ]; then
exit_cleanly "1" "failed to create newmsys2 via command 'pacman -S base --noconfirm --root ${_newmsys}'"
fi
popd > /dev/null
}
if [ ! -f "${_archivegen}" ]; then
eval "pacman -S --noconfirm mingw${_bitness}/mingw-w64-${_arch}-qt-installer-framework-git" | tee -a ${_log}
fi
if [ ! -f "${_archivegen}" ]; then
exit_cleanly "2" "installation of qt installer framework failed. See ${_log}"
fi
if [ -f "${_log}" ]; then
rm "${_log}"
fi
echo "Creating MSYS2 chroot system ${_newmsys}" | tee -a ${_log}
create_chroot_system
echo "Creating MSYS2 installer /tmp/${_filename}" | tee -a ${_log}
if [ -f /tmp/${_filename} ]; then
rm -f /tmp/${_filename}
fi
do_seds
create_archives
make_installer
exit_cleanly "0" "All done, see ${_filename}"

View File

@@ -1,52 +0,0 @@
@echo off
REM Copyright (c) 2014, Ray Donnelly <mingw.android@gmail.com>
if "%1"=="" (
echo Please re-run, passing the the location of an existing MSYS2 installation
exit /b 1
)
if not exist %1\msys2_shell.cmd (
echo '%1' does not seem to be the root folder of an existing MSYS2 installation?!
exit /b 2
)
set "NEWMSYS=%CD:\=/%/newmsys/msys64"
set "NEWMSYSW=%CD%\newmsys\msys64"
echo.
echo ***********
echo * Warning *
echo ***********
echo.
echo This batch file will sync (forcibly) the 'base' group of the MSYS2 installation in '%1'
<nul set /p =.. Do you want to proceed?
choice /N
if "%errorlevel%"=="1" (
echo.
) else (
exit /b 0
)
REM set "PATH=%1\bin;%PATH%"
echo Updating 'base' group of the existing MSYS2 installation
pushd %1
REM %1\bin\bash -l -c "pacman -S base --force --noconfirm" | more /E /P
timeout 1 > NUL
popd
echo Creating new MSYS2 installation containing only 'base'
timeout 1 > NUL
pushd %1
mkdir %NEWMSYSW%\var\lib\pacman
echo bin\bash -l -c "pacman -Syu --root %NEWMSYS%"
bin\bash -l -c "pacman -Syu --root %NEWMSYS%"
exit /b 999
%1\bin\bash -l -c "pacman -S pacman --root %NEWMSYS%"
%1\bin\bash -l -c "pacman -S base --force --root %NEWMSYS%" | more /E /P
timeout 1 > NUL
popd
exit /b 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>MSYS2 @BITNESS@bit</Name>
<Version>@VERSION@</Version>
<Title>MSYS2 @BITNESS@bit</Title>
<Publisher>The MSYS2 Developers</Publisher>
<StartMenuDir>MSYS2 @BITNESS@bit</StartMenuDir>
<RunProgram>@TargetDir@/msys2_shell.cmd</RunProgram>
<RunProgramArguments></RunProgramArguments>
<InstallerApplicationIcon>../../msys2</InstallerApplicationIcon>
<InstallerWindowIcon>../../msys2</InstallerWindowIcon>
</Installer>

View File

@@ -1,38 +0,0 @@
function Component()
{
// constructor
}
Component.prototype.isDefault = function()
{
// select the component by default
return true;
}
function createShortcuts()
{
var windir = installer.environmentVariable("WINDIR");
if (windir === "") {
QMessageBox["warning"]( "Error" , "Error", "Could not find windows installation directory");
return;
}
var cmdLocation = installer.value("TargetDir") + "\\msys2_shell.cmd";
component.addOperation("CreateShortcut", cmdLocation, "@StartMenuDir@/MSYS2 MinGW 32-bit.lnk", "-mingw32");
component.addOperation("CreateShortcut", cmdLocation, "@StartMenuDir@/MSYS2 MinGW 64-bit.lnk", "-mingw64");
component.addOperation("CreateShortcut", cmdLocation, "@StartMenuDir@/MSYS2 MSYS.lnk", "-msys");
if ("@BITNESS@bit" === "32bit") {
component.addOperation( "Execute",
["@TargetDir@\\autorebase.bat"]);
}
component.addOperation( "Execute",
["@TargetDir@\\usr\\bin\\bash.exe", "--login", "-c", "exit"]);
}
Component.prototype.createOperations = function()
{
component.createOperations();
createShortcuts();
}

View File

@@ -1,9 +0,0 @@
<?xml version="1.0"?>
<Package>
<DisplayName>MSYS2 @BITNESS@bit base</DisplayName>
<Description>Cygwin-derived Posix-like env. for Windows with Arch Linux's Pacman</Description>
<Version>@VERSION@</Version>
<ReleaseDate>@DATE@</ReleaseDate>
<Default>true</Default>
<Script>installscript.js</Script>
</Package>

View File

@@ -1,14 +0,0 @@
function Component() {
var systemDrive = installer.environmentVariable("SystemDrive");
// Use C: as a default for messed up systems.
if (systemDrive === "") {
systemDrive = "C:";
}
installer.setValue("TargetDir", systemDrive+"\\msys@BITNESS@");
installer.setDefaultPageVisible(QInstaller.Introduction, false);
installer.setDefaultPageVisible(QInstaller.TargetDirectory, true);
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false);
installer.setDefaultPageVisible(QInstaller.StartMenuSelection, true);
installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
}

View File

@@ -1,8 +0,0 @@
<?xml version="1.0"?>
<Package>
<DisplayName>MSYS2 @BITNESS@bit</DisplayName>
<Description>Cygwin-derived Posix-like env. for Windows with Arch Linux's Pacman</Description>
<Version>@VERSION@</Version>
<ReleaseDate>@DATE@</ReleaseDate>
<Script>installscript.js</Script>
</Package>