Script to run Chrome as Spot in Slacko

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
belham2
Posts: 1715
Joined: Mon 15 Aug 2016, 22:47

Script to run Chrome as Spot in Slacko

#1 Post by belham2 »

Hi all,

This is probably brain-dead simple for you guys, but it is proving a brick wall to my old brain. Courtesy of murga poster "Watchdog', he has a trick for getting the latest downloadable (from Google) Chrome to run as both "Spot" plus with "Sandboxing" fully employed.
Here's how things are structured at the moment:

1) In Slacko64-700 (6.9.9.9.)
2) have placed the latest, full Google Chrome64 in "Spot" directory
3) also placed palemoon64 in /opt/directory for use as a LIB_PATH when launching Chrome in Spot
4) in "spot" directory is also this simple script:

Code: Select all

# cat /root/spot/chrome.sh
#!/bin/sh
SPOT_HOME=$(awk -F: '$1=="spot" {print $6}' /etc/passwd)
cd $SPOT_HOME/Downloads
LD_LIBRARY_PATH=/mnt/sda1/palemoon_64:$LD_LIBRARY_PATH
exec ~/google/chrome/google-chrome --user-data-dir="$SPOT_HOME/.config/chrome" "$@"
5) Now Chrome will launch, but only when you enter these 4 commands in a terminal

Code: Select all

chown -R spot /root/spot
cd /root/spot
su spot
sh chrome.sh

....then Chrome starts up right away, as previously mentioned with both as "Spot' and "Sandbox" function fully employed.


My question is this: it's a pain in the butt to have to type those 4 commands in a terminal every time you want to launch Chrome. Is there a way to put all of those 4 commands in "one script", so that when that script is clicked, it will launch--perform those 4 commands---and thus Chrome will start right up???

Thank you for help/advice/tips/etc.

User avatar
puppyluvr
Posts: 3470
Joined: Sun 06 Jan 2008, 23:14
Location: Chickasha Oklahoma
Contact:

#2 Post by puppyluvr »

:D Hello,
Put them in a script.
Put a " | " between the commands, bash will execute them sequentially.
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!

Puppy since 2.15CE...

belham2
Posts: 1715
Joined: Mon 15 Aug 2016, 22:47

#3 Post by belham2 »

puppyluvr wrote::D Hello,
Put them in a script.
Put a " | " between the commands, bash will execute them sequentially.

Awwwww, goddang it, it was that simple? I should be whipped :oops: :roll:

Thank you so much, Puppyluvr!! :wink:

belham2
Posts: 1715
Joined: Mon 15 Aug 2016, 22:47

#4 Post by belham2 »

{followup}

..Hi again, puppyluvr. I tried these two ways below, but neither of them worked. How am I doing it wrong? :oops:

Code: Select all

#!/bin/sh
chown -R spot /root/spot | cd /root/spot | su spot | sh chrome.sh

Code: Select all

#!/bin/sh
chown -R spot /root/spot | 
cd /root/spot | 
su spot | 
sh chrome.sh

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#5 Post by fredx181 »

I think adding the " | " is not right, doesn't this just work ?

Code: Select all

#!/bin/sh
chown -R spot /root/spot
cd /root/spot
su spot
sh chrome.sh
 
Or maybe:

Code: Select all

#!/bin/sh
chown -R spot /root/spot
cd /root/spot
xhost +local:spot
su spot -c ./chrome.sh
 
Sorry didn't test, not on a puppy now, so just guessing, hopefully brings you in right direction.

Fred

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#6 Post by amigo »

Put a " | " between the commands, bash will execute them sequentially.
This is not correct. The pipe '|' funnels the output of the program on the left side of it, to the program on the right side *as stdinput*.
Not to be confused with &&, which does what you said '|' does, or '||' which is equal to 'or' -run the left-side program, and only if it fails then run the right-side program

cat run-spot-run
#!/bin/sh
chown -R spot /root/spot
cd /root/spot
su spot
sh chrome.sh

copy run-spot-run anywhere in your path you want, even put a link to it on your pinboard. Then just clicking the icon would do the whole thing.

belham2
Posts: 1715
Joined: Mon 15 Aug 2016, 22:47

#7 Post by belham2 »

Thank you, Fred & Amigo (and puppyluvr)!

I ended up using Fred's 2nd example and Chrome fired right up.

Thank you so much all. :D :wink:

Post Reply