1

I am an maintainer for a lot of computers in my town running ubuntu 12.04 and 14.04 with mate desktop, this is to help people just having a computer that just works :), and i cannot make them all do terminal work, hense having a .deb install they can download from dropbox via facebook annonce to them will be much better.

So... i want to create a .deb file that does:

apt-get install compiz compiz-plugins compiz-plugins-extra compizconfig-settings-manager -y

and makes the config file in ~/.config/compiz-1/compizconfig/Default.ini so everything works, i will however advice them to start of by ALT + F2 _ compiz --replace to see if everything works ok.

But how do it do this?, i tried apt-get install in control but of course this does not work as it can't start a different install process while instilling this .deb...

this is how i have tried so far...

#!/bin/sh
apt-get install compiz compiz-plugins compiz-plugins-extra compizconfig-settings-manager -y
mkdir ~/.config/compiz-1
mkdir ~/.config/compiz-1/compizconfig
echo "[ezoom]
s0_zoom_in_button = <Super>Button4
s0_zoom_out_button = <Super>Button5

[core]
s0_active_plugins = core;composite;opengl;compiztoolbox;decor;wall;resize;regex;imgpng;snap;commands;mousepoll;place;grid;move;animation;scale;ezoom;staticswitcher;
s0_toggle_window_maximized_key = Disabled

[switcher]
s0_focus_on_switch = true
s0_icon_only = true
s0_mipmap = false

[decor]

[commands]
s0_run_command0_key = <Control><Alt>t
s0_command0 = mate-terminal
s0_command1 = mate-panel --run-dialog
s0_run_command1_key = <Alt>F2
s0_command2 = mate-screenshot
s0_run_command2_key = Print

[gnomecompat]

[resize]
s0_mode = 2" > ~/.config/compiz-1/compizconfig/Default.ini
muru
  • 197,895
  • 55
  • 485
  • 740
  • will try with the dependencies, but is there no way to have some way to setup the .ini in home directory?, this is needed since i want to make everything stream lined so users don't have to do much – Heine Nielsen Feb 08 '15 at 13:41
  • yes that might be the only way..., else ill use teamviewer, to bad this can't be done, but i just tried the depend: and it works like a charm, the whole point with this is of course it has to be more simple as if everything gets VERY simple and GUI only more will come to linux, of course now a days it is rare you need to use terminal (i still use it 100x a day :p ) – Heine Nielsen Feb 08 '15 at 13:55
  • Just did $HOME instead of ~ and failed in software center but running dpkg --configure -a after it works? and makes home dir and the ini file.... – Heine Nielsen Feb 08 '15 at 14:03
  • sudo :), but it marks it as read only... and just saw your answer will try that, i don't get the desktop reference?, the file can be edited with the CompizConfig Settings Manager. – Heine Nielsen Feb 08 '15 at 14:11
  • sudo doesn't reset $HOME, so $HOME is available and and points to the user's home directory. The .desktop file is what creates an icon in the Dash and the Launcher. – muru Feb 08 '15 at 14:13

1 Answers1

2

To install other packages along with yours, the simplest way is to mark them as dependencies.

Affecting a user's home directory or settings, however, cannot be easily done by a package. Packages are not supposed to do this, so there's no standard mechanism. What you can do, however, is install the script, and the new default configuration, along with a launcher for the script. So the package will install:

/usr/bin/my-compiz-config
/usr/share/applications/my-compiz-config.desktop
/usr/share/my-compiz-config/Default.ini

And the script, now called /usr/bin/my-compiz-config, will contain:

#!/bin/sh
mkdir -p ~/.config/compiz-1/compizconfig
cp /usr/share/my-compiz-config/Default.ini ~/.config/compiz-1/compizconfig/Default.ini

I took the liberty of moving the configuration file contents to a separate file.

The .desktop file will contain:

[Desktop Entry]
Type=Application
Terminal=true
Name=My Compiz Configuration
Exec=/usr/bin/my-compiz-config

Then the users can search for "My Compiz Configuration" in the Dash and run it. The whole thing can be accomplished from start to finish by the user entirely from the GUI.

Added by Heine Nielsen this is the control for the compiz-install.deb

Package: Compiz-install
Version: 1.0
Installed-Size: 9800
Architecture: all
Depends: compiz, compiz-plugins, compiz-plugins-extra, compizconfig-settings-manager
Maintainer: Heine Nielsen <email removed>
Description: Install Compiz + extras, and setup keys, settings etc
    Date-2015_02_08
muru
  • 197,895
  • 55
  • 485
  • 740
  • i get it, need to execute the .desktop file to make directory and copy file... is there no way of doing this in postinst?, this is an elegant solution and will make it easy, can also add compiz --replace last to get the whole thing started. – Heine Nielsen Feb 08 '15 at 14:16
  • @HeineNielsen Keyword: reliable. No reliable way. You can check if $HOME is not /root, or if $USER is not root, or the values of $UID or $EUID, and act accordingly. – muru Feb 08 '15 at 14:21
  • ok, well will try this solution, thanks so much muru :) – Heine Nielsen Feb 08 '15 at 14:23
  • 1
    well so far it works :), and all it takes after install is ALT + F2 and running my-compiz-config which turns up in the list of known applications :), and added compiz --replace the the "sh" and changed the Terminal to false so no terminal window would stay hanging around, now i just need to tell the user to add it to startup if everything works fine – Heine Nielsen Feb 08 '15 at 14:33
  • @HeineNielsen If you're up for a bit more scripting, you can use Zenity to create a GUI dialog which can ask the user if they want to add it to autostart, then your script can do that for them. – muru Feb 08 '15 at 14:35
  • yes good idea, been a long time since i used Zenity :), just have to find the autostart location/file in mate.... dont believe it is in dconf – Heine Nielsen Feb 08 '15 at 14:36
  • @HeineNielsen Copying the .desktop file to ~/.config/autostart is all that's needed, I think. See http://askubuntu.com/a/134369/158442 – muru Feb 08 '15 at 14:38
  • yes your right again, i can see i have volti.desktop in there right now as im using the volti mixer, now for some good old scripting :), the autostart file has to be another desktop file as it only has to have the "compiz --replace" and not having to rewrite the config making users config being reset... – Heine Nielsen Feb 08 '15 at 14:44
  • @HeineNielsen are you sure compiz --replace needs to be run on each login if no configuration is being changed? – muru Feb 08 '15 at 14:49
  • yes as standard it has to, else there might be somebody out there that puts it in lightdm or where it should be, but for me i have to start it for things to take effect, also good if you mess something up (and you will.... ) when messing around with ALL the compiz settings, it is good to just reboot or login/out and being able to change the "worng" settings and then run the compiz --replace to try again :) – Heine Nielsen Feb 08 '15 at 14:51
  • last comment, just send it out to test and it worked, it creates the .desktop in start menu under Other so no need to search/run it :), everything works, i have instructed the user to use the ALT + F2 and "compiz --replace" every time for a day or 2 to see if everything works, but ill update the install to include it with the setup as then you have the "shortcut" right in the start menu and if you don't need compiz you can just leave it off, but on my system everything seems to actually run a little better with compiz.... – Heine Nielsen Feb 08 '15 at 15:35