Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
#! /bin/sh
# make-apt, make-yum2
# Create apt databases from a redhat mirror
# Based on the following scripts and information:
# http://freshrpms.net/apt/server/
# ftp://apt-rpm.tuxfamily.org/pub/ftp.tuxfamily.org/apt-rpm/scripts/
# http://mirror.phy.bnl.gov/apt-rpm/scripts/makeapt.sh
# Absolute directory for top of redhat mirror
MIRRORDIR=/home/yumadm/pub/package
# Absolute directory for top of apt repository
APTDIR=/home/yumadm/pub/up2date
# Name of distribution (case sensitive). Used below
DIST=RedHat
# Directory where `os' packages will reside, in MIRRORDIR,
# relative to MIRRORDIR/redhat/linux/VERSION/en/os/i386/
OSDIR=$DIST/RPMS
# Directory where `base' files such as comps.xml reside in MIRRORDIR.
BASE=$DIST/base
# URL of repository
ORIGINURL=localhost
ME=$(basename $0)
# The idea of full/all/quick is:
# * the first time you create the apt repository, choose "full".
# * each night (when updates are downloaded), relaunch with "quick"
# * if extra packages are put in 'extra' repository, relaunch with "quick"
# * if the main os packages change (should not), use "all"
if [ $# -ne 2 -o \( "$1" != "full" -a "$1" != "all" -a "$1" != "quick" -a "$1" != "test" -a "$1" != "clean" \) ]; then
echo "Usage: $ME "
echo " is one of:"
echo " \"full\": full apt repository creation and index generation"
echo " \"all\": no apt repository creation, but full indexing"
echo " \"quick\": no apt repository creation, only updates & extra indexing"
echo " \"test\": output directory locations; does nothing"
echo " gives the Redhat version in canonical form"
echo " (eg: \"8.0\", \"9\")"
exit 1
fi
MODE=$1
VERSION=$2
if [ "$MODE" = "test" ]; then
echo "APTDIR:"
echo "$APTDIR/redhat/${VERSION}/en/i386"
echo "OS MIRRORDIR:"
echo "$MIRRORDIR/redhat/linux/${VERSION}/en/os/i386/$OSDIR"
echo "OS RPM:"
find $MIRRORDIR/redhat/linux/${VERSION}/en/os/i386/$OSDIR -maxdepth 1 -type f ! -name "*.src.rpm" -name "*.rpm" | head -1
echo "UPDATES MIRRORDIR:"
echo "$MIRRORDIR/redhat/linux/updates/${VERSION}/en/os/"
echo "UPDATE RPM:"
find $MIRRORDIR/redhat/linux/updates/${VERSION}/en/os/ -type f ! -name "*.src.rpm" -name "*.rpm" | head -1
exit 0
fi
if [ "$MODE" = "clean" ]; then
# Caution: Wipes out all extra rpms's; therefore, commented out and undocumented!!!
#rm -rf $APTDIR/redhat/${VERSION}
exit 0
fi
if [ "$MODE" = "full" ]; then
# Create directory
mkdir -p $APTDIR/redhat/${VERSION}/en/i386/base
cd $APTDIR/redhat/${VERSION}/en/i386/base
if [ -d $MIRRORDIR/redhat/linux/${VERSION}/en/os/i386/$BASE ]; then
find $MIRRORDIR/redhat/linux/${VERSION}/en/os/i386/$BASE/ -type f -exec ln -sf '{}' \;
fi
if [ $ME != make-yum2 ]; then
# Create the main release file
cat >$APTDIR/redhat/${VERSION}/en/i386/base/release <$APTDIR/redhat/${VERSION}/en/i386/base/release.os <$APTDIR/redhat/${VERSION}/en/i386/base/release.updates <$APTDIR/redhat/${VERSION}/en/i386/base/release.extra <2.4 with xml repository metadata: needs createrepo package.
if [ $ME = make-yum2 ]; then
echo "Generating repository metadata of $APTDIR"
createrepo $APTDIR
fi