sudo whoami returns root.
sudo whoami returns root.
lolwut
most users install programs from either their home Dir's or the desktop, you could check for either of those as the current dir, and go from there.
So, if you can split $happy into separate vars and kick out lost+found from our list then it is possible to get the home dirs of each user...Code:jason@meinDell:~$ happy=$(ls /home) jason@meinDell:~$ echo $happy jason lost+found
lolwut
Isn't it always going to end up being root though, because it's always root that's running the script inside the .deb no matter who starts it off? (might be wrong)
happy with just a link in the main KDE or Gnome menu tbh, it seems more sensible like that, if I can figure it out.
I'm wondering whether this is the right place to be:
http://www.debian.org/doc/packaging-....html/ch1.html
Last edited by ecs_pf5; April 28th, 2008 at 03:56 AM.
MS-6534v1 no-name mobo,
Vanta 8Mb AGP video, IDE 10Gb maxtor sda, Intel P2 1.9GHz FSB 100MHz,
512 Mb PC-133 RAM,
Kubuntu 8.10 32-bit (desktop CD)
Yeah, someone help him get it into the menu, that's a much better place.
This should be moved to programming talk though
ecs_pf5, That's why I realise that you cannot use $HOME like variables.
~ = $HOME = /home/`whoami` = ...
But where they invoke it can be used, I suppose.
lolwut
I'm wondering about dh_installmenu now having taken amor to bits.
Picked on amor for no other reason than it looked like a smallish .deb that did create a menu item, and I figured if I opened it up it might show some hints on how it inserts it's listing into the main menu.
This is from it's /control/postinst script (the one that runs immediately after file payload unpacking, during package install):
Inside it's unpacked folder tree payload, there is:Code:#!/bin/sh set -e # Automatically added by dh_installmenu if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then update-menus fi
/data/usr/share/menu/amor
which seems to be a text file configuring menu items:
Then there's a couple of directories of images:Code:?package(amor):\ needs="x11"\ section="Games/Toys"\ hints="KDE"\ title="AMOR"\ longtitle="AMOR (Amusing Misuse of Resources)"\ icon="/usr/share/pixmaps/amor.xpm"\ command="/usr/bin/amor"
/data/usr/share/pixmaps/amor.xpm --------> that looks like the menu icon
/data/usr/share/icons/hicolor/ --------> few more icons grouped by size in 4 subfolders, not sure they're menu related though
Looking at:
http://packages.debian.org/lenny/debhelper
As far as I can gather so far, one needs a file called 'rules' located in the /package_build_directory (not inside the /package_build_directory/DEBIAN directory, but beside it, directly inside package_build_directory - which seems to be referred to throughout the debian documentation as lower case /debian/ )
i.e. a package build structure something like
/BuildDirectory/DEBIAN/control
/BuildDirectory/DEBIAN/postinst
/BuildDirectory/DEBIAN/prerm
/BuildDirectory/usr/bin/my-executable-file
/BuildDirectory/rules ----------------------------------------> ???
.. and then, one calls debhelper programs directly within the rules file. so you call dh_installmenu in there, and somehow it configures the package to include menu items. Hopefully in some kind of system independent manner.
As yet, haven't got to grips with the detail.. not sure which files and resources you have to manually supply and which are automatically generated, and not too sure of the syntax for the dh_installmenu entry in the rules file.. The documentation is not sparse but it is, quite confusing to a newcomer from Windows-land.
There's no evidence of a rules file in amor's .deb, I guess it gets ditched by dpkg once it's done it's job. Once the debhelper package is installed though, it does contain some (confusing looking) example rules files in /usr/share/doc/debhelper/examples/
I don't know about update-menus, it doesn't seem to be on my system even after installing debhelper and dpkg-dev (maybe it isn't needed on Kubuntu/Ubuntu?) - edit - wasn't on my system, apt-get install menu fixed that
Now having *limited* success. Did manage to coax my .deb into placing a link on the K menu, however it's very shaky, the main category seemed to be taken from the old install of amor (now removed) whilst the actual link item itself did list & point to my own app. So this is on the right lines but I've got the structure & syntax messed up.
I had to shove dh_installmenu way up high in the rules file before it worked, up above all the other stuff (I am just using the simplest example file out of the debhelper examples directory)
-?-
Last edited by ecs_pf5; April 28th, 2008 at 09:29 AM.
MS-6534v1 no-name mobo,
Vanta 8Mb AGP video, IDE 10Gb maxtor sda, Intel P2 1.9GHz FSB 100MHz,
512 Mb PC-133 RAM,
Kubuntu 8.10 32-bit (desktop CD)
Well I got it working.. after a fashion
I read and read and read and played the old insomniac trick..
The way to do it seemed to be, to build the debian package using a menu file in {build directory}/usr/share/menu/ a la:
, then call 'update-menus' in the postinst and postrm scriptsCode:?package(packagename):\ needs="x11"\ section="Development"\ <-- say, if you want it in the 'Development' main menu title="Packagename"\ longtitle="Packagename (experiment)"\ icon="/usr/share/pixmaps/packagename.xpm"\ command="/usr/bin/packagename-executable"
however despite reading all the documentation I could find, and rebuilding the package numerous times, it never worked. I really did try and try but the debian package-building documentation just doesn't seem to work (clearly I'm doing something wrong somewhere, 4 or 5 tutorials can't all be wrong!)
Seems to be a couple of different package-building approaches that somewhat conflict in their details, varying in complexity level.. I got the packages to build okay but never, insert a menu item.
-------
Then in the end I found that if you make a 'Desktop Config File' with the right details in it using vi / kate / whatever:
.. and put it in the build folder as {build folder}/usr/share/applications/kde/packagename.desktopCode:[Desktop Entry] Categories=GTK;Development; <--- this seems to specify the menu link location Comment=Get menus working Comment[en_GB]=Get menus working Exec[$e]=packagename GenericName=An experiment GenericName[en_GB]=An experiment Icon=packagename MimeType= Name=Packagename Name[en_GB]=Packagename Path[$e]= StartupNotify=true Terminal=false TerminalOptions= Type=Application Version=1.0 X-DCOP-ServiceType= X-KDE-SubstituteUID=false X-KDE-Username=
.. and supply a set of icons in {build folder}/usr/share/icons/hicolor/16x16/apps/
(and the corresponding 22x22, 32x32, 48x48 dirs)
.. and then build the package using
sudo dpkg -b {build folder} {packagename.deb}
hey presto - a package that installs, places a link in the proper place in the main menu, and then uninstalls completely via adept.
-----------
Wish I could find the trick to getting the /usr/share/menu/<packagename> menu-file method working though, because that seems to be the proper way to do it, and I guess would stand more chance of working properly across different systems?
Sorry that this has gone on a tangent regards coding, is it possible a mod can move the thread to the programming section?
Last edited by ecs_pf5; April 29th, 2008 at 11:55 PM.
MS-6534v1 no-name mobo,
Vanta 8Mb AGP video, IDE 10Gb maxtor sda, Intel P2 1.9GHz FSB 100MHz,
512 Mb PC-133 RAM,
Kubuntu 8.10 32-bit (desktop CD)
Bookmarks