How to build packages that can be installed with the ISPConfig update function.

Discussion in 'Tips/Tricks/Mods' started by till, Mar 17, 2006.

  1. till

    till Super Moderator

    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/phpmyadmin-2.6.4-pl3.pkg
     
  2. calamidad

    calamidad New Member

    Build packages for ISPConfig to install webapps??

    I've just read the howto to build ISPConfig packages,

    Looks nice, but I'm just wondering if it can be used to install webapps into a client domain, i.e. : install drupal onto the jonh doe's domain my-john-doe-example-domain.com

    AFAIK at least a DOMAINDIR variable its needed, but unavailable.

    Is there something that I'm missing ? Can this be accomplished with the actual 2.2.21 ?
     
  3. till

    till Super Moderator

    The ispconfig pacake system is not meant to install software in client websites. It is meant to install or update softeare within the ispcinfig ssystem on port 81.
     
  4. calamidad

    calamidad New Member

    Do you recommend something to do this in a ispconfig managed server ?

    Thanks,
     

Share This Page