cPanel install script "latest" inside

Here you can find tutorials and notes for server-side maintenance/configuration

cPanel install script "latest" inside

Postby lik » Sat Nov 12, 2011 12:51 am

As you may already know, cPanel uses makeself (Make self-extractable archives on Unix) to generate their initial install shell script called "latest".
It`s quite easy to determine it:
Code: Select all
wget -N http://httpupdate.cpanel.net/latest
head latest

#!/bin/sh
# This script was generated using Makeself 2.1.3
...
label="Cpanel & WHM Installer"
...

So, "latest" cPanel installer is just self-extractable tar.gz archive from a directory. Let`s view built-in makeself metadata/info:
Code: Select all
# sh latest --help

Makeself version 2.1.3                                                                                                                                                                                                                                                         
 1) Getting help or info about latest :                                                                                                                                                                                                                                       
  latest --help    Print this message                                                                                                                                                                                                                                         
  latest --info    Print embedded info : title, default target directory, embedded script ...                                                                                                                                                                                 
  latest --version Display the installer version                                                                                                                                                                                                                               
  latest --lsm     Print embedded lsm entry (or no LSM)                                                                                                                                                                                                                       
  latest --list    Print the list of files in the archive                                                                                                                                                                                                                     
  latest --check   Checks integrity of the archive                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                               
 2) Running latest :                                                                                                                                                                                                                                                           
  latest [options] [--] [additional arguments to embedded script]                                                                                                                                                                                                             
  with following options (in that order)                                                                                                                                                                                                                                       
  --confirm             Ask before running embedded script                                                                                                                                                                                                                     
  --noexec              Do not run embedded script
  --keep                Do not erase target directory after running
                        the embedded script
  --nox11               Do not spawn an xterm
  --nochown             Do not give the extracted files to the current user
  --target NewDirectory Extract in NewDirectory
  --tar arg1 [arg2 ...] Access the contents of the archive through the tar command
  --                    Following arguments will be passed to the embedded script

And, for example, embedded info:
Code: Select all
# sh latest --info

Installer Version: v00016
Installer Revision: cd0e5c998da04fab845f7e0d6e0983dc837b3336
Identification: Cpanel & WHM Installer
Target directory: installd
Uncompressed size: 180 KB
Compression: gzip
Date of packaging: Fri Sep 30 16:41:36 CDT 2011
Built with Makeself version 2.1.3 on linux-gnu
Build command was: utils/makeself installd latest Cpanel & WHM Installer ./bootstrap
Script run after extraction:
     ./bootstrap
directory installd is permanent

Unpack the content and prevent further execution of an embedded script after extraction:
Code: Select all
# sh latest --noexec --target latest_unpacked

Creating directory latest_unpacked
Verifying archive integrity... All good.
Uncompressing Cpanel & WHM Installer.............

View result directory 'latest_unpacked' content:
Code: Select all
# ls -1 latest_unpacked

access.conf
bashrc
blank
bootstrap
bootstrap-dnsonly
fixconf.pl
install
installlogo
issue
issue.net
motd
RpmUtils.pm
VERSION

Install script is a plain text readable perl script:
Code: Select all
# file latest_unpacked/install
latest_unpacked/install: a /usr/bin/perl script, ASCII text executable

Among basic routine tasks I found couple of interesting (for me) points. Namely, cPanel install script will look for custom EasyApache yaml profile first /etc/cp_easyapache_profile.yaml and will use it during the initial Apache/PHP compilation. Great news, because one can avoid additional run of EasyApache script with desired profile after "sh latest" and save tens of minutes.
lik
Founder
Founder
 
Posts: 497
Joined: Wed Dec 15, 2010 3:21 am

Return to Server Side Actions

 


  • Related topics
    Replies
    Views
    Last post