PDA

View Full Version : [all variants] single command to #-out one specific line of one specific file?



earthpigg
August 3rd, 2009, 05:36 AM
hello,

could someone do me a favour and patch together a single terminal command to modifiy /etc/xdg/autostart/nm-applet.desktop, so that the following line is either commented out or removed, or has "LXDE;" added to the end??


ep@chris-laptop:/etc/xdg/autostart$ cat nm-applet.desktop
[Desktop Entry]
Name=Network Manager
Comment=Control your network connections
Icon=nm-device-wireless
Exec=nm-applet --sm-disable
Terminal=false
Type=Application
OnlyShowIn=GNOME;XFCE;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=NetworkManager
X-GNOME-Bugzilla-Component=general
X-GNOME-Autostart-enabled=true
X-Ubuntu-Gettext-Domain=nm-applet



im not useless with the terminal, but not that good.


(nm-applet is the outstanding gnome/xfce networking applet... that also happens to work perfectly well with lxde.)

mgranet
August 3rd, 2009, 05:43 AM
You can just access the file and edit as you please with a text editor. It would look like this:
sudo gedit nm-applet.desktop from the directory where it is located. (/etc/xdg/autostart)

earthpigg
August 3rd, 2009, 05:48 AM
You can just access the file and edit as you please with a text editor. It would look like this:
sudo gedit nm-applet.desktop from the directory where it is located.

i know, thank you :D

i am making a custom .iso using stock completely unmodified Ubuntu packages and config files that i intend to distribute.

all of the ubuntu packages work perfectly well with each-other, except that nm-applet seems to think it only works with xfce and gnome.

i'd like to be able to provide a single command to folks for their use to enable nm-applet.

aysiu
August 3rd, 2009, 05:51 AM
How about using Remastersys (http://www.psychocats.net/ubuntu/remastersys) to make your custom .iso? No knowledge of bash programming necessary.

schauerlich
August 3rd, 2009, 05:55 AM
How about using Remastersys (http://www.psychocats.net/ubuntu/remastersys) to make your custom .iso? No knowledge of bash programming necessary.

I think he has the packages he would like together, he just wants to make it easier to modify one of the configuration files.

@OP, you could use sed. Google is your friend.

It would look something like this:


sudo cp /etc/xdg/autostart/nm-applet.desktop /etc/xdg/autostart/nm-applet.desktop.backup && \
sed s/OnlyShowIn=GNOME;XFCE;// /etc/xdg/autostart/nm-applet.desktop.backup > /etc/xdg/autostart/nm-applet.desktop

earthpigg
August 3rd, 2009, 06:00 AM
How about using Remastersys (http://www.psychocats.net/ubuntu/remastersys) to make your custom .iso? No knowledge of bash programming necessary.

that is what i am using - fresh installs of the iso work absolutely amazingly (my hat is off to remastersys), except for this one issue.

aysiu
August 3rd, 2009, 06:16 AM
That's odd that Remastersys wouldn't work with just that one file.

Well, this is the command, I believe:
sudo cp /etc/xdg/autostart/nm-applet.desktop /etc/xdg/autostart/nm-applet.desktop.backup && sudo sed -i 's/OnlyShowIn/#OnlyShowIn/g' /etc/xdg/autostart/nm-applet.desktop

schauerlich
August 3rd, 2009, 06:18 AM
I edited my last post several times, but it should work now.

EDIT: And I see aysiu beat me to it! Oh well.

earthpigg
August 3rd, 2009, 06:26 AM
great, thanks!


That's odd that Remastersys wouldn't work with just that one file.

it does, but then my moral obligations under my understanding of the GPL, etc, would not be fulfilled by me simply pointing to archive.ubuntu.com for folks that want source code, as my modification to that config file would not be reflected by what would be generated by someone that went to archive.ubuntu.com and compiled themselves...

as i see it, my choices are:

1. let users run the command you provided (thanks again), and point users to archive.ubuntu.com for source code.

2. make the modification to stock ubuntu software myself, and then host the source code. since i dont know how to program, this would be silly.

3. make the modification to stock ubuntu software myself, not host source code, and violate the GPL.

schauerlich
August 3rd, 2009, 06:31 AM
it does, but then my moral obligations under my understanding of the GPL, etc, would not be fulfilled by me simply pointing to archive.ubuntu.com for folks that want source code

Moral obligations. Following the terms of software licenses. How cute. :)

earthpigg
August 3rd, 2009, 06:48 AM
Moral obligations. Following the terms of software licenses. How cute. :)

thanks.

swine like me have to work extra hard at that.