:: Re: [DNG] netman-autostart_0.1.1
Góra strony
Delete this message
Reply to this message
Autor: Rainer Weikusat
Data:  
Dla: dng
Temat: Re: [DNG] netman-autostart_0.1.1
Edward Bartolo <edbarx@???> writes:
>
> I did more edits to the netman-gui.postinst script as follows:
>
> --------------------
> 2) db_get netman-gui/netman-autostart
>         if [ "$RET" = "true" ]; then
>             file="/etc/xdg/autostart/netman.desktop";
>             cp /usr/share/applications/netman.desktop /etc/xdg/autostart/
>         else
>             if [ -f "/etc/xdg/autostart/netman.desktop" ]; then
>                 rm /etc/xdg/autostart/netman.desktop
>             fi    
>         fi    
>     ;;
> --------------------

>
> However, using dpkg-reconfiguer netman-gui I get the error:
>
> root@edbarx-pc:/home/edbarx# dpkg-reconfigure netman-gui
> /var/lib/dpkg/info/netman-gui.postinst: 24:
> /var/lib/dpkg/info/netman-gui.postinst: [-f: not found


The shell starts parsing something with splitting on unquoted whitespace
in order to turn the input into a sequence of 'words'. This means if
there's no whitespace between [ and -f, this won't end up invoking the
[ with an argument of -f but as [-f. Since the shell doesn't know
anything about that, it will try to run a program named [-f (which
doesn't exist).

The test can be omitted by using

rm -f ...

instead. Attempts to remove a file which doesn't exist then won't cause
rm to exist with an error status.