El Foro

Problem with RevoUninstaller script

Autor Respuestas
MTres19 Friday 10 April 2015 at 17:50
MTres19Anonymous

I have been writing a simple script to install RevoUninstaller (it works without any special modification) on the wineprefix of the user's choice, in case it might be useful to uninstall a non-.msi program within a Wineprefix (and not have to delete the virtual drive). However, the problem I have run into is with selecting the Wineprefix is that my script uses AVAILABLE_PREFIXES=$(ls $POL_USER_ROOT/wineprefix), which when fed into POL_SetupWindow_menu with a space as the division between entries, for some reason results in all the prefixes except for the option to create a new prefix appearing on the same line. I've used the same variable declaration in the terminal, then used echo "$AVAILABLE_PREFIXES">>test.txt to make sure that there are spaces between the results from ls, which there are. Is there a PlayOnLinux function that will list prefixes, or maybe some way of separating the results with a pipe or tilde that I am overlooking? Thanks in advance for your help.

 

Here's the script:

#!/bin/bash
# Date : (2015-4-10)
# Last revision : (2015-4-10)
# Wine versions used : 1.6.2
# Distributions used to test : Linux Mint 17.1 (x64)
# Author : MTres19

[ $PLAYONLINUX = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

POL_System_TmpCreate "RUninstaller"
cd "$POL_System_TmpDir"

TITLE="RevoUninstaller (Free)"

POL_SetupWindow_Init
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "VSRevo Group" "www.revouninstaller.com" "MTres19" "$(eval_gettext '[Your Wineprefix of choice]')"

AVAILABLE_PREFIXES=$(ls "$POL_USER_ROOT/wineprefix")

POL_SetupWindow_menu "$(eval_gettext 'Which Wineprefix would you like to install RevoUninstaller in?')" "$(eval_gettext '$TITLE - Select Wineprefix')" "$AVAILABLE_PREFIXES RevoUninstaller" " "

PREFIX="$APP_ANSWER"

POL_Wine_SelectPrefix "$PREFIX"

[ "$PREFIX" = "RevoUninstaller" ] && POL_Wine_PrefixCreate "1.6.2"

POL_Download "http://9d4da85dff3fdd198886-459beec849893df302ec58f8a71b3ad1.r61.cf1.rackcdn.com/revouninstaller.zip" "c581e60e67b83fc640741df7197ead86"
unzip "revouninstaller.zip" -d "$POL_USER_ROOT/wineprefix/$PREFIX/drive_c/Program Files"

POL_Shortcut "Revouninstaller.exe" "RevoUninstaller on $PREFIX Wineprefix"

cd "$POL_USER_ROOT"

POL_System_TmpDelete

POL_SetupWindow_message "$(eval_gettext '$TITLE was successfully installed in your $PREFIX Wineprefix.')" "$(eval_gettext '$TITLE - Successfully Installed')"

POL_SetupWindow_Close
exit

Editado por: MTres19

petch Saturday 11 April 2015 at 16:44
petch
Developer

Hi,

Results from ls are separated by newlines, not spaces.

echo -n "$AVAILABLE_PREFIXES" |od -c
0000000   1   n   s   a   n   e   _   g   o   g  \n   A   N   e   w   B
0000020   e   g   i   n   n   i   n   g   _   g   o   g  \n   A   v   a
0000040   d   o   n   T   B   F   _   g   o   g  \n   B   a   l   d   u
0000060   r   s   G   a   t   e   1   _   g   o   g  \n   b   g   e  \n
0000100   B   l   o   o   d   R   a   y   n   e   1   _   g   o   g  \n
0000120   B   r   o   k   e   n   S   w   o   r   d   3   _   g   o   g
0000140  \n   d   e   f   a   u   l   t  \n   D   i   v   i   n   e   D
0000160   i   v   i   n   i   t   y   _   g   o   g  \n   E   l   d   e
0000200   r   S   c   r   o   l   l   s   _   D   a   g   g   e   r   f
0000220   a   l   l  \n   F   l   a   t   o   u   t   _   g   o   g  \n
0000240   L   e   a   g   u   e   O   f   L   e   g   e   n   d   s  \n
0000260   m   o   t   o   r   a   c   e   r   2  \n   N   o   t   e   p
0000300   a   d   P   l   u   s   P   l   u   s  \n   O   u   t   c   a
0000320   s   t   _   g   o   g  \n   T   h   e   W   i   t   c   h   e
0000340   r   _   g   o   g
0000346

You could use

AVAILABLE_PREFIXES=$(cd "$POL_USER_ROOT/wineprefix" && echo *)

that would work as long as PlayOnLinux doesn't change its implementation.

There's also POL_SetupWindow_prefix_selector [message], that will return the selected prefix name into $APP_ANSWER, but it will just allow to select from existing prefixes, not tweak the list like you did...

Editado por: petch

MTres19 Monday 13 April 2015 at 22:35
MTres19Anonymous

Okay, thanks. I just decided to use POL_SetupWindow_prefix_selector because there isn't much reason to install an uninstaller on an empty Wineprefix. Unfortunately, I've run into another problem: When I close RevoUninstaller, I get an error message from POL Debugger. I've used POL_Shortcut_QuietDebug, but this only seems to fix the problem when I use it from the POL Console.

Here's the revised version of the script:

#!/bin/bash
# Date : (2015-4-10)
# Last revision : (2015-4-10)
# Wine versions used : 1.6.2, 1.7.22, 1.4.1
# Distributions used to test : Linux Mint 17.1 (x64), Debian GNU/Linux 7.8 (x64)
# Author : MTres19

[ $PLAYONLINUX = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

POL_System_TmpCreate "RUninstaller"
cd "$POL_System_TmpDir"

TITLE="Revo Uninstaller (Free)"

POL_SetupWindow_Init
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "VS Revo Group" "www.revouninstaller.com" "MTres19" "$(eval_gettext '[Your Wineprefix of choice]')"

POL_SetupWindow_prefix_selector "$(eval_gettext 'Please select the Wineprefix in which you would like to install Revo Uninstaller.')"

PREFIX=$APP_ANSWER

POL_Wine_SelectPrefix "$PREFIX"

SHORTCUTNAME="RevoUninstaller on $PREFIX Wineprefix"

POL_Download "http://9d4da85dff3fdd198886-459beec849893df302ec58f8a71b3ad1.r61.cf1.rackcdn.com/revouninstaller.zip" "c581e60e67b83fc640741df7197ead86"
unzip "revouninstaller.zip" -d "$POL_USER_ROOT/wineprefix/$PREFIX/drive_c/Program Files"

POL_Shortcut "Revouninstaller.exe" "$SHORTCUTNAME"
POL_Shortcut_QuietDebug "$SHORTCUTNAME"

cd "$POL_USER_ROOT"

POL_System_TmpDelete

POL_SetupWindow_message "$(eval_gettext '$TITLE was successfully installed in your $PREFIX Wineprefix.')" "$(eval_gettext '$TITLE - Successfully Installed')"

POL_SetupWindow_Close
exit
petch Tuesday 14 April 2015 at 2:49
petch
Developer

Well, it seems to genuinely crash at times; POL_Shortcut_QuietDebug is just a bandaid for programs not returning meaningful exitcodes...

Editado por: petch