1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
#!/bin/bash
#
# Welcome to the DTC install maker !
# This will produce the tarball package
# Maintainer: Thomas GOIRAND <thomas [ at ] goirand.fr>
# please do not ship with you packages
# this is only a small coder tool...
#
if [ -z $FAKED_MODE ]; then
echo "Please run this with fakeroot, ie fakeroot ./makeRedhat"
exit 1
fi
VERSION=`cat version`
RELEASE=`cat release`
UNIX_TYPE=redhat
echo " --- Making DTC Redhat Manager Pachage (RPM) package ---"
# This block should be common to most unix packages :
echo "===> Copying files"
rm -rf dtc usr
mkdir -p dtc/etc/zones
cp -rf ../admin ../client ../shared ../doc ../email dtc/
echo "<?php
\$conf_dtc_version= \""$VERSION"\";
\$conf_dtc_release= \""$RELEASE"\";
\$conf_unix_type= \""$UNIX_TYPE"\";
?>" > dtc/shared/dtc_version.php
find dtc/ -iname 'CVS' -exec rm -rf {} \; &>/dev/null
find dtc/ -iname '*~' -exec rm -rf {} \; &>/dev/null
mkdir -p dtc/shared/imgcache
if ! [ -e dtc/admin/gfx ]
then
ln -s ../shared/gfx dtc/admin/gfx
fi
if ! [ -e dtc/email/gfx ]
then
ln -s ../shared/gfx dtc/email/gfx
fi
if ! [ -e dtc/client/gfx ]
then
ln -s ../shared/gfx dtc/client/gfx
fi
if ! [ -e dtc/admin/imgcache ]
then
ln -s ../shared/imgcache dtc/admin/imgcache
fi
if ! [ -e dtc/client/imgcache ]
then
ln -s ../shared/imgcache dtc/client/imgcache
fi
if ! [ -e dtc/email/imgcache ]
then
ln -s ../shared/imgcache dtc/email/imgcache
fi
# Copy the table dump in the admin directory
if ! [ -f sources/dtc_db.php ]
then
curdir=`pwd`
cd sources
echo "Dumping your DTC SQL structures."
echo -n "Please enter your mysql password: "
read conf_dbpass
if [ -e /usr/bin/php4 ] ;then
/usr/bin/php4 backup_db.php $conf_dbpass
else
/usr/bin/php backup_db.php $conf_dbpass
fi
cd $curdir
fi
cp sources/dtc_db.php sources/restor_db.php dtc/admin
find ./dtc -type d | xargs chmod 755
find debian/ -iname 'CVS' -exec rm -rf {} \; &>/dev/null
find debian/ -iname '*~' -exec rm -rf {} \; &>/dev/null
chown -R root:root dtc
chown nobody:65534 dtc/shared dtc/client/imgcache dtc/admin/imgcache dtc/shared/imgcache dtc/email/imgcache
chown nobody:65534 dtc/client/gfx dtc/admin/gfx dtc/shared/gfx dtc/email/gfx
cat sources/redhat/install.sh >dtc/admin/dtc.rpm-install.sh
cat sources/interactive_installer.sh >>dtc/admin/dtc.rpm-install.sh
cat sources/setup_mysql_db.sh >>dtc/admin/dtc.rpm-install.sh
cat sources/create_chroot.sh >>dtc/admin/dtc.rpm-install.sh
cat sources/configure_deamons.sh >>dtc/admin/dtc.rpm-install.sh
cat sources/redhat/uninstall.sh >dtc/admin/dtc.rpm-uninstall.sh
cat sources/uninstall_deamons.sh >>dtc/admin/dtc.rpm-uninstall.sh
# Specific RPM package actions :
echo -n "===> Creating tar file and move it to build tree: "
echo -n "tar..."
tar -cf dtc.tar.gz dtc
echo -n "mv..."
mkdir -p ~/rpmbuild/SOURCES
mkdir -p ~/rpmbuild/BUILD
mkdir -p ~/rpmbuild/RPMS
mv dtc.tar.gz ~/rpmbuild/SOURCES/
echo -n "rm..."
rm -rf dtc
echo "done!"
echo "===> Building specfile"
echo "Summary: Domain Technologie Control: a web admin interface for hosting virtual domain-names.
Name: dtc
Version: "$VERSION"
Release: "$RELEASE"
" >dtc.spec
cat sources/redhat/specfile_1 >>dtc.spec
echo "%changelog
* Mon Sep 23 2003 Thomas GOIRAND
1st redhat attempt
" >>dtc.spec
echo "===> Building dtc-"$VERSION"-"$RELEASE".noarch.rpm"
if [ ! -f ~/.rpmmacros ]; then
echo "%HOME %{expand:%%(cd; pwd)}
%_topdir %{HOME}/rpmbuild" > ~/.rpmmacros
fi
rpmbuild -bb --target=noarch dtc.spec
echo " -- Made dtc-"$VERSION"-"$RELEASE".noarch.rpm ---"
|