USING CUSTOM PLESK SKINS > Creating a Skin

Preparing a Skin Package for Uploading to the Control Panel

Once the skin contents are prepared, you need to create a skin package in order to be able to install your skin into the control panel. It is recommended that you use your favorite archiver software to pack all the skin files and directories in a zip or tar.gz archive, and then simply upload the created archive file to the control panel's skins repository. If desired, you can create a skin rpm package; to do this, follow the instructions provided below.

Creating a Temporary Build Directory

The first thing you need to do is to create a temporary build directory. It can be located anywhere on your hard disk. Let it be /tmp/skin_builds/ for example:

# mkdir /tmp/skin_build

Next, inside the temporary build directory create the complete path to where the skin will be located when installed in Plesk.

Creating the RPM Spec File

The RPM spec (specification) file contains data required for building the RPM package. Below is a sample spec file that could be used for the skin considered in our example. In this sample file:

  • Name: the skin package name,
  • Version: is the version number of the skin,
  • Release: is the release number of the skin,
  • License: license type can be GPL, Freeware, Commercial, or other common type.

# name of your skin to be called in CP
# quote it by the "shell" rules if it contains spaces or special characters
%define skinname 'My Skin'

# directory where to place your skin
# you may use any sequence of alphanumeric characters and underscores
%define skindir my_skin

# path where files of your skin is located
%define source /tmp/my_skin

Name: MySkin
Version: 0.0.1
Release: 1
License: BSD
Group: Applications/Internet
Summary: Example spec for Plesk
# END of customizable part
# you can leave the following unchanged in most cases
Buildroot: /var/tmp/build-%{name}-%{version}
Provides: plesk-skin 
Requires: psa >= 7.5

%define pleskdir /usr/local/psa/admin
%define pleskskins %{pleskdir}/htdocs/skins

%install
rm -rf $RPM_BUILD_ROOT%{pleskskins}/%{skindir}
mkdir -p $RPM_BUILD_ROOT%{pleskskins}
umask 022
cp -r %{source} $RPM_BUILD_ROOT%{pleskskins}/%{skindir}

%clean
test $RPM_BUILD_ROOT != /
rm -rf $RPM_BUILD_ROOT%{pleskskins}/%{skindir}

%description
This is a sample skin for Plesk 7.5 Reloaded™

%pre
%{pleskdir}/sbin/skinmng --test-install-directory --installdir=%{skindir}

%post
%{pleskdir}/sbin/skinmng --register --installdir=%{skindir} --name=%{skinname}

%preun
%{pleskdir}/sbin/skinmng --remove --installdir=%{skindir} --leave-files

%files
%defattr(-,root,root)
%{pleskskins}/%{skindir}/

To complete preparing the spec file for the custom skin from our example (my_skin), the above items need to be replaced with proper values.

Building the RPM Package

Once you have the temporary build directory with the skin files all set and the spec file complete you can proceed to building the RPM package for your skin.

NOTE

You must be logged in as root to build the RPM package.

Execute the following command:

# rpmbuild -bb SKIN.spec

Here SKIN.spec should be replaced with the name of your custom skin spec file described in the previous section.

Once the process of building the RPM package is complete you will find the package (in our example it will be MySkin-0.0.1-1.noarch.rpm) in the following directory: /usr/src/redhat/RPMS/noarch.


to top