1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
|
#!/bin/bash
# Copyright (C) 2007-2010 PlayOnLinux Team
# Copyright (C) 2011 Pâris Quentin
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# PlayOnLinux / PlayOnMac 4 manual installation
[ "$PLAYONLINUX" = "" ] && exit
source "$PLAYONLINUX/lib/sources"
INSTALL_NUMBER="$(POL_Config_Read MANUAL_INSTALL_INCREMENT)"
INSTALL_NUMBER=$(( INSTALL_NUMBER + 1 ))
POL_Config_Write MANUAL_INSTALL_INCREMENT $INSTALL_NUMBER
TITLE="$(eval_gettext 'Manual installation')"
NOBUGREPORT="YES"
run_autorun()
{
POL_Debug_Message "Scanning autorun : $1"
NUMSTEP="3"
open=$(grep "open" -i "$1")
open=${open//" = "/"="}
icon=$(grep "icon" -i "$1")
icon=${icon//" = "/"="}
name=$(grep "Name" -i "$1")
name=${name//" = "/"="}
SetupIs=$(echo "$open" | cut -d\= -f2)
NameIs=$(echo $name | cut -d\= -f2)
IconIs=$(echo "$icon" | cut -d\= -f2)
if [ ! "$SetupIs" = "" ]
then
SetupIsNum=${#SetupIs}
SetupIs=${SetupIs:0:$(( SetupIsNum -1 ))}
else
POL_SetupWindow_message "$(eval_gettext 'No setup location found in autorun.inf')" "$(eval_gettext 'Autorun')"
POL_SetupWindow_Close
exit 0
fi
if [ ! "$NameIs" = "" ]
then
NameIsNum=${#NameIs}
NameIs=${NameIs:0:$(( NameIsNum -1 ))}
fi
if [ ! "$IconIs" = "" ]
then
IconIsNum=${#IconIs}
IconIs=${IconIs:0:$(( IconIsNum -1 ))}
fi
cdromDirIs="$MEDIA_DIR/$(echo $1 | cut -d / -f3)"
if [ "$IconIs" = "" ]
then
$IconIs = "null"
fi
icon_test=`ls "$cdromDirIs" | grep $IconIs -i`
if [ "$icon_test" = "" ]
then
IconIs="$PLAYONLINUX/etc/playonlinux.png"
else
IconIs="$cdromDirIs/$icon_test"
fi
if [ ! "$(echo $IconIs | grep '.exe$')" = "" ]
then
IconIs="$PLAYONLINUX/etc/playonlinux.png"
fi
POL_Debug_Message $cdromDirIs
POL_Debug_Message "Setup path : $cdromDirIs/$SetupIs"
POL_Debug_Message "CD name : $cdromDirIs/$NameIs"
POL_Debug_Message "Icon : $IconIs"
POL_Debug_Message "WinePrefix : $Prefix"
SETUP_PATH="$cdromDirIs/$SetupIs"
}
ManualInstall_ScriptInit ()
{
## $SCRIPTPATH
cat <<EOF > "$SCRIPTPATH"
#!/bin/bash
# Auto-generated script : $SCRIPTPATH
# Les trucs entre { } doivent être remplacés par POL Online
[ "\$PLAYONLINUX" = "" ] && exit
source "\$PLAYONLINUX/lib/sources"
POL_SetupWindow_Init
POL_Debug_Init
POL_SetupWindow_presentation "{SCRIPT_NAME}" "{SCRIPT_EDITEUR}" "{SCRIPT_URL}" "{SCRIPT_USER}" "$PREFIXNAME"
EOF
}
POL_SetupWindow_Init
POL_SetupWindow_free_presentation "$(eval_gettext 'Manual installation')" "$(eval_gettext 'Welcome to $APPLICATION_TITLE manual installation wizard.\n\nThis script will allow you to install any program on $APPLICATION and use it with all the tools\n\nWarning: We are unable to guarantee that your application will work perfectly.')"
LNG_LI_NEW="$(eval_gettext "Install a program in a new virtual drive")"
LNG_LI_PATCH="$(eval_gettext "Edit or update an existing application")"
POL_SetupWindow_menu "$(eval_gettext "What would you like to do?")" "$(eval_gettext 'Manual installation')" "$LNG_LI_NEW~$LNG_LI_PATCH" "~"
menu="$APP_ANSWER"
if [ "$menu" = "" ]
then
POL_Debug_Error "No action chosen"
POL_SetupWindow_Close
exit 0
fi
if [ "$menu" = "$LNG_LI_NEW" ]
then
POL_SetupWindow_textbox "$(eval_gettext "Please type a name for your application's virtual drive.\nThis name shouldn't contain spaces.")" "$TITLE"
PREFIXNAME="$APP_ANSWER"
SCRIPTPATH="$POL_USER_ROOT/scripts/${APP_ANSWER}_${INSTALL_NUMBER}"
SCRIPTNAME="${APP_ANSWER}_${INSTALL_NUMBER}"
ManualInstall_ScriptInit
echo "POL_Wine_SelectPrefix \"$PREFIXNAME\"" >> "$SCRIPTPATH"
POL_Wine_SelectPrefix "$PREFIXNAME"
fi
if [ "$menu" = "$LNG_LI_PATCH" ]
then
POL_SetupWindow_prefix_selector "$(eval_gettext "Please choose a program")"
PREFIXNAME="$APP_ANSWER"
SCRIPTPATH="$POL_USER_ROOT/scripts/${APP_ANSWER}_${INSTALL_NUMBER}"
SCRIPTNAME="${APP_ANSWER}_${INSTALL_NUMBER}"
ManualInstall_ScriptInit
echo "POL_Wine_SelectPrefix \"$PREFIXNAME\"" >> "$SCRIPTPATH"
echo "[ \"\$(POL_Wine_PrefixExists \"$PREFIXNAME\")\" = \"True\" ] || exit 0" >> "$SCRIPTPATH"
POL_Wine_SelectPrefix "$APP_ANSWER"
fi
if [ "$WINEPREFIX" = "" ]
then
rm "$SCRIPTPATH"
POL_Debug_Fatal "No name chosen"
fi
LNG_WC_ASSWV=$(eval_gettext "Use another version of Wine")
LNG_WC_CONFWINE=$(eval_gettext "Configure Wine")
LNG_WC_USEWT=$(eval_gettext "Install some libraries")
ITEMS="$LNG_WC_ASSWV~$LNG_WC_CONFWINE~$LNG_WC_USEWT"
POL_SetupWindow_checkbox_list "$(eval_gettext "What would you like to do before installation?")\n$(eval_gettext "If you don't know, unselect all")" "$TITLE" "$ITEMS" "~"
WHATTORUNBEFORE="$APP_ANSWER"
#Running AssignWine
if [ "$(echo $WHATTORUNBEFORE | grep -o "$LNG_WC_ASSWV")" == "$LNG_WC_ASSWV" ]
then
WINEVERSIONLIST="System"
WINEVERSIONDIRLIST=$(find "$REPERTOIRE/wine/$OS_NAME-$POL_ARCH/"* -maxdepth 0 -type d)
for single in $WINEVERSIONDIRLIST ; do
singleparsed=${single##*/}
WINEVERSIONLIST="$WINEVERSIONLIST~$singleparsed"
done
POL_SetupWindow_menu "$(eval_gettext "Which version of Wine would you like to use?")" "$TITLE" "$WINEVERSIONLIST" "~"
WINEVERSIONLIVE="$APP_ANSWER"
if [ "$WINEVERSIONLIVE" = "System" ]
then
WINEVERSIONLIVE=""
else
export POL_WINEVERSION="$WINEVERSIONLIVE"
fi
POL_System_SetArch "x86"
echo "export POL_WINEVERSION=\"$WINEVERSIONLIVE\"" >> "$SCRIPTPATH"
fi
POL_Wine_PrefixCreate
echo "POL_SetupWindow_prefixcreate" >> "$SCRIPTPATH"
#Running WineConfiguration
if [ "$(echo $WHATTORUNBEFORE | grep -o "$LNG_WC_CONFWINE")" == "$LNG_WC_CONFWINE" ]
then
POL_SetupWindow_wait_next_signal "$(eval_gettext "Configure Wine")" "$(eval_gettext 'Manual installation')"
cd "$WINEPREFIX"
POL_Wine winecfg
fi
#Running POL_Calls
if [ "$(echo $WHATTORUNBEFORE | grep -o "$LNG_WC_USEWT")" == "$LNG_WC_USEWT" ]
then
[ "$WINEPREFIX" == "" ] && POL_Debug_Fatal "WINEPREFIX is not set"
wineserver -k
ITEMS=$($POL_WGET $SITE/V4_data/repository/getf.php -O-)
POL_SetupWindow_checkbox_list "$(eval_gettext "Please make your choice")" "$APPLICATION_TITLE" "$ITEMS" "/"
old="$IFS"
IFS=/
set "$APP_ANSWER"
for i in $*
do
POL_Debug_Message "POL_Call_list is calling $i"
IFS="$old"
POL_Call "$i"
echo "POL_Call \"$i\"" >> "$SCRIPTPATH"
IFS=/
done
IFS="$old"
fi
[ "$POL_OS" == "Mac" ] && MEDIA_DIR="/Volumes"
[ "$POL_OS" == "Linux" ] && MEDIA_DIR="/media"
A_LIST=""
i=0
POL_SetupWindow_wait "$(eval_gettext 'Looking for runnable CD-ROMs')" "$TITLE"
cd "$MEDIA_DIR"
for device in *
do
AutorunInf=$(ls "$MEDIA_DIR/$device" | grep -i "autorun.inf")
POL_Debug_Message "Autorun : Checking $device..."
if [ ! "$AutorunInf" = "" ]
then
POL_Debug_Message "Autorun : Found $MEDIA_DIR/$device/$AutorunInf"
if [ $i = 0 ]
then
A_LIST="$MEDIA_DIR/$device/$AutorunInf"
B_LIST="CD-ROM : $device"
else
A_LIST="$A_LIST#$MEDIA_DIR/$device/$AutorunInf"
B_LIST="$B_LIST#CD-ROM : $device"
fi
i=$(( i+1 ))
fi
done
POL_Debug_Message "Autorun: Found $i media"
LNG_MANUAL_FILE="$(eval_gettext "Select another file")"
if [ ! "$i" = "0" ]
then
A_LIST="$A_LIST#MANUAL"
B_LIST="$B_LIST#$LNG_MANUAL_FILE"
POL_SetupWindow_menu_num "$(eval_gettext 'Please choose a way to install your program')" "$TITLE" "$B_LIST" "#"
N="$APP_ANSWER"
POL_Debug_Message "Action $N choosen"
CHOICE="$(cut -d "#" -f$(( N + 1 )) <<< "$A_LIST")"
fi
if [ "$CHOICE" = "MANUAL" ] || [ "$i" = "0" ]
then
cd "$HOME"
POL_SetupWindow_browse "$(eval_gettext "Please select the install file to run.")" "$TITLE"
echo "POL_SetupWindow_browse \"\$(eval_gettext \"Please select the install file.\")\" \"\$TITLE\"" >> "$SCRIPTPATH"
SETUP_PATH="$APP_ANSWER"
echo "SETUP_PATH=\"\$APP_ANSWER\"" >> "$SCRIPTPATH"
else
run_autorun "$CHOICE"
cat <<ENDCDROM >> "$SCRIPTPATH"
POL_SetupWindow_InstallMethod LOCAL,CD
if [ "\$INSTALL_METHOD" = "CD" ]
then
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "$SetupIs"
SETUP_PATH="\$CDROM/$SetupIs"
fi
if [ "\$INSTALL_METHOD" = "LOCAL" ]
then
POL_SetupWindow_browse "\$(eval_gettext "Please select the install file.")" "\$TITLE"
SETUP_PATH="\$APP_ANSWER"
fi
ENDCDROM
fi
if [ "$SETUP_PATH" = "" ]
then
rm "$SCRIPTPATH"
POL_SetupWindow_message "$(eval_gettext "You must choose a file!")" "$TITLE"
POL_SetupWindow_Close
exit 1
fi
WORKINGSETUP_PATH="$cdromDirIs/$NameIs"
cd "$WORKINGSETUP_PATH"
POL_SetupWindow_wait "$(eval_gettext '$APPLICATION_TITLE is installing your application...')" "$TITLE"
echo "POL_SetupWindow_wait \"\$(eval_gettext '$APPLICATION_TITLE is installing your application...')\" \"\$TITLE\"" >> "$SCRIPTPATH"
extension=$(echo "$SETUP_PATH" | sed 's/.*\.//g')
if [ "$extension" = "msi" ]
then
POL_Wine msiexec /i "$SETUP_PATH"
echo "POL_Wine msiexec /i \"\$SETUP_PATH\"" >> "$SCRIPTPATH"
else
POL_Wine "$SETUP_PATH"
echo "POL_Wine \"\$SETUP_PATH\"" >> "$SCRIPTPATH"
fi
POL_Wine_WaitExit
echo "POL_Wine_WaitExit" >> "$SCRIPTPATH"
rm "$POL_USER_ROOT/tmp/shortcuts" 2> /dev/null
POL_SetupWindow_shortcut_creator "$WINEVERSIONLIVE"
cat "$POL_USER_ROOT/tmp/shortcuts" >> "$SCRIPTPATH"
POL_SetupWindow_Close
echo "POL_SetupWindow_Close" >> "$SCRIPTPATH"
echo "exit" >> "$SCRIPTPATH"
exit
|