Merge branch 'better_nsis' into 'master'

Update NSIS to use a more modern style and detect if LibreWolf is still running

See merge request librewolf-community/browser/windows!20
This commit is contained in:
Malte Jürgens 2022-01-19 19:12:14 +00:00
commit 9d0d8a136e
5 changed files with 379 additions and 340 deletions

BIN
assets/banner.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

View file

@ -1,125 +1,158 @@
# !include "MUI2.nsh"
# Change these values to fit your application... !include "LogicLib.nsh"
# !addplugindir .
!define APPNAME "LibreWolf" # Full app name, like: "Gtk+ 2.0 Hello World" !define APPNAME "LibreWolf"
!define PROGNAME "librewolf" # executable name, like: gtk2hello !define PROGNAME "librewolf"
!define PROG_VERSION "pkg_version" # the program version, like: 0.3.0 !define EXECUTABLE "${PROGNAME}.exe"
!define ICON_NAME "librewolf.ico" # filename of icon to use for this app !define PROG_VERSION "pkg_version"
!define COMPANYNAME "LibreWolf" # Your name, or company (or just the program name) !define COMPANYNAME "LibreWolf"
!define ESTIMATED_SIZE 190000 # Estimated size (in KB) of installed program for use in "add or remove programs" / 190 MB !define ESTIMATED_SIZE 190000
!define MUI_ICON "librewolf.ico"
# !define MUI_WELCOMEFINISHPAGE_BITMAP "banner.bmp"
# The actual installer/uninstaller, you should not need to change much here below
# Name "${APPNAME}"
OutFile "${PROGNAME}-${PROG_VERSION}.en-US.win64-setup.exe"
Name "${PROGNAME}" InstallDir $PROGRAMFILES64\${APPNAME}
OutFile "${PROGNAME}-${PROG_VERSION}.en-US.win64-setup.exe" RequestExecutionLevel admin
InstallDir $PROGRAMFILES64\${APPNAME}
RequestExecutionLevel admin # Pages
Page directory !define MUI_ABORTWARNING
Page instfiles
!insertmacro MUI_PAGE_WELCOME
function .onInit !insertmacro MUI_PAGE_DIRECTORY
setShellVarContext all !insertmacro MUI_PAGE_INSTFILES
functionEnd !insertmacro MUI_PAGE_FINISH
Section "${PROGNAME}" !insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Copy files
SetOutPath $INSTDIR !insertmacro MUI_LANGUAGE "English"
File /r librewolf\*.*
Section
# Start Menu
createDirectory "$SMPROGRAMS\${COMPANYNAME}" # Make sure LibreWolf is closed before the installation
createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\${PROGNAME}.exe" "" "$INSTDIR\${ICON_NAME}" nsProcess::_FindProcess "${EXECUTABLE}"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "" Pop $R0
${If} $R0 = 0
# Uninstaller IfSilent 0 +4
writeUninstaller "$INSTDIR\uninstall.exe" DetailPrint "${APPNAME} is still running, aborting because of silent install."
SetErrorlevel 2
# Registry information for add/remove programs Abort
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" DetailPrint "${APPNAME} is still running. Closing it gracefully..."
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" nsProcess::_CloseProcess "${EXECUTABLE}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\"" Pop $R0
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\${ICON_NAME}$\"" Sleep 2000
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}" nsProcess::_FindProcess "${EXECUTABLE}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${PROG_VERSION}" Pop $R0
# There is no option for modifying or repairing the install ${If} $R0 = 0
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1 DetailPrint "Failed to close ${APPNAME}, killing it..."
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1 nsProcess::_KillProcess "${EXECUTABLE}"
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size Sleep 2000
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${ESTIMATED_SIZE} nsProcess::_FindProcess "${EXECUTABLE}"
Pop $R0
${If} $R0 = 0
# DetailPrint "Failed to kill ${APPNAME}, aborting"
# Registry information to let Windows pick us up in the list of available browsers MessageBox MB_ICONSTOP "LibreWolf is still running and can't be closed by the installer. Please close it manually and try again."
# SetErrorlevel 2
Abort
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf" "" "LibreWolf" ${EndIf}
${EndIf}
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationDescription" "LibreWolf" ${EndIf}
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationIcon" "$INSTDIR\librewolf.exe,0"
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationName" "LibreWolf" # Copy files
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".htm" "LibreWolfHTM" SetOutPath $INSTDIR
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".html" "LibreWolfHTM" File /r librewolf\*.*
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".pdf" "LibreWolfHTM"
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\Startmenu" "StartMenuInternet" "LibreWolf" # Start Menu
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\URLAssociations" "http" "LibreWolfHTM" createDirectory "$SMPROGRAMS\${COMPANYNAME}"
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\URLAssociations" "https" "LibreWolfHTM" createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\${PROGNAME}.exe" "" "$INSTDIR\${MUI_ICON}"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" ""
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\DefaultIcon" "" "$INSTDIR\librewolf.exe,0"
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\shell\open\command" "" "$INSTDIR\librewolf.exe" # Uninstaller
writeUninstaller "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "Software\RegisteredApplications" "LibreWolf" "Software\Clients\StartMenuInternet\LibreWolf\Capabilities"
# Registry information for add/remove programs
WriteRegStr HKLM "Software\Classes\LibreWolfHTM" "" "LibreWolf Handler" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Classes\LibreWolfHTM" "AppUserModelId" "LibreWolf" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "AppUserModelId" "LibreWolf" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationIcon" "$INSTDIR\librewolf.exe,0" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationName" "LibreWolf" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\${MUI_ICON}$\""
WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationDescription" "Start the LibreWolf Browser" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}"
WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationCompany" "LibreWolf Community" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${PROG_VERSION}"
WriteRegStr HKLM "Software\Classes\LibreWolfHTM\DefaultIcon" "" "$INSTDIR\librewolf.exe,0" # There is no option for modifying or repairing the install
WriteRegStr HKLM "Software\Classes\LibreWolfHTM\shell\open\command" "" "$INSTDIR\librewolf.exe %1" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
SectionEnd # Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${ESTIMATED_SIZE}
# Before uninstall, ask for confirmation
function un.onInit
SetShellVarContext all #
# Registry information to let Windows pick us up in the list of available browsers
# Verify the uninstaller - last chance to back out #
# (commented this out, it causes problems with Chocolatey.)
# MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf" "" "LibreWolf"
# Abort
# next: WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationDescription" "LibreWolf"
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationIcon" "$INSTDIR\librewolf.exe,0"
functionEnd WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities" "ApplicationName" "LibreWolf"
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".htm" "LibreWolfHTM"
# Uninstaller WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".html" "LibreWolfHTM"
section "uninstall" WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\FileAssociations" ".pdf" "LibreWolfHTM"
WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\Startmenu" "StartMenuInternet" "LibreWolf"
# Remove Start Menu launcher WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\URLAssociations" "http" "LibreWolfHTM"
delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\Capabilities\URLAssociations" "https" "LibreWolfHTM"
delete "$SMPROGRAMS\${COMPANYNAME}\Uninstall.lnk"
# Try to remove the Start Menu folder - this will only happen if it is empty WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\DefaultIcon" "" "$INSTDIR\librewolf.exe,0"
rmDir "$SMPROGRAMS\${COMPANYNAME}" WriteRegStr HKLM "Software\Clients\StartMenuInternet\LibreWolf\shell\open\command" "" "$INSTDIR\librewolf.exe"
# Remove files WriteRegStr HKLM "Software\RegisteredApplications" "LibreWolf" "Software\Clients\StartMenuInternet\LibreWolf\Capabilities"
rmDir /r $INSTDIR
WriteRegStr HKLM "Software\Classes\LibreWolfHTM" "" "LibreWolf Handler"
# Remove uninstaller information from the registry WriteRegStr HKLM "Software\Classes\LibreWolfHTM" "AppUserModelId" "LibreWolf"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "AppUserModelId" "LibreWolf"
WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationIcon" "$INSTDIR\librewolf.exe,0"
# WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationName" "LibreWolf"
# Windows default browser integration WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationDescription" "Start the LibreWolf Browser"
# WriteRegStr HKLM "Software\Classes\LibreWolfHTM\Application" "ApplicationCompany" "LibreWolf Community"
WriteRegStr HKLM "Software\Classes\LibreWolfHTM\DefaultIcon" "" "$INSTDIR\librewolf.exe,0"
DeleteRegKey HKLM "Software\Clients\StartMenuInternet\LibreWolf" WriteRegStr HKLM "Software\Classes\LibreWolfHTM\shell\open\command" "" "$INSTDIR\librewolf.exe %1"
DeleteRegKey HKLM "Software\RegisteredApplications"
DeleteRegKey HKLM "Software\Classes\LibreWolfHTM" SectionEnd
sectionEnd
# Uninstaller
section "Uninstall"
# Kill LibreWolf if it is still running
nsProcess::_FindProcess "${EXECUTABLE}"
Pop $R0
${If} $R0 = 0
DetailPrint "${APPNAME} is still running, killing it..."
nsProcess::_KillProcess "${EXECUTABLE}"
Sleep 2000
${EndIf}
# Remove Start Menu launcher
delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
delete "$SMPROGRAMS\${COMPANYNAME}\Uninstall.lnk"
# Try to remove the Start Menu folder - this will only happen if it is empty
rmDir "$SMPROGRAMS\${COMPANYNAME}"
# Remove files
rmDir /r $INSTDIR
# Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
#
# Windows default browser integration
#
DeleteRegKey HKLM "Software\Clients\StartMenuInternet\LibreWolf"
DeleteRegKey HKLM "Software\RegisteredApplications"
DeleteRegKey HKLM "Software\Classes\LibreWolfHTM"
sectionEnd

1
common Submodule

@ -0,0 +1 @@
Subproject commit 1e529672fc81de6c15d584d41efa17880b28fea4

434
mk.py Executable file → Normal file
View file

@ -1,215 +1,219 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os,sys,subprocess,os.path import os,sys,subprocess,os.path
# native()/bash()/exec() utility functions # native()/bash()/exec() utility functions
def native(cmd,do_print=True): def native(cmd,do_print=True):
sys.stdout.flush() sys.stdout.flush()
if do_print: if do_print:
print(cmd) print(cmd)
sys.stdout.flush() sys.stdout.flush()
retval = os.system(cmd) retval = os.system(cmd)
if retval != 0: if retval != 0:
sys.exit(retval) sys.exit(retval)
def bash(cmd,do_print=True): def bash(cmd,do_print=True):
tmp = [] tmp = []
tmp += ['c:/mozilla-build/msys/bin/bash.exe', '-c', cmd] tmp += ['c:/mozilla-build/msys/bin/bash.exe', '-c', cmd]
sys.stdout.flush() sys.stdout.flush()
if do_print: if do_print:
print(cmd) print(cmd)
sys.stdout.flush() sys.stdout.flush()
retval = subprocess.run(tmp).returncode retval = subprocess.run(tmp).returncode
if retval != 0: if retval != 0:
sys.exit(retval) sys.exit(retval)
def exec(cmd,do_print=True): def exec(cmd,do_print=True):
_native = False _native = False
if not os.path.isfile('c:/mozilla-build/msys/bin/bash.exe'): if not os.path.isfile('c:/mozilla-build/msys/bin/bash.exe'):
_native = True _native = True
if _native: if _native:
return native(cmd,do_print) return native(cmd,do_print)
return bash(cmd,do_print) return bash(cmd,do_print)
def patch(patchfile): def patch(patchfile):
cmd = "patch -p1 -i {}".format(patchfile) cmd = "patch -p1 -i {}".format(patchfile)
sys.stdout.flush() sys.stdout.flush()
print("\n*** -> {}".format(cmd)) print("\n*** -> {}".format(cmd))
sys.stdout.flush() sys.stdout.flush()
retval = os.system(cmd) retval = os.system(cmd)
if retval != 0: if retval != 0:
sys.stdout.flush() sys.stdout.flush()
print("fatal error: patch '{}' failed".format(patchfile)) print("fatal error: patch '{}' failed".format(patchfile))
sys.stdout.flush() sys.stdout.flush()
sys.exit(retval) sys.exit(retval)
# #
# main functions # main functions
# #
def fetch(): def fetch():
exec('wget -q -O version https://gitlab.com/librewolf-community/browser/source/-/raw/main/version') exec('wget -q -O version https://gitlab.com/librewolf-community/browser/source/-/raw/main/version')
exec('wget -q -O source_release https://gitlab.com/librewolf-community/browser/source/-/raw/main/release') exec('wget -q -O source_release https://gitlab.com/librewolf-community/browser/source/-/raw/main/release')
exec('wget -O librewolf-$(cat version)-$(cat source_release).source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-$(cat version)-$(cat source_release).source.tar.gz?job=build-job') exec('wget -O librewolf-$(cat version)-$(cat source_release).source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-$(cat version)-$(cat source_release).source.tar.gz?job=build-job')
def build(): def build():
exec('rm -rf librewolf-$(cat version)') exec('rm -rf librewolf-$(cat version)')
exec('tar xf librewolf-$(cat version)-$(cat source_release).source.tar.gz') exec('tar xf librewolf-$(cat version)-$(cat source_release).source.tar.gz')
with open('version','r') as file: with open('version','r') as file:
version = file.read().rstrip() version = file.read().rstrip()
os.chdir('librewolf-{}'.format(version)) os.chdir('librewolf-{}'.format(version))
# patches # patches
exec('cp -v ../assets/mozconfig.windows mozconfig') exec('cp -v ../assets/mozconfig.windows mozconfig')
patch('../assets/package-manifest.patch') patch('../assets/package-manifest.patch')
# perform the build and package # perform the build and package
exec('MACH_USE_SYSTEM_PYTHON=1 ./mach build') exec('MACH_USE_SYSTEM_PYTHON=1 ./mach build')
exec('MACH_USE_SYSTEM_PYTHON=1 ./mach package') exec('MACH_USE_SYSTEM_PYTHON=1 ./mach package')
os.chdir('..') os.chdir('..')
def artifacts(): def artifacts():
# Trying to fix issue #146 -> https://gitlab.com/librewolf-community/browser/windows/-/issues/146 # Trying to fix issue #146 -> https://gitlab.com/librewolf-community/browser/windows/-/issues/146
# (keep this False for now) # (keep this False for now)
_with_app_name = False _with_app_name = False
with open('version','r') as file1: with open('version','r') as file1:
version = file1.read().rstrip() version = file1.read().rstrip()
buildzip_filename = 'firefox-{}.en-US.win64.zip'.format(version) buildzip_filename = 'firefox-{}.en-US.win64.zip'.format(version)
if _with_app_name: if _with_app_name:
buildzip_filename = 'librewolf-{}.en-US.win64.zip'.format(version) buildzip_filename = 'librewolf-{}.en-US.win64.zip'.format(version)
exec('cp -v librewolf-{}/obj-x86_64-pc-mingw32/dist/{} .'.format(version,buildzip_filename)) exec('cp -v librewolf-{}/obj-x86_64-pc-mingw32/dist/{} .'.format(version,buildzip_filename))
exec('rm -rf work && mkdir work') exec('rm -rf work && mkdir work')
os.chdir('work') os.chdir('work')
exec('unzip ../{}'.format(buildzip_filename)) exec('unzip ../{}'.format(buildzip_filename))
if not _with_app_name: if not _with_app_name:
exec('mv firefox librewolf') exec('mv firefox librewolf')
os.chdir('librewolf') os.chdir('librewolf')
if not _with_app_name: if not _with_app_name:
exec('mv firefox.exe librewolf.exe') exec('mv firefox.exe librewolf.exe')
os.chdir('..') os.chdir('..')
os.chdir('..') os.chdir('..')
# let's get 'release'. # let's get 'release'.
with open('release','r') as file2: with open('release','r') as file2:
release = file2.read().rstrip() release = file2.read().rstrip()
if release == '0' : if release == '0' :
full_version = '{}'.format(version) full_version = '{}'.format(version)
else: else:
full_version = '{}.{}'.format(version,release) full_version = '{}.{}'.format(version,release)
# let's copy in the .ico icon. # let's copy in the .ico icon.
exec('cp -v assets/librewolf.ico work/librewolf') exec('cp -v assets/librewolf.ico work/librewolf')
# Let's make the portable zip first. # Let's make the portable zip first.
os.chdir('work') os.chdir('work')
exec('rm -rf librewolf-{}'.format(version)) exec('rm -rf librewolf-{}'.format(version))
os.makedirs('librewolf-{}/Profiles/Default'.format(version), exist_ok=True) os.makedirs('librewolf-{}/Profiles/Default'.format(version), exist_ok=True)
os.makedirs('librewolf-{}/LibreWolf'.format(version), exist_ok=True) os.makedirs('librewolf-{}/LibreWolf'.format(version), exist_ok=True)
exec('cp -vr librewolf/* librewolf-{}/LibreWolf'.format(version)) exec('cp -vr librewolf/* librewolf-{}/LibreWolf'.format(version))
exec('wget -q -O librewolf-{}/librewolf-portable.exe https://gitlab.com/librewolf-community/browser/windows/uploads/8347381f01806245121adcca11b7f35c/librewolf-portable.exe'.format(version)) exec('wget -q -O librewolf-{}/librewolf-portable.exe https://gitlab.com/librewolf-community/browser/windows/uploads/8347381f01806245121adcca11b7f35c/librewolf-portable.exe'.format(version))
zipname = 'librewolf-{}.en-US.win64.zip'.format(full_version) zipname = 'librewolf-{}.en-US.win64.zip'.format(full_version)
exec("rm -f ../{}".format(zipname)) exec("rm -f ../{}".format(zipname))
exec("zip -qr9 ../{} librewolf-{}".format(zipname,version)) exec("zip -qr9 ../{} librewolf-{}".format(zipname,version))
os.chdir('..') os.chdir('..')
# With that out of the way, we need to create the nsis setup. # With that out of the way, we need to create the nsis setup.
os.chdir('work') os.chdir('work')
setupname = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version) exec("mkdir x86-ansi")
exec('sed \"s/pkg_version/{}/g\" < ../assets/setup.nsi > tmp.nsi'.format(full_version)) exec("wget -q -O ./x86-ansi/nsProcess.dll https://shorsh.de/upload/we7v/nsProcess.dll")
exec('makensis-3.01.exe -V1 tmp.nsi') setupname = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version)
exec('rm -f tmp.nsi') exec('sed \"s/pkg_version/{}/g\" < ../assets/setup.nsi > tmp.nsi'.format(full_version))
exec("mv {} ..".format(setupname)) exec('cp -v ../assets/librewolf.ico .')
os.chdir('..') exec('cp -v ../assets/banner.bmp .')
exec('makensis-3.01.exe -V1 tmp.nsi')
exec('rm -rf tmp.nsi librewolf.ico banner.bmp x86-ansi')
exec("mv {} ..".format(setupname))
# utility function os.chdir('..')
def do_upload(filename,token):
exec('echo _ >> upload.txt')
exec('curl --request POST --header \"PRIVATE-TOKEN: {}\" --form \"file=@{}\" \"https://gitlab.com/api/v4/projects/13852981/uploads\" >> upload.txt'.format(token,filename),False)
exec('echo _ >> upload.txt') # utility function
def do_upload(filename,token):
exec('echo _ >> upload.txt')
def upload(token): exec('curl --request POST --header \"PRIVATE-TOKEN: {}\" --form \"file=@{}\" \"https://gitlab.com/api/v4/projects/13852981/uploads\" >> upload.txt'.format(token,filename),False)
exec('echo _ >> upload.txt')
with open('version','r') as file1:
version = file1.read().rstrip()
with open('release','r') as file2: def upload(token):
release = file2.read().rstrip()
if release == '0' : with open('version','r') as file1:
full_version = '{}'.format(version) version = file1.read().rstrip()
else: with open('release','r') as file2:
full_version = '{}.{}'.format(version,release) release = file2.read().rstrip()
if release == '0' :
# Files we need to upload.. full_version = '{}'.format(version)
zip_filename = 'librewolf-{}.en-US.win64.zip'.format(full_version) else:
setup_filename = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version) full_version = '{}.{}'.format(version,release)
exec('sha256sum {} {} > sha256sums.txt'.format(setup_filename,zip_filename))
exec('rm -f upload.txt') # Files we need to upload..
do_upload(setup_filename,token) zip_filename = 'librewolf-{}.en-US.win64.zip'.format(full_version)
do_upload(zip_filename,token) setup_filename = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version)
do_upload('sha256sums.txt',token) exec('sha256sum {} {} > sha256sums.txt'.format(setup_filename,zip_filename))
exec('rm -f upload.txt')
do_upload(setup_filename,token)
# do_upload(zip_filename,token)
# parse commandline for commands do_upload('sha256sums.txt',token)
#
help_msg = ''' #
Use: ./mk.py <command> ... # parse commandline for commands
#
commands:
fetch help_msg = '''
build Use: ./mk.py <command> ...
artifacts
upload <token> commands:
fetch
''' build
artifacts
done_something = False upload <token>
in_upload=False '''
for arg in sys.argv:
if in_upload: done_something = False
upload(arg)
done_something=True in_upload=False
elif arg == 'fetch': for arg in sys.argv:
fetch() if in_upload:
done_something = True upload(arg)
elif arg == 'build': done_something=True
build() elif arg == 'fetch':
done_something = True fetch()
elif arg == 'artifacts': done_something = True
artifacts() elif arg == 'build':
done_something = True build()
elif arg == 'upload': done_something = True
in_upload = True elif arg == 'artifacts':
else: artifacts()
if arg == sys.argv[0]: done_something = True
pass elif arg == 'upload':
else: in_upload = True
print(help_msg) else:
sys.exit(1) if arg == sys.argv[0]:
pass
else:
print(help_msg)
if done_something: sys.exit(1)
sys.exit(0)
print(help_msg)
sys.exit(1) if done_something:
sys.exit(0)
print(help_msg)
sys.exit(1)

1
settings Submodule

@ -0,0 +1 @@
Subproject commit 9075142f3a1b52a949e7f2602b212dc24b6a8cf1