Skip to content

Commit

Permalink
Change installer to run without admin privilege
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulh committed Mar 15, 2018
1 parent 6a53dea commit 6d86d9c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 49 deletions.
4 changes: 3 additions & 1 deletion scripts/ci/funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ function create_github_release_linux()
local DEB_FILE="build-linux/deb/${DEB_NAME}"
local APPIMAGE_FILE=$(find build-appimage -iname '*.AppImage')
local EXE_FILE="$(ls win/build/*.exe 2> /dev/null | head -n 1)"
local ZIP_FILE="$(ls win/build/*.zip 2> /dev/null | head -n 1)"

if [ -z "$VERSION" ]; then
>&2 echo -e "Skipping GitHub release creation (current build does not have a tag)"
Expand All @@ -241,9 +242,10 @@ function create_github_release_linux()

>&2 echo -e "Creating (Linux) GitHub release (tag: $VERSION)"

create_release_and_upload_asset $VERSION $DEB_FILE
create_release_and_upload_asset $VERSION $DEB_FILE
create_release_and_upload_asset $VERSION $APPIMAGE_FILE
create_release_and_upload_asset $VERSION $EXE_FILE
create_release_and_upload_asset $VERSION $ZIP_FILE
}

# Create a a GitHub release for the specified version and upload all applicable assets
Expand Down
13 changes: 11 additions & 2 deletions scripts/ci/linux/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ mkdir -p $WDIR/redist
#Get 3rd party tools
wget_retry https://calaos.fr/mooltipass/tools/windows/mc-agent.exe -O $WDIR/mc-agent.exe
wget_retry https://calaos.fr/mooltipass/tools/windows/mc-cli.exe -O $WDIR/mc-cli.exe
wget_retry https://calaos.fr/download/misc/redist/Win32OpenSSL_Light-1_0_2L.exe -O $WDIR/redist/Win32OpenSSL_Light-1_0_2L.exe
wget_retry https://calaos.fr/download/misc/redist/vcredist_sp1_x86.exe -O $WDIR/redist/vcredist_sp1_x86.exe

for f in $MXE_BIN/bin/libgcc_s_sjlj-1.dll \
$MXE_BIN/bin/libstdc++-6.dll \
$MXE_BIN/bin/libwinpthread-1.dll \
$MXE_BIN/bin/libwebp-5.dll \
$MXE_BIN/bin/zlib1.dll \
$MXE_BIN/bin/ssleay32.dll \
$MXE_BIN/bin/libeay32.dll \
$MXE_BIN/bin/icudt56.dll \
$MXE_BIN/bin/icuin56.dll \
$MXE_BIN/bin/icuuc56.dll \
Expand Down Expand Up @@ -57,6 +57,15 @@ chmod +x iscc

sign_binary build/$FILENAME.exe

#Create a portable zip for windows
ZIPFILE=moolticute_portable_win32_${VERSION}.zip
pushd $WDIR/..
mv moolticute_build moolticute_$VERSION
zip --compression-method deflate -r $ZIPFILE moolticute_$VERSION
popd

mv $WDIR/../$ZIPFILE build/

#create update manifest
cat > build/updater.json <<EOF
{ "updates": { "windows": { "latest-version": "$VERSION", "download-url": "https://calaos.fr/mooltipass/windows/$FILENAME.exe" }}}
Expand Down
51 changes: 5 additions & 46 deletions win/installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultDirName={userpf}\{#MyAppName}

This comment has been minimized.

Copy link
@limpkin

limpkin Mar 15, 2018

Collaborator

oh... so that's the magic folder?

DefaultGroupName=Moolticute
DisableProgramGroupPage=no
OutputDir=build
Expand All @@ -28,7 +28,7 @@ WizardSmallImageFile=WizModernSmallImage-IS.bmp
SetupIconFile=Setup.ico
UninstallDisplayIcon={app}\moolticute.exe
MinVersion=0,5.01sp3
PrivilegesRequired=admin
PrivilegesRequired=lowest

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Expand All @@ -54,9 +54,10 @@ Name: "Full"; Description: "Full installation"
Name: "moolticute"; Description: "Moolticute"; Types: Full

[Run]
Filename: "{app}\redist\vcredist_sp1_x86.exe"; Parameters: "/q /NoSetupVersionCheck"; WorkingDir: "{app}\redist"; StatusMsg: "Installing Visual Studio 2010 C++ CRT Libraries..."; Components: moolticute
Filename: "{app}\redist\Win32OpenSSL_Light-1_0_2L.exe"; Parameters: "/silent /verysilent /sp- /suppressmsgboxes"; WorkingDir: "{app}\redist"; StatusMsg: "Installing OpenSSL libraries..."; Components: moolticute
Filename: "{app}\moolticute.exe"; WorkingDir: "{app}"; Description: "Start Moolticute"; Flags: postinstall nowait skipifsilent runascurrentuser

[Registry]
Root: "HKCU"; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "Moolticute"; ValueData: "{app}\moolticute.exe --autolaunched"; Flags: uninsdeletevalue

[Code]
// function IsModuleLoaded to call at install time
Expand Down Expand Up @@ -158,45 +159,3 @@ begin
UnloadDLL(ExpandConstant('{app}\psvince.dll'));
end;
//Install the registry key for autostart
procedure CurStepChanged(CurStep: TSetupStep);
var
Params: string;
ResultCode: Integer;
begin
if CurStep = ssPostInstall then
begin
Log('Adding registry key for original user');
Params := 'ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Moolticute /t REG_SZ /d "' + ExpandConstant('{app}') + '\moolticute.exe --autolaunched" /f';
if ExecAsOriginalUser(
'reg.exe', Params, '', SW_HIDE, ewWaitUntilTerminated, ResultCode) and
(ResultCode = 0) then
begin
Log('Added registry key for original user');
end
else
begin
Log('Error adding registry key for original user');
Params := 'ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Moolticute /t REG_SZ /d "' + ExpandConstant('{app}') + '\moolticute.exe --autolaunched" /f';
Exec('reg.exe', Params, '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
end;
end;
end;
procedure CurUninstallStepChanged(CurStep: TUninstallStep);
var
Params: string;
ResultCode: Integer;
begin
if CurStep = usPostUninstall then
begin
Log('Removing autostart reg keys in HKCU');
Params := 'DELETE HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Moolticute /f';
ShellExec('runas', 'reg.exe', Params, '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
Log('Removing autostart reg keys in HKLM');
Params := 'DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Moolticute /f';
Exec('reg.exe', Params, '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
end;
end;

0 comments on commit 6d86d9c

Please sign in to comment.