Skip to content

Commit

Permalink
Improve Windows installer
Browse files Browse the repository at this point in the history
- only uninstall files we install (fixes FedoraQt#606)
- add some additional missing properties (fixes FedoraQt#572)
  • Loading branch information
grulja committed Sep 1, 2023
1 parent 401c1db commit 1c0689c
Show file tree
Hide file tree
Showing 4 changed files with 215 additions and 103 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
with:
fetch-depth: 1
- name: Set env (push)
if: github.event_name == 'push' || github.event_name == 'release'
# if: github.event_name == 'push' || github.event_name == 'release'
run: echo "TAG_NAME=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
- name: Install dependencies
shell: bash
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
cmake -DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$Qt6_DIR" ..
mingw32-make -j2 VERBOSE=1
- name: Windeployqt
if: github.event_name == 'push' || github.event_name == 'release'
# if: github.event_name == 'push' || github.event_name == 'release'
shell: bash
run: |
mkdir -p build/app/release
Expand All @@ -183,8 +183,10 @@ jobs:
cp $Qt6_DIR/bin/libgcc_s_seh-1.dll .
cp $Qt6_DIR/bin/liblzma.dll .
cp /c/Program\ Files/OpenSSL/bin/*.dll .
find . -type d -not -path '*/\.*' | sed 's/^\.\///g' | sed 's@\/@\\@g' | grep -v "^.$" > uninstall.log
find . -type f -not -path '*/\.*' | sed 's/^\.\///g' | sed 's@\/@\\@g' | sort >> uninstall.log
- name: Installer
if: github.event_name == 'push' || github.event_name == 'release'
# if: github.event_name == 'push' || github.event_name == 'release'
env:
TAG_NAME: ${{ env.TAG_NAME }}
shell: bash
Expand All @@ -208,11 +210,11 @@ jobs:
unix2dos < "LICENSE.GPL-2" > "build/app/release/LICENSE.GPL-2.txt"
unix2dos < "LICENSE.LGPL-2" > "build/app/release/LICENSE.LGPL-2.txt"
makensis -DCERTPATH="" -DCERTPASS="" dist/win/mediawriter_native.tmp.nsi
if [[ "$TAG_NAME" != "" ]]; then
mv dist/win/FMW-setup.exe ./"FedoraMediaWriter-win64-$TAG_NAME.exe"
else
# if [[ "$TAG_NAME" != "" ]]; then
# mv dist/win/FMW-setup.exe ./"FedoraMediaWriter-win64-$TAG_NAME.exe"
# else
mv dist/win/FMW-setup.exe ./"FedoraMediaWriter-win64.exe"
fi
# fi
- name: Upload to GitHub (release)
if: github.event_name == 'release'
Expand Down Expand Up @@ -247,3 +249,12 @@ jobs:
prerelease: true
title: "Development Build (Windows)"
files: FedoraMediaWriter-win64.exe

- name: Upload artifacts to GitHub
if: github.event_name == 'pull_request'
env:
TAG_NAME: ${{ env.TAG_NAME }}
uses: actions/upload-artifact@v2
with:
name: FedoraMediaWriter-win64.exe
path: FedoraMediaWriter-win64.exe
9 changes: 7 additions & 2 deletions dist/win/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ for i in $PACKAGES; do
done
if [ $DEPENDENCIES -ne 0 ]; then exit 1; fi

BINARIES="libstdc++-6.dll libgcc_s_dw2-1.dll libssp-0.dll iconv.dll libwinpthread-1.dll libcrypto-3.dll libssl-3.dll libpng16-16.dll liblzma-5.dll libharfbuzz-0.dll libpcre-1.dll libintl-8.dll iconv.dll libpcre2-8-0.dll libpcre2-16-0.dll libfreetype-6.dll libbz2-1.dll libjpeg-62.dll libEGL.dll libglib-2.0-0.dll libGLESv2.dll zlib1.dll icui18n72.dll icuuc72.dll icudata72.dll Qt6Core.dll Qt6Gui.dll Qt6Network.dll Qt6Concurrent.dll Qt6Qml.dll Qt6QmlModels.dll Qt6Quick.dll Qt6QuickControls2.dll Qt6QuickControls2Impl.dll Qt6QuickShapes.dll Qt6QuickTemplates2.dll Qt6QmlWorkerScript.dll Qt6Svg.dll Qt6Widgets.dll Qt6OpenGL.dll Qt6QuickLayouts.dll Qt6QmlLocalStorage.dll Qt6QuickDialogs2.dll Qt6QuickDialogs2QuickImpl.dll Qt6QuickDialogs2Utils.dll"
BINARIES="libstdc++-6.dll libgcc_s_dw2-1.dll libssp-0.dll libexpat-1.dll libfontconfig-1.dll iconv.dll libwinpthread-1.dll libcrypto-3.dll libssl-3.dll libpng16-16.dll liblzma-5.dll libharfbuzz-0.dll libpcre-1.dll libintl-8.dll iconv.dll libpcre2-8-0.dll libpcre2-16-0.dll libfreetype-6.dll libbz2-1.dll libjpeg-62.dll libEGL.dll libglib-2.0-0.dll libGLESv2.dll zlib1.dll icui18n73.dll icuuc73.dll icudata73.dll Qt6Core.dll Qt6Gui.dll Qt6Network.dll Qt6Concurrent.dll Qt6Qml.dll Qt6QmlModels.dll Qt6Quick.dll Qt6QuickControls2.dll Qt6QuickControls2Impl.dll Qt6QuickShapes.dll Qt6QuickTemplates2.dll Qt6QmlWorkerScript.dll Qt6Svg.dll Qt6Widgets.dll Qt6OpenGL.dll Qt6QuickLayouts.dll Qt6QmlLocalStorage.dll Qt6QuickDialogs2.dll Qt6QuickDialogs2QuickImpl.dll Qt6QuickDialogs2Utils.dll"

PLUGINS="iconengines/qsvgicon.dll imageformats/qjpeg.dll imageformats/qsvg.dll imageformats/qico.dll platforms/qwindows.dll tls/qcertonlybackend.dll tls/qopensslbackend.dll tls/qschannelbackend.dll"

QMLMODULES="Qt QtQml QtQuick/Controls/impl QtQuick/Controls/Windows QtQuick/NativeStyle QtQuick/Window QtQuick/Dialogs QtQuick/Layouts QtQuick/Shapes QtQuick/Templates QtQuick/Controls/Basic QtQuick/Controls/Fusion"

# QMAKE_BIN=/usr/lib64/qt6/bin/qmake
# INSTALL_PREFIX=$($QMAKE_BIN -query QT_INSTALL_PREFIX)
INSTALL_PREFIX=$(mingw32-cmake -L | grep CMAKE_INSTALL_PREFIX | cut -d "=" -f2)
INSTALL_PREFIX=$(mingw32-cmake -L | grep CMAKE_INSTALL_PREFIX | cut -d "=" -f2)
BIN_PREFIX=$(mingw32-cmake -L | grep CMAKE_INSTALL_PREFIX | cut -d "=" -f2)
PLUGIN_PREFIX=$(mingw32-qmake-qt5 -query QT_INSTALL_PLUGINS | tr 5 6)
QML_PREFIX=$(mingw32-qmake-qt5 -query QT_INSTALL_QML | tr 5 6)
Expand Down Expand Up @@ -187,6 +187,11 @@ cp -r "${BIN_PREFIX}/lib/qt6/qml/QtQml/WorkerScript/workerscriptplugin.dll" "QtQ
#upx $(find . -name "*.exe")
#upx $(find . -name "*.dll")

echo "=== Creating uninstall.log"
rm -f uninstall.log
find . -type d -not -path '*/\.*' | sed 's/^\.\///g' | sed 's@\/@\\@g' | grep -v "^.$" > uninstall.log
find . -type f -not -path '*/\.*' | sed 's/^\.\///g' | sed 's@\/@\\@g' | sort >> uninstall.log

# See http://stackoverflow.com/questions/18287960/signing-windows-application-on-linux-based-distros for details
echo "=== Signing binaries"

Expand Down
142 changes: 95 additions & 47 deletions dist/win/mediawriter.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ XPStyle on
# This is the size (in kB) of all the files copied into "Program Files"
#!define INSTALLSIZE


VIProductVersion "0.5.50.0"
VIAddVersionKey "ProductName" "${APPNAME}"
VIAddVersionKey "Comments" "${DESCRIPTION}"
VIAddVersionKey "CompanyName" "${COMPANYNAME}"
VIAddVersionKey "LegalCopyright" "${COMPANYNAME}"
VIAddVersionKey "FileDescription" "${APPNAME}"
VIAddVersionKey "FileVersion" "0.5.50"

;Set the name of the uninstall log
!define UninstLog "uninstall.log"
Var UninstLog

!ifdef INNER
!echo "Inner invocation" ; just to see what's going on
Expand Down Expand Up @@ -73,61 +83,61 @@ Icon "../../src/app/data/icons/mediawriter.ico"
!insertmacro MUI_UNPAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English" ;first language is the default language
!insertmacro MUI_LANGUAGE "Afrikaans"
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Arabic"
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Bosnian"
!insertmacro MUI_LANGUAGE "Breton"
!insertmacro MUI_LANGUAGE "Bulgarian"
!insertmacro MUI_LANGUAGE "Catalan"
!insertmacro MUI_LANGUAGE "Croatian"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Esperanto"
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "Finnish"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "Galician"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "SpanishInternational"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "Hebrew"
!insertmacro MUI_LANGUAGE "Hungarian"
!insertmacro MUI_LANGUAGE "Icelandic"
!insertmacro MUI_LANGUAGE "Indonesian"
!insertmacro MUI_LANGUAGE "Irish"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Swedish"
!insertmacro MUI_LANGUAGE "Kurdish"
!insertmacro MUI_LANGUAGE "Latvian"
!insertmacro MUI_LANGUAGE "Lithuanian"
!insertmacro MUI_LANGUAGE "Luxembourgish"
!insertmacro MUI_LANGUAGE "Macedonian"
!insertmacro MUI_LANGUAGE "Malay"
!insertmacro MUI_LANGUAGE "Mongolian"
!insertmacro MUI_LANGUAGE "Norwegian"
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
!insertmacro MUI_LANGUAGE "Finnish"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Croatian"
!insertmacro MUI_LANGUAGE "Bulgarian"
!insertmacro MUI_LANGUAGE "Hungarian"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "Romanian"
!insertmacro MUI_LANGUAGE "Latvian"
!insertmacro MUI_LANGUAGE "Macedonian"
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Lithuanian"
!insertmacro MUI_LANGUAGE "Slovenian"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Serbian"
!insertmacro MUI_LANGUAGE "SerbianLatin"
!insertmacro MUI_LANGUAGE "Arabic"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "Hebrew"
!insertmacro MUI_LANGUAGE "Indonesian"
!insertmacro MUI_LANGUAGE "Mongolian"
!insertmacro MUI_LANGUAGE "Luxembourgish"
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Breton"
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Icelandic"
!insertmacro MUI_LANGUAGE "Malay"
!insertmacro MUI_LANGUAGE "Bosnian"
!insertmacro MUI_LANGUAGE "Kurdish"
!insertmacro MUI_LANGUAGE "Irish"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Slovenian"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "SpanishInternational"
!insertmacro MUI_LANGUAGE "Swedish"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Uzbek"
!insertmacro MUI_LANGUAGE "Galician"
!insertmacro MUI_LANGUAGE "Afrikaans"
!insertmacro MUI_LANGUAGE "Catalan"
!insertmacro MUI_LANGUAGE "Esperanto"

!macro VerifyUserIsAdmin
UserInfo::GetAccountType
Expand Down Expand Up @@ -209,11 +219,49 @@ sectionEnd
# Remove Start Menu launcher
delete "$SMPROGRAMS\${APPNAME}.lnk"

# Remove files
delete $INSTDIR\*
;Can't uninstall if uninstall log is missing!
IfFileExists "$INSTDIR\${UninstLog}" +3
MessageBox MB_OK|MB_ICONSTOP "$(UninstLogMissing)"
Abort

Push $R0
Push $R1
Push $R2
SetFileAttributes "$INSTDIR\${UninstLog}" NORMAL
FileOpen $UninstLog "$INSTDIR\${UninstLog}" r
StrCpy $R1 -1

GetLineCount:
ClearErrors
FileRead $UninstLog $R0
IntOp $R1 $R1 + 1
StrCpy $R0 $R0 -1
Push $R0
IfErrors 0 GetLineCount

Pop $R0

LoopRead:
StrCmp $R1 0 LoopDone
Pop $R0

IfFileExists "$INSTDIR\$R0\*.*" 0 +3
RMDir /r "$INSTDIR\$R0" #is dir
Goto +3
IfFileExists "$INSTDIR\$R0" 0 +2
Delete "$INSTDIR\$R0" #is file
IntOp $R1 $R1 - 1
Goto LoopRead
LoopDone:
FileClose $UninstLog
Delete "$INSTDIR\${UninstLog}"
Delete "$INSTDIR\uninstall.exe"
Pop $R2
Pop $R1
Pop $R0

# Try to remove the install directory - this will only happen if it is empty
rmDir /r $INSTDIR
rmDir $INSTDIR

# Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
Expand Down
Loading

0 comments on commit 1c0689c

Please sign in to comment.