contents

4. Installation

An installation for two distributions is described in detail, so that it should be possible to install Magic on other distributions as well.

4.1 Preparation

For installation "root" privileges are required. The installation of the licensed and free version differs only little. With the licensed version a licence manager is installed additionally. I will describe the installation as exactly as possible, so that occurring errors should be eliminated easily (presumably).
The installation package should be copied into the directory "/usr/local/src".
The free version is called:
magic-8.3-1.i386.rpm-single
and should be renamed to :
magic-8.3-1.i386.rpm
after download.
The licensed Version is called:
magic-8.3-5.i386.rpm
Now you can check dependencies.
rpm -q --requires -p magic-8.3-5.i386.rpm|less
And proof installation scripts.
rpm -q --scripts -p magic-8.3-5.i386.rpm|less
There are three parts. At least we check whether the word processor Ed is installed on the system, which is used by the postinstall script.
rpm -qa | grep ed
If it is not installed you must well understand the installation scripts and correct the errors by manually or install Ed.
 

4.2 Start the installation

The command line for free linux server is
rpm -iv magic-8.3-1.i386.rpm
or for the license version is
rpm -iv magic-8.3-5.i386.rpm
The installation creates a new user with a home directory. The default is "magicadm". For changing the default user and path, you have to insert the command
--prefix /{DifferentPath}/{DifferentUserName}
before "-iv".

4.3 Verify the installation

Now you have to assign a password to the new user "magicadm".
passwd magicadm
Now the first part of the installation is finished. But ... now you have to configure the installed components.

4.4 The rpm-scripts

Here are the three scripts that control installation and deinstallation in "magic-8.3-5.i386.rpm" .
All lines introduced by # are comments by myself.
preinstall script (through /bin/sh):
#
# RPM_INSTALL_PREFIX is /usr/magicadm
#
mghome=$RPM_INSTALL_PREFIX
#
# the program basename removes the path of an expression
# result is magicadm
#
owner=`basename $mghome`
#
# -m = create homedir if not exist and copy default user into it
# -d = set homedirectory
# -g = set group
# -s = shell
#
/usr/sbin/useradd -d $mghome -g users -m -s /bin/csh $owner
#
# the file are copied and now perform the rest of the installation.
#
postinstall script (through /bin/sh):
HostName=`uname -n`
mghome=$RPM_INSTALL_PREFIX
owner=`basename $mghome`
#
# this must be an error and should be :groupid=users
#
groupid="users"
#
# write into every file the environment variable magic_home
#
Files="$mghome/etc/mgenv $mghome/etc/MAGIC.INI $mghome/servers/MGSERVER.INI
$mghome/sbin/cgi.sh"
Files="$Files $mghome/.cshrc $mghome/.login $mghome/.profile $mghome/.bashrc"
for  f in $Files ; do
       if [ -f $f ] ; then
          ed $f >> /dev/null 2>&1 << %
1,\$s;%MAGIC_HOME%;$mghome;
w
q
%
       fi
done
#
# configure the magic.ini file with the reference to the license manager.
#
  ed $mghome/etc/MAGIC.INI >> /dev/null 2>&1 << %
1,\$s;LicenseFile =.*;LicenseFile = 3111@$HostName;
w
q
%
#
# configure the license file
#
  ed $mghome/etc/license.dat 1>/dev/null 2>&1 << %
1,\$s;HOSTNAME;$HostName;
1,\$s;DAEMONLOCATION;$mghome/license/MAGIC;
w
q
%
#
# set several rights
#
chown -R $owner.$groupid $mghome
chown $owner.$groupid  $Files
chown root $mghome/servers/mgdispatch
chmod 4555 $mghome/servers/mgdispatch
postuninstall script (through /bin/sh):
mghome=$RPM_INSTALL_PREFIX
owner=`basename $mghome`
/usr/sbin/userdel  $owner

contents