Skip to content

Commit

Permalink
[iss-8]
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit c4e142a
Author: Joaquin <joaquin.f.fernandez@gmail.com>
Date:   Wed Dec 16 13:33:38 2020 -0300

    Fix Windows launcher script.

commit 976102d
Author: Joaquin <joaquin.f.fernandez@gmail.com>
Date:   Wed Dec 16 13:33:16 2020 -0300

    Fix setup script in Windows installer.

commit e13878d
Author: Joaquin <joaquin.f.fernandez@gmail.com>
Date:   Wed Dec 16 13:32:50 2020 -0300

    Fix typo in dependency installer.

commit 6461492
Author: Joaquin <joaquin.f.fernandez@gmail.com>
Date:   Wed Dec 16 13:32:12 2020 -0300

    Update setup Windows script.

commit 4b2eae6
Author: Joaquin <joaquin.f.fernandez@gmail.com>
Date:   Wed Dec 16 13:31:45 2020 -0300

    Move folder linking to init script.

commit 46a4275
Author: Joaquin <joaquin.f.fernandez@gmail.com>
Date:   Wed Dec 16 13:29:19 2020 -0300

    Remove unused installer checks.
  • Loading branch information
joaquinffernandez committed Dec 16, 2020
1 parent b0b6375 commit b8b523b
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 97 deletions.
76 changes: 76 additions & 0 deletions bin/run_win.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash
if [ ! -d $HOME/powerdevs ]
then
# No previous instalation and first run
echo "Linking PowerDEVS user folder"

cmd.exe /c "echo %USERNAME%" > user.txt
WINDOWS_USER=`tr -d '\r' < user.txt`
rm user.txt

echo "Found Windows user: " $WINDOWS_USER

LINUX_POWERDEVS=~/powerdevs
LINUX_POWERDEVS_TMP=${LINUX_POWERDEVS}-tmp
WINDOWS_USER_FOLDER=/mnt/c/Users/${WINDOWS_USER}
WINDOWS_POWERDEVS=${WINDOWS_USER_FOLDER}/PowerDEVS

echo Temp folders:
echo $LINUX_POWERDEVS
echo $LINUX_POWERDEVS_TMP
echo $WINDOWS_POWERDEVS

if [[ -L "$LINUX_POWERDEVS" && -d "$LINUX_POWERDEVS" ]]
then
echo "Removing previous symbolic link to Windows user folder"
rm $LINUX_POWERDEVS
fi

if [ -d "$LINUX_POWERDEVS" ]
then
mv $LINUX_POWERDEVS $LINUX_POWERDEVS_TMP
fi

mkdir -p $WINDOWS_POWERDEVS

ln -s $WINDOWS_POWERDEVS/ $LINUX_POWERDEVS
ln -s $WINDOWS_USER_FOLDER/ ~/$WINDOWS_USER
ln -s /mnt/c/ ~/C

if [ -d "$LINUX_POWERDEVS_TMP" ]
then
cp -r $LINUX_POWERDEVS_TMP/* $LINUX_POWERDEVS/
rm -rf $LINUX_POWERDEVS_TMP
fi

echo "Installing PowerDEVS..."
cp -a /opt/powerdevs $HOME/powerdevs
rm $HOME/powerdevs/bin/run.sh
cd $HOME/powerdevs/bin
./pdme
else
VEROPT=`cat /opt/powerdevs/version`
VERHOME=`cat $HOME/powerdevs/version`
if [ "$VEROPT" == "$VERHOME" ];
then
# Previous instalation and same version
cd $HOME/powerdevs/bin
./pdme
else
# Previous instalation and different version
OW=`zenity --question --text "There is a different version of PowerDEVS on your home folder (ver. $VERHOME). Do you wish to overwrite it with ver. $VEROPT?\nNOTE: you will not lose your models."; echo $?`
if [ $OW == 0 ];
then
cp -a -f /opt/powerdevs/* $HOME/powerdevs
rm $HOME/powerdevs/bin/BackDoor/loader.sce
rm $HOME/powerdevs/build/lib/*
rm $HOME/powerdevs/build/objs/*
rm $HOME/powerdevs/bin/run.sh
cd $HOME/powerdevs/bin
./pdme
else
cd $HOME/powerdevs/bin
./pdme
fi
fi
fi
23 changes: 0 additions & 23 deletions deploy/windows/installer/Installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
#define test_wsl "test-wsl.ps1"
#define check_vcxsrv "check-vcxsrv.ps1"
#define test_vcxsrv "test-vcxsrv.ps1"
#define migrate_settings "migrate-settings.ps1"
#define setup "setup.ps1"
#define ubuntu "Ubuntu_2004.appx"
#define powerdevs_deb "powerdevs.deb"
#define power_devs_setup "power-devs-setup.sh"
#define power_devs_config "power-devs-config.sh"
#define check_power_devs "check-power-devs.ps1"
#define power_devs_icon "pd.ico"
#define export_vcxsrv_vars "export-vcxsrv-vars.sh"
#define export_vcxsrv_ps "export-vcxsrv-vars.ps1"
Expand Down Expand Up @@ -63,10 +61,8 @@ Source: {#BUILD_DIR}\{#test_vcxsrv}; DestDir: {app}\scripts
Source: {#BUILD_DIR}\{#test_wsl}; DestDir: {app}\scripts
Source: {#BUILD_DIR}\{#enable_opengl}; DestDir: {app}\scripts
Source: {#BUILD_DIR}\{#disable_opengl}; DestDir: {app}\scripts
Source: {#BUILD_DIR}\{#migrate_settings}; DestDir: {app}\scripts
Source: {#BUILD_DIR}\{#power_devs_setup}; DestDir: {app}\scripts;
Source: {#BUILD_DIR}\{#power_devs_config}; DestDir: {app}\scripts;
Source: {#BUILD_DIR}\{#check_power_devs}; DestDir: {app}\scripts;
Source: {#BUILD_DIR}\{#export_vcxsrv_vars}; DestDir: {app}\scripts;
Source: {#BUILD_DIR}\{#export_vcxsrv_ps}; DestDir: {app}\scripts;
Source: {#BUILD_DIR}\{#config_opengl}; DestDir: {app}\scripts;
Expand Down Expand Up @@ -114,9 +110,6 @@ var
procedure CleanInstallationRegistryKeys;
begin
RegDeleteKeyIncludingSubKeys(HKCU, 'Software\PowerDEVS\WSLEnabled');
RegDeleteKeyIncludingSubKeys(HKCU, 'Software\PowerDEVS\NetworkConnFailed');
RegDeleteKeyIncludingSubKeys(HKCU, 'Software\PowerDEVS\VPNConnFailed');
RegDeleteKeyIncludingSubKeys(HKCU, 'Software\PowerDEVS\PowerDEVSInstallFailed');
end;
procedure testWSL;
Expand Down Expand Up @@ -157,8 +150,6 @@ begin
end;
function InitializeSetup(): Boolean;
var
begin
if not PowerDEVSDependencies() then
begin
Expand All @@ -175,8 +166,6 @@ var
FileName: String;
Params: String;
ScriptParams: String;
NetworkConnFailed: Boolean;
PowerDEVSInstallFailed: Boolean;
ResultCode: Integer;
begin
Expand All @@ -191,19 +180,7 @@ begin
CancelWithoutPrompt := true;
WizardForm.Close;
end;
NetworkConnFailed := RegKeyExists(HKCU, 'Software\PowerDEVS\NetworkConnFailed');
PowerDEVSInstallFailed := RegKeyExists(HKCU, 'Software\PowerDEVS\PowerDEVSInstallFailed');
CleanInstallationRegistryKeys;
if NetworkConnFailed then begin
MsgBox('Network connection failed. Please check your connection and run the installer again',mbError,MB_OK)
CancelWithoutPrompt := true;
WizardForm.Close;
end;
if PowerDEVSInstallFailed then begin
MsgBox('PowerDEVS installation failed. Please check your connection and run the installer again',mbError,MB_OK)
CancelWithoutPrompt := true;
WizardForm.Close;
end;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
Expand Down
2 changes: 1 addition & 1 deletion deploy/windows/installer/Setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[Setup]
AppName={#appname}
AppVerName={#appname}
AppID=QSS_solver
AppID=PowerDEVS
DefaultDirName={userpf}\{#companyname}\{#appname}
DefaultGroupName={#companyname}\{#appname}
ShowLanguageDialog=auto
Expand Down
17 changes: 0 additions & 17 deletions deploy/windows/installer/check-power-devs.ps1

This file was deleted.

43 changes: 1 addition & 42 deletions deploy/windows/installer/power-devs-config.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,3 @@
echo "Adding X server display environment variables"
echo 'export DISPLAY=:0.0' >> ~/.bashrc
echo 'export LIBGL_ALWAYS_INDIRECT=1' >> ~/.bashrc

echo "Linking PowerDEVS user folder"

cmd.exe /c "echo %USERNAME%" > user.txt
WINDOWS_USER=`tr -d '\r' < user.txt`
rm user.txt

echo "Found Windows user: " $WINDOWS_USER

LINUX_POWERDEVS=~/powerdevs
LINUX_POWERDEVS_TMP=${LINUX_POWERDEVS}-tmp
WINDOWS_USER_FOLDER=/mnt/c/Users/${WINDOWS_USER}
WINDOWS_POWERDEVS=${WINDOWS_USER_FOLDER}/PowerDEVS

echo Temp folders:
echo $LINUX_POWERDEVS
echo $LINUX_POWERDEVS_TMP
echo $WINDOWS_POWERDEVS

if [[ -L "$LINUX_POWERDEVS" && -d "$LINUX_POWERDEVS" ]]
then
echo "Removing previous symbolic link to Windows user folder"
rm $LINUX_POWERDEVS
fi

if [ -d "$LINUX_POWERDEVS" ]
then
mv $LINUX_POWERDEVS $LINUX_POWERDEVS_TMP
fi

mkdir -p $WINDOWS_POWERDEVS

ln -s $WINDOWS_POWERDEVS/ $LINUX_POWERDEVS
ln -s $WINDOWS_USER_FOLDER/ ~/$WINDOWS_USER
ln -s /mnt/c/ ~/C

if [ -d "$LINUX_POWERDEVS_TMP" ]
then
cp -r $LINUX_POWERDEVS_TMP/* $LINUX_POWERDEVS/
rm -rf $LINUX_POWERDEVS_TMP
fi
echo 'export LIBGL_ALWAYS_INDIRECT=1' >> ~/.bashrc
23 changes: 13 additions & 10 deletions deploy/windows/installer/power-devs-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
sudo apt-get update

echo "Installing PowerDEVS Dependencies"
sudo apt-get install gnuplot-x11
sudo apt-get install build-essential
sudo apt-get install libc6
sudo apt-get install qt5-default
sudo apt-get install libqt5svg5
sudo apt-get install zenity
sudo apt-get install libhdf5-dev
sudo apt install -y gnuplot-x11
sudo apt install -y build-essential
sudo apt install -y libc6
sudo apt install -y qt5-default
sudo apt install -y libqt5svg5
sudo apt install -y zenity
sudo apt install -y libhdf5-dev

# Needed to avoid linking error, see: https://github.com/YosysHQ/nextpnr/issues/444#issuecomment-631558250
sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

echo "Installing PowerDEVS"
sudo dpkg -i -y ./powerdevs.deb
sudo apt install -y ./scripts/powerdevs.deb

# Packages needed to open user folder browser.
sudo apt-get install -y konqueror
sudo apt-get install -y nautilus
sudo apt install -y konqueror
sudo apt install -y nautilus

sudo useradd -m -s /bin/bash -G sudo,dialout -p $(openssl passwd powerdevs) powerdevs
2 changes: 1 addition & 1 deletion deploy/windows/installer/power-devs.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
powershell.exe -ExecutionPolicy ByPass -File ../scripts/check-vcxsrv.ps1
cd C:\Users\%USERNAME%\PowerDEVS
wsl -d Ubuntu-20.04 bash -ic "/opt/powerdevs/bin/run.sh"
wsl -u powerdevs -d Ubuntu-20.04 bash -ic "/opt/powerdevs/bin/run_win.sh"
6 changes: 3 additions & 3 deletions deploy/windows/installer/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ if ($ubuntu_installed.Status -eq "Ok") {
ubuntu2004 install --root
}

cp .\powerdevs.deb $InstallDir\scripts\

cd $InstallDir

# Remove Windows EOF extra characters, needed by Jenkins installer.
Expand All @@ -42,6 +44,4 @@ bash.exe ./scripts/power-devs-setup.sh
ubuntu2004.exe config --default-user powerdevs

Write-Host Configure PowerDEVS
bash.exe ./scripts/power-devs-config.sh

powershell.exe -ExecutionPolicy ByPass -File .\scripts\check-power-devs.ps1 -Install
bash.exe ./scripts/power-devs-config.sh

0 comments on commit b8b523b

Please sign in to comment.