Changes

From Amahi Wiki
Jump to: navigation, search
m
Added few details for diff-ing
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.
 
<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 :)
21

edits