LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > rainbowsally
User Name
Password

Notices


Rate this Entry

New-Make ready for hyperjump and KDE Menu's How-To

Posted 12-29-2012 at 10:35 PM by rainbowsally
Updated 08-06-2014 at 08:41 AM by rainbowsally

New-Make ready for hyperjump and KDE Menu's How-To

This is somewhat advanced stuff but.. maybe not. It might also appeal to anyone who has a little talent for tinkering who needs to set up a KDE menu for an application that doesn't have one. See warning below, however.

Today's features
  • Last of the first generation new-make installer/uninstallers (probably).
  • Usage example that installs and uninstalls a dummy application and icons into the KDE menus.

1.0.17[*] removed 'Error' string from finddeps done in 'all' when there are no elf binaries to install. It's just a notice. Corrected algorithm for getting mains.dat in the installer itself.

[TODO: Simplify editing and importing (installer issues, mostly) and start the next generation of new.make, hopefully with a less confusing bootstrap arrangement.]

Installs into HOME/bin which is already probably in your path, so you don't even need to modify .bashrc or whatever.

http://rainbowsally.org/rainbowsally...-1.0.17.tar.gz

That said; why even have a make-based installer? you might ask.

Well, for one thing you can create rpms super easily. For another, it is a great testing tool.

Allow me to demonstrate.

If you want to play with an installer/uninstaller for a KDE menu the basic file setup is in this TREE (see self extractor file below). The required files are easy to find in the TREE and even easier to find in the 'dat' files if you use new.make.

Once new-make is installed, go into the directory above TREE and type
Code:
new.make
Edit the Makefile to set
Code:
PREFIX =/
[Don't let there be a space after the slash. Make will think it's a space in the path.]

Init the dat files
Code:
make init
Then as SUPERUSER type
Code:
make install
and exit superuser or just wait a bit before uninstalling.

Find the new menu which may appear in various places depending on your linux and KDE version, and then as SUPERUSER type
Code:
make uninstall
And then go see how it worked. :-) No configs are written other than the desktop file which is removed when we uninstall.

Note: The pixmap is probably overkill and so might the low-color icons but no harm done. You might need to try a few different setups and look at existing desktop files in the corresponding directories to get your own installations to show in the exact menu where you want it. (See the show_cats code below.)

And that's what the new-make makefiles are great for. For testing. You won't believe how fast and easy it is until you try it.

The 'desktop' files can be viewed and modified with a text editor. Thought I'd better mention that. :-)

Note: If you can't find the '01-test' file under the Games menu, look for the attractive yet obtrusive icon in the applications menu. It may take a few seconds to appear as kbuildsycoca doesn't always update the menus immediately.

In fact the menu might blink closed as you go looking for the menu entry, after which the icon should be visible in the menus and hopefully where you wanted it to go.


Mine shows up in Games -> Action Games.

It will send up a message box when you click on the menu selection.

I'd better mention this again...

THIS TEST FILESET IS NOT A SANDBOX INSTALLER/UNINSTALLER. It's the real thing.

We don't do much of this messing around in the real linux file system, but demystifying the KDE menus is a big enough issue that its worth it. In fact if you've been having problems it might be worth d/loading the new-make system just to see how it works. Then toss it. Either that or copy the files in the TREE (see below) into the /usr folder as root manually, but then you'll also need to know what to uninstall, no? :-)

Here's the TREE (self extractor using lzma/xz and base64, both of which are fairly common tools these days).

file: TREE.sfxz
purpose: utility (executable)
Code:
#!/bin/sh
# base64 self extractor
# file: TREE

filename=TREE

# don't allow user to click on the file
if ! tty >/dev/null; then
  xmessage -center "
  $(basename $0)
  must be run in a terminal 
  "
  exit
fi

# create and/or clear out tmp dir
mkdir -p $HOME/tmp/sfxz
rm -rf $HOME/tmp/sfxz/*
base64 -d << _BEOF >$HOME/tmp/sfxz/$filename.xz
/Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj4E//B/BdABcLxwaA+Wqi5Buxe7+KvnUmDljZNSvGPzjL
rDRzXWekny8N959ZH+DxiKs/33eYHGbV3ieR4i1vGtlKw0AY2Y/2cHGpnnxlKGZhuvJOYaw/e6rJ
jq8728nb+VTC7RuyIdtX+o98iw8q1zjDaS6/XRmIyfrzV6ygKcqW8HqiCAl3Qf+GDv22yiGs/Ct3
leLB1p/ZkkjbZZaPPHwCg9x0RS2EQun7xnQKVGpG4SJ6udejtcrIr+Ci5AjRZAZ/5kvCojNgwVAs
Ojb3zSY+Wgv5zF/9DgJr9wQv9SoIJZrSxjVSnT70Z7nokvkmqu2eWsA9DTejoSooCCXHvNPxxsH8
Q9UwMuhxpBvlnj+2a9pxNmfENCBw26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+o0PbAR0/F4GTQkqnl0OXl2JhtbgHZa2UgkXY41tkGuZpEMkGGhRvcu6UH5Vajs
cZTfvSS68jS8Z6XMU9c7tO8ul2wqsLcsm4OdpD8eBV7TCuMmmIeW4jM9UUwJ3JGf6seorGkLNuGm
gfmKT5VLesUzzXzyWqGF0SdBY41mdP31hW+irtqtXS12MWhVBy2646+FhigAVR+G1N8b9r8qbsRK
bNlPUzl7IJKKuwAAiz1nBs/SDq4AAYwQgKABAOZN/eexxGf7AgAAAAAEWVo=
_BEOF

(cd $HOME/tmp/sfxz && tar -xaf TREE.xz)
rm -f $HOME/tmp/sfxz/TREE.xz
 
cat << _BEOF > $HOME/tmp/sfxz/post-extract
#!/bin/sh

is_yes() # returns OK if first char is Y or y
{
  local key=`echo $1 | cut -b1 | sed 's/y/Y/; /Y/!d'`
  [ "$key" == 'Y' ] && return 0 # true
  return 1 # false
}

if [ -e TREE ]; then
  printf "
  Overwrite existing file(s)? [N/y]:"
  read key
  if ! is_yes $key ;then
  echo "Aborting.."
    exit 0
  fi
fi

mv $HOME/tmp/sfxz/TREE .
_BEOF

sh $HOME/tmp/sfxz/post-extract
rm -rf $HOME/tmp/sfxz/*
rmdir $HOME/tmp/sfxz 2>/dev/null || true
rmdir $HOME/tmp 2>/dev/null || true
Here's a little program to view existing categories listings in your system that work and which you can paste into your 01-test.desktop file to watch how it installs the icon under different menus every time you change it.

Install, uninstall, edit and repeat until you're happy with the result. Then do the same thing with the REAL files you want to install and have show in the menu. Just change the names (and the icon name in the desktop file) add your new files, then 'make init' to automatically add the new files to the files lists and that's just about all there is to it.

Code:
see_cats() 
{ 
  for i in /usr/share/applications/*.desktop; do cat $i | sed '/Categories/!d'; done   
}

And just for fun, here's what your dat files should look like after you type 'make init' and a brief note as to what they are for.

file: deps.dat
purpose: dependencies list (none)
Code:


file: dirs.dat
purpose: list of directories created or installed into
Code:
usr/share/pixmaps
usr/share/kde4/apps/01-test/icons/locolor/48x48
usr/share/kde4/apps/01-test/icons/locolor/32x32
usr/share/kde4/apps/01-test/icons/locolor/16x16
usr/share/kde4/apps/01-test/icons/locolor
usr/share/kde4/apps/01-test/icons/hicolor/48x48
usr/share/kde4/apps/01-test/icons/hicolor/32x32
usr/share/kde4/apps/01-test/icons/hicolor/16x16
usr/share/kde4/apps/01-test/icons/hicolor
usr/share/kde4/apps/01-test/icons
usr/share/kde4/apps/01-test
usr/share/kde4/apps
usr/share/kde4
usr/share/applications
usr/share
usr/bin
usr

file: files.dat
purpose: files to install/uninstall including the 'desktop' file that sets the menu
Code:
usr/share/applications/01-test.desktop
usr/share/kde4/apps/01-test/icons/hicolor/48x48/01-test.png
usr/share/kde4/apps/01-test/icons/hicolor/16x16/01-test.png
usr/share/kde4/apps/01-test/icons/hicolor/32x32/01-test.png
usr/share/kde4/apps/01-test/icons/locolor/48x48/01-test.png
usr/share/kde4/apps/01-test/icons/locolor/16x16/01-test.png
usr/share/kde4/apps/01-test/icons/locolor/32x32/01-test.png
usr/share/pixmaps/01-test.png
usr/bin/01-test

file: links.dat
purpose: Symlinks, none. Usually for development versions of libs, etc.
Code:


file: remove.dat
purpose: For removing obsolete files or mistakes
Code:

[Note: The empty files above are indeed empty.]

PS. There IS a right way to do these menus. See 'xdg-desktop-menu --manual'.

The choice is yours. ;-)

- The Computer Mad Science Team

:-)
Posted in Uncategorized
Views 1070 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 01:02 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration