View Single Post
  #1  
Old 17th March 2006, 19:11
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,652 Times in 4,461 Posts
Default How to build packages that can be installed with the ISPConfig update function.

The ISPConfig update manager installs packages with the .pkg file extension. These files are simple .zip files, they are named .pkg to prevent users from unpacking them before the upload.

The .zip files must be build with the option to not store path's (not even relative path's)!

Inside the .pkg package is a file named "package.ins". This text file contains the instructions for the installer.

The installer can perform the following actions

* Create and delete directories
* Copy and delete files
* Execute SQL commands
* Execute PHP and shell scripts


Commented example package.ins file:

Code:
################################################
#
# package.ins file
#
# Installation variables
#
# {app} ISPConfig Base directory.
# In ISPConfig 2.x this is always 
# /home/admispconfig/ispconfig
#
# {src} Contains the directory, where the installer
# has unpacked the contents of the .pkg file.
#
# {tmp} Temp folder
# In ISPConfig 2.x this is always 
# /home/admispconfig/ispconfig/temp
#
# {uninstall} Uninstall directory of the package
# This is not implemented yet!
#
################################################


################################################
# Most of the variables in this section ([setup])
# where not in use yet. They shall be used
# for a package database where you can select
# packages in a list inside ISPConfig and
# install them with onwe click.
################################################


[Setup]

MinVersion=2.0
AdminPrivilegesRequired=true
RequiredUser=admispconfig
AppName=ISPConfig
AppId=ISPConfig
AppType=patch
AppVersion=1.0
AppCopyright=Copyright © Projektfarm GmbH 2005
AppPublisher=projektfarm GmbH
AppPublisherURL=http://www.projektfarm.de/
CreateUninstall=true
UninstallFilesDir={uninstall}
Uninstallable=true
DefaultDirName={app}
DefaultDirTrenner=/
ServerRestart=no
ServicesRestart=apache,mysql
Compression=tgz
LicenseFile=license.txt

################################
# Create or delete Directories
################################

[Dirs]

# Make the directory: /home/www/xyweb.de/web/stats
MKDIR: "/home/www/xyweb.de/web/stats"

# Make the directory: /home/admispconfig/ispconfig/web/newmodule/lib
MKDIR: "{app}/web/newmodule/lib"

# Make the directory: /home/admispconfig/ispconfig/web/newmodule/lib/lang
MKDIR: "{app}/web/newmodule/lib/lang"

# Delete the directory: /home/admispconfig/ispconfig/web/oldmodule
RMDIR: "{app}/web/oldmodule"

################################
# Copy or delete files
################################

[Files]

# copy the file newfile.php which is inside the .pkg file to the directory /home/admispconfig/ispconfig/web/newmodule
# and make a chmod 555
CPFILE: "{src}/newfile.php"; DestDir: "{app}/web/newmodule"; DestName: "newfile.php"; Chmod: "555"

# copy the file tmp_de.lng which is inside the .pkg file to /home/admispconfig/ispconfig/web/newmodule/de.lng
# and make a chmod 555
CPFILE: "{src}/tmp_de.lng"; DestDir: "{app}/web/neuesmodul/lang"; DestName: "de.lng"; Chmod: "555"

# Delete the file /home/admispconfig/ispconfig/lib/de.lng
RMFILE: "{app}/lib/de.lng"


#################################################
# Execute SQL commands
#################################################

[SQL]
# Execute the SQL command: "UPDATE sys_user set X = Y" in the database "dbispconfig"
SQLEXEC: "UPDATE sys_user set X = Y"; Database: "dbispconfig"

# Execute the SQL commands that are stored in the file sqldump.sql that is inside
# the .pkg file in the database "dbispconfig"
SQLFILEEXEC: "sqldump.sql"; DATABASE: "dbispconfig"


#####################################################
# Execute bash or php scripts. All scripts are
# run with the priveliges of the user admispconfig
# even if you set the user to root
######################################################

[Run]
# Execute before the installation starts
RUNBEFOREINSTALL: "{src}/install.sh"; Parameters: "--silent --undelete" User: "admispconfig" Type: "shell"

# Execute after the installation has finished
RUNAFTERINSTALL: "{src}/install.php"; Parameters: "--silent --delete" User: "admispconfig" Type: "php"


#####################################################
# The uninstallation part has not been implemented yet.
# Any volunteers? :-)
######################################################

[UninstallRun]

# Run before uninstall
RUNBEFOREUNINSTALL: "{src}/install.sh"; Parameters: "--silent --undelete" User: "admispconfig" Type: "shell"

# Run after uninstall
RUNAFTERUNINSTALL: "{src}/install.php"; Parameters: "--silent --delete" User: "admispconfig" Type: "php"

[InstallDelete]
# Delete files after installation
RMFILE: "{app}/lib/de.lng"
RMDIR: "{app}/web/oldmodule"
If you want to see some real examples, download one of the existing packages, extract the contents with a zip extractor and have a look inside the package.ins file with a text editor.

http://www.ispconfig.org/downloads/webmail.pkg http://www.ispconfig.org/downloads/p...-2.6.4-pl3.pkg
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
Sponsored Links