Forums

Need help making a script

Variable fu or just missing the point, unsure.

Auteur Réponses
schotty Lundi 25 Janvier 2016 à 2:41
schotty

OK, simply put, I would like to have in a POL script the ability to choose what arch the install will be for (32/64 bittedness).

 

My code snippet below just flat out doesn't work, nor did some of the more straightforward attempts.  Is there a preferred way to handle this?  And although an arch type of "auto" technically would work, there are some issues currently in most installs I have of 64 bit wine things, and would like to leave the option for the boring and unadventurous to just stick with 32 bit for sanity's sake.  The code snippet follows my variable block for all the other stuff and the POL_SetupWindow_Init and POL_Debug_Init.

POL_SetupWindow_menu "Choose installation type" "$INSTALL_ARCH" "32-Bit~64-Bit" "~"

if [ "$INSTALL_ARCH" == "32-Bit" ]; then
  ARCH="x86"
fi
if [ "$INSTALL_ARCH" == "64-Bit" ]; then
  ARCH="amd64"
fi
POL_System_SetArch = "$ARCH"

The obvious first start was to do the if statement and immediately set POL_System_SetArch to the appropriate choice.  Didn't work.  Always got 32 bit.  Hell, I got so mad as to just set both to be amd64 to just see what would happen.  Still got noped.  I clearly am missing something, and would love it if someone could point out what I botched up here.

 

Thanks!

Andrew.

Edité par schotty

petch Lundi 25 Janvier 2016 à 7:04
petch

Hi,

Second argument of POL_SetupWindow_menu is the window title; Answer is always returned in $APP_ANSWER.

http://wiki.playonlinux.com/index.php/Scripting_-_Chapter_11:_List_of_Functions#POL_SetupWindow_menu_.284.0.2B.29

I suggest something like

APP_ANSWER="x86"
[ "$AMD64_COMPATIBLE" = "True" ] && POL_SetupWindow_menu "$(eval_gettext 'Choose the installation architecture')" "$TITLE" "x86~amd64" "~"
INSTALL_ARCH="$APP_ANSWER"

so you don't bother 32bit systems owners with a question they could just answer incorrectly ;)

schotty Mardi 16 Février 2016 à 2:23
schotty

Sorry for the late reply, but I wanted to say thanks, this seems to be what I needed to know.

 

I have a few scripts in the kettle, and when fully cooked I will publish them.  Thanks again, I appreciate the help in figuring this all out.  I want to future-proof things while I have a chance, so I figured I would do things the right way immediately, rather than hack a soultion in later.

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmca-notice@playonlinux.com