Difference between revisions of "Application Install Scripts"

From Amahi Wiki
Jump to: navigation, search
m (Added few details for diff-ing)
Line 10: Line 10:
 
= Useful Things =
 
= Useful Things =
  
The install script can use some utility scripts (we expect to improve on these as time goes on, so please feel free to ask for things to be canned as scripts as you see the need!).
+
The install script can use some utility scripts (we expect to improve on these as time goes on, so please feel free to ask for things to be canned as scripts as you see the need!). See below for
  
== hda-install-file ==
+
= Running the scripts by hand =
  
This script will install files with some details of the local installation replaced, namely:
+
 
 +
You can run the script by hand to test. This can simplify the debugging a lot.
 +
 
 +
mkdir -p /tmp/my-webapp-test
 +
cd /tmp/my-webapp-test
 +
wget http://url-for-muy-tar-ball-or-zip-file.tgz
 +
untar/unzip mytarball
 +
mv main-dir html
 +
then run the script here ...
 +
 
 +
 
 +
 
 +
== hda-install-file utility script ==
 +
 
 +
This utility script will install files with some details of the local installation replaced, namely:
  
 
<small>
 
<small>

Revision as of 21:26, 17 March 2009

The install and uninstall scripts are executed in the webapp directory for the app, say, for application

foobar

The script is run in

/var/hda/web-apps/foobar


Useful Things

The install script can use some utility scripts (we expect to improve on these as time goes on, so please feel free to ask for things to be canned as scripts as you see the need!). See below for

Running the scripts by hand

You can run the script by hand to test. This can simplify the debugging a lot.

mkdir -p /tmp/my-webapp-test
cd /tmp/my-webapp-test
wget http://url-for-muy-tar-ball-or-zip-file.tgz
untar/unzip mytarball
mv main-dir html
then run the script here ...


hda-install-file utility script

This utility script will install files with some details of the local installation replaced, namely:

@HDA_NETWORK@  --> 192.168.1    (the network)
@HDA_SELF@     --> 10           (the ip address of the HDA)
@HDA_DOMAIN@   --> home.com     (the domain)
@HDA_NETMASK@  --> 255.255.255  (the netmask)
@HDA_NICKNAME@ --> <nick>       (the nickname of the dyndns - <nick>.yourhda.com)

please don't assume much and use as generally as possible, as these may support more general settings in the future (like a more general netmask, etc.)


to change the contents of a file while installing an webapp

i.e. you would need this to edit configuration files for one-click installs in HDA.

for the examples i will use the (actually in development) configuration-file of the piwik-web-app.


example source (empty example-config-file delivered by piwik package): [file.orig]

<?php exit; ?> DO NOT REMOVE THIS LINE
this file is just here for documentation purpose
the config.ini.php is normally created during the installation process
when this file is absent it triggers the Installation process
the config.ini.php file contains information about the super user and the database access

[superuser] login = yourSuLogin password = yourSuPassword email = hello@piwik.org

[database] host = localhost username = databaseLogin password = datatabasePassword dbname = databaseName adapter = PDO_MYSQL ; PDO_MYSQL or MYSQLI tables_prefix = piwik_


example goal (in the config file after this process): [changed.orig]

<?php exit; ?> DO NOT REMOVE THIS LINE
file automatically generated during the piwik installation process (and updated later by some other plugins)

[superuser] login = admin password = 34131c9eef54abfe3aaed6fa275d01dd email = admin@hda.@HDA_DOMAIN@

[database] host = localhost username = root password = "hda" dbname = piwik adapter = PDO_MYSQL port = 3306

tables_prefix	= piwik_

What we have to do to achive this is to write a script. ;) We need to get the differences between the files. For this we will use diff-command. you got the files orig.file and changed.file. Now we need to diff them! use the shell for this and type (inside that folder) diff -U orig.file changed.file > my.diff

After you've done this, you got a file named my.diff. Inside it you got the code which you need to add inside your inside script. :)

Have fun creating your apps. If you need something ask at IRC :)