Author |
Message |
s243a
Joined: 02 Sep 2014 Posts: 2205
|
Posted: Mon 18 May 2015, 01:21 Post subject:
Script to Replace Nautilus for Dropbox |
|
Fatdog (and likely other slackware based versions of pupplinux) does not come with nautilus
The consequence is that when you right click on the dropbox icon (located on the taskbar after typing "dropbox start -i") you get the error "no nautilus" and the folder does not open. I found on another site that the trick is to replace nautilus with a bash scrip.
Here is my hack:
Code: | #!/bin/bash
#echo 'hi'"$@" 1>&2
exec rox $2
exit 0
|
(script full name: /usr/local/bin/nautilus
The commented out echo was because I needed to see what the input arguments were which dropbox was passing to this script.
The arguments were:
Code: |
--no-desktop /root/dropbox
|
rox does not recognize the "--no-desktop" option. The proper way to do this script would be to process each argument one by one and then either translate or remove each option as needed. I may do this later when I get time. The risk of my hack is that some other program may think that nautilus exists and act in appropriately as a consequence.
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4872 Location: Blue Springs, MO
|
Posted: Mon 18 May 2015, 08:22 Post subject:
|
|
Here is a start... currently strips all options, but you can just add different case statements as needed for supported options
Code: | #!/bin/sh
for x in $@; do
[ $INITIALIZED ] || INITIALIZED=1 && set --
case "$x" in
-*);; #remove all options
*)set $@ $x
esac
done
rox $@ |
If there is a rox option that is similar to the nautilus option, the case statement would look like:
--some-nautilus-option) set $@ --equivalent-rox-option;;
_________________ Check out my github repositories. I may eventually get around to updating my blogspot.
|
Back to top
|
|
 |
s243a
Joined: 02 Sep 2014 Posts: 2205
|
Posted: Thu 01 Feb 2018, 01:50 Post subject:
|
|
technosaurus wrote: | Here is a start... currently strips all options, but you can just add different case statements as needed for supported options
Code: | #!/bin/sh
for x in $@; do
[ $INITIALIZED ] || INITIALIZED=1 && set --
case "$x" in
-*);; #remove all options
*)set $@ $x
esac
done
rox $@ |
If there is a rox option that is similar to the nautilus option, the case statement would look like:
--some-nautilus-option) set $@ --equivalent-rox-option;; |
I finally got around to trying this but I modified it some because I didn't understand some things in your script.
My script is
Code: |
#!/bin/sh
ARGS=()
for x in $@; do
case "$x" in
--no-desktop);; #remove all options
*)ARGS+=($X)
esac
done
rox ${ARGS[*]}
|
And I had help from the two stack overflow threads:
- Expanding an array in BASH [duplicate]
- https://stackoverflow.com/questions/21542054/how-to-intercept-and-remove-a-command-line-argument-in-bash
I never tried your script as you wrote it because I don't understand what "set --" does. I don't know the function of the "INITIALIZED" variable, and I don't understand how you can assign to the same variable that you are removing stuff from in a loop. It's probably some things that I don't know about linux but no-one always writes 100% bug free code.
Anyway, I tested my script and it works. Maybe you script would also work. I don't know. Thanks for the help though because I used your script as the starting point
|
Back to top
|
|
 |
s243a
Joined: 02 Sep 2014 Posts: 2205
|
Posted: Sat 20 Apr 2019, 23:52 Post subject:
|
|
s243a wrote: |
I finally got around to trying this but I modified it some because I didn't understand some things in your script.
My script is
Code: |
#!/bin/sh
ARGS=()
for x in $@; do
case "$x" in
--no-desktop);; #remove all options
*)ARGS+=($X)
esac
done
rox ${ARGS[*]}
|
And I had help from the two stack overflow threads:
- Expanding an array in BASH [duplicate]
- https://stackoverflow.com/questions/21542054/how-to-intercept-and-remove-a-command-line-argument-in-bash
I never tried your script as you wrote it because I don't understand what "set --" does. I don't know the function of the "INITIALIZED" variable, and I don't understand how you can assign to the same variable that you are removing stuff from in a loop. It's probably some things that I don't know about linux but no-one always writes 100% bug free code.
Anyway, I tested my script and it works. Maybe you script would also work. I don't know. Thanks for the help though because I used your script as the starting point  |
I'm incorporating this into a dropbox package that I'm building for TazPup64 (available at this link). Here's the recepit, which contains the post install script.
Code: |
PACKED_SIZE="76.0K"
UNPACKED_SIZE="392.0K"
PACKAGE="dropbox"
version="2019.02.14"
category="util"
SHORT_DESC="Virtualization Utility"
MAINTAINE="Dropbox"
WEB_SITE="https://www.dropbox.com/"
DEPENDENCIES="python3-pygobject python3 atk glibc cairo glib gtk3 pango lsb-release gdk-pixbuf"
post_install(){
#See post: http://www.murga-linux.com/puppy/viewtopic.php?p=981866#981866
if [ -z "`which nautilus`" ]; then
echo '#!/bin/sh
ARGS=()
for x in $@; do
case "$x" in
--no-desktop);; #remove all options
*)ARGS+=($X)
esac
done
rox ${ARGS[*]} ' > /usr/bin/nautilus
chmod +x /usr/bin/nautilus
fi
}
|
hope it works
|
Back to top
|
|
 |
6502coder

Joined: 23 Mar 2009 Posts: 653 Location: Western United States
|
Posted: Mon 22 Apr 2019, 01:46 Post subject:
|
|
In
Code: | for x in $@; do
case "$x" in
--no-desktop);; #remove all options
*)ARGS+=($X)
esac |
is that really supposed to be lowercase "x" in lines 1 and 2, but uppercase "x" in line 4?? Seems like it should be lowercase everywhere (or uppercase everywhere).
|
Back to top
|
|
 |
s243a
Joined: 02 Sep 2014 Posts: 2205
|
Posted: Mon 22 Apr 2019, 02:14 Post subject:
|
|
6502coder wrote: | In
Code: | for x in $@; do
case "$x" in
--no-desktop);; #remove all options
*)ARGS+=($X)
esac |
is that really supposed to be lowercase "x" in lines 1 and 2, but uppercase "x" in line 4?? Seems like it should be lowercase everywhere (or uppercase everywhere). |
Good eye! Looks like I need to fix this. :O
|
Back to top
|
|
 |
|