Difference between revisions of "Application Install Scripts"
m (Added few details for diff-ing) |
|||
Line 27: | Line 27: | ||
as these may support more general settings in the future | as these may support more general settings in the future | ||
(like a more general netmask, etc.) | (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. | ||
+ | |||
+ | <small> | ||
+ | for the examples i will use the (actually in development) configuration-file of the piwik-web-app.</small> | ||
+ | |||
+ | |||
+ | example source (empty example-config-file delivered by piwik package): | ||
+ | [file.orig] | ||
+ | <small> | ||
+ | ; <?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_ | ||
+ | |||
+ | </small> | ||
+ | |||
+ | |||
+ | example goal (in the config file after this process): | ||
+ | [changed.orig] | ||
+ | <small> | ||
+ | ; <?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_ | ||
+ | |||
+ | </small> | ||
+ | |||
+ | 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 <small>diff</small>-command. | ||
+ | you got the files <small>orig.file</small> and <small>changed.file</small>. | ||
+ | Now we need to diff them! use the shell for this and type (inside that folder) | ||
+ | <small>diff -U orig.file changed.file > my.diff</small> | ||
+ | |||
+ | After you've done this, you got a file named <small>my.diff</small>. | ||
+ | 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 :) |
Revision as of 20:55, 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!).
hda-install-file
This 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 :)