YEREL PAKET DEPOSU OLUŞTURMAKSon Güncelleme : 08.02.2008 14:30
Slackware'e ait paket depolarından indirdiğiniz paketleri bir klasörde toplayarak işe başlayabilirsiniz. En büyük paket deposu adresleri aşağıdadır.
http://www.slacky.euhttp://www.linuxpackages.netKarşılaşabileceğiniz olası paket bağımlılıkları sorunlarına karşılık
Slacky.eu adresindeki paketlerde genelde paket bağımlılıkları dosyası (slack-required) yer alıyor.
İstediğiniz paketleri bir klasöre topladıktan sonra aşağıdaki yazılı işlemleri uygulayınız...
Aşağıdaki betiği kopyalayıp bir dosyaya kaydedin. Dikkat edilmesi gereken betik dosyasının paket klasörünün bir üst dizininde yer alması gerektiğidir.
Örneğin; paketler /home/atlantis/slackware dizininde ise betik dosyası /home/atlantis dizininde olmalıdır.
#!/bin/bash
#converts glibc-2.3.5-i486-5 to 2.3.5-i486-5
completetonolast(){
NUMFIELDS=`echo "$1" | awk -F - '{print NF}'`
if test $NUMFIELDS -ge 4
then
echo ${1%-*}
fi
}
#converts glibc-2.3.5-i486-5 to glibc
completetoname(){
NUMFIELDS=`echo "$1" | awk -F - '{print NF}'`
if test $NUMFIELDS -ge 4
then
echo ${1%-*-*-*}
fi
}
help(){
echo "Usage: repos.slapt [OPTION]... DIRECTORY"
echo "Creates a Slackware-like directory structure."
echo
echo " -p, --partial only add new packages"
echo " -q, --quiet suppress output"
echo " -n, --noclog doesn't generate the ChageLog.txt"
echo " -d, --descriptions generates a .txt description file for each package"
echo " -s, --signs signs each tgz package (generates .asc files)"
echo " --help display this help and exit"
echo " --version output version information and exit"
echo
echo "Report bugs to <[email protected]>."
}
check_settings() {
QUIET=0
CHANGELOG=1
DESCRIPTIONS=0
SIGN=0
for i in $@
do
case "$i" in
"--quiet" | "-q" )
QUIET=1
;;
"--partial" | "-p" )
PARTIAL=1
;;
"--full" | "-f" )
PARTIAL=0
;;
"--noclog" | "-n" )
CHANGELOG=0
;;
"--descriptions" | "-d" )
DESCRIPTIONS=1
;;
"--signs" | "-s" )
SIGN=1
;;
"--version" )
echo "repos.slapt 1.0.0"
echo "Written by Stefano Stabellini".
echo
echo "This is free software. There is NO"
echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
exit 0
;;
"--help" )
help
exit 0
;;
* )
if [ -d $i ]; then
REPOSDIR=$i
else
echo $i is not a valid directory
exit 1
fi
;;
esac
done
if [[ "$REPOSDIR" == "" ]]; then
echo "You must supply a valid directory"
exit 1
fi
if [ ! -w $REPOSDIR ]; then
echo "You do not have write permission for $REPOSDIR"
exit 1
fi
if [ ! -d $REPOSTMP ]; then
mkdir $REPOSTMP
elif [ ! -w $REPOSTMP ]; then
echo "You do not have write permission for $REPOSTMP"
exit 1
fi
}
partial_MPL() {
if test $CHANGELOG -ne 1
then
N=0
CHANGE=`find ./ -cnewer PACKAGES.TXT | sed /"\/src\/"/d | grep [.]tgz$`
for i in $CHANGE
do
NEWCHANGENAMES[$N]="`basename $i`"
N=$(( $N + 1 ))
done
fi
if test -z "$CHANGE"
then
exit
fi
if [ ! -f FILELIST.TXT ]; then
echo "Error. No FILELIST.TXT found. Run without --partial option first."
exit 1
fi
if [ "$QUIET" -ne "1" ]; then
echo "Adding information to MANIFEST.bz2, PACKAGES.TXT & libraries-repository"
fi
if [ -f MANIFEST.bz2 ]; then
cp MANIFEST.bz2 $REPOSTMP
else
echo "Error. No MANIFEST.bz2 found. Run without --partial option first."
exit 1
fi
if [ -f PACKAGES.TXT ]; then
cp PACKAGES.TXT $REPOSTMP
else
echo "Error. No PACKAGES.TXT found. Run without --partial option first."
exit 1
fi
if [ -f libraries-repository ]; then
cp libraries-repository $REPOSTMP
else
echo "Error. No libraries-repository found. Run without --partial option first."
exit 1
fi
bunzip2 $REPOSTMP/MANIFEST.bz2
echo "PACKAGES.TXT; `date`" > $REPOSTMP/PACKAGESHEADER.TXT
echo >> $REPOSTMP/PACKAGESHEADER.TXT
echo "This file provides details on the packages found on this site" >> $REPOSTMP/PACKAGESHEADER.TXT
TOTALCSIZE=`grep "Total size of all packages (compressed)" $REPOSTMP/PACKAGES.TXT | awk {'print $8 '}`
TOTALUSIZE=`grep "Total size of all packages (uncompressed)" $REPOSTMP/PACKAGES.TXT | awk {'print $8 '}`
TMPVAL=`wc -l $REPOSTMP/PACKAGES.TXT | awk {'print $1'}`
tail -n $(($TMPVAL - 6)) $REPOSTMP/PACKAGES.TXT > $REPOSTMP/PACKAGESBODY.TXT
j=0
for i in $CHANGE
do
if [ "$QUIET" -ne "1" ]; then
echo "Adding ${NEWCHANGENAMES[$j]}"
fi
echo "++========================================" >> $REPOSTMP/MANIFEST
echo "||" >> $REPOSTMP/MANIFEST
echo "|| Package: $i" >> $REPOSTMP/MANIFEST
echo "||" >> $REPOSTMP/MANIFEST
echo "++========================================" >> $REPOSTMP/MANIFEST
tar tvfz $i >> $REPOSTMP/MANIFEST
echo >> $REPOSTMP/MANIFEST
echo >> $REPOSTMP/MANIFEST
echo "PACKAGE NAME: ${NEWCHANGENAMES[$j]} " >> $REPOSTMP/PACKAGESBODY.TXT
echo "PACKAGE LOCATION: `dirname $i`" >> $REPOSTMP/PACKAGESBODY.TXT
CSIZE=$( expr `gunzip -l $i |tail -1|awk '{print $1}'` / 1024 )
USIZE=$( expr `gunzip -l $i |tail -1|awk '{print $2}'` / 1024 )
echo "PACKAGE SIZE (compressed): $CSIZE K" >> $REPOSTMP/PACKAGESBODY.TXT
gunzip -c $i > $REPOSTMP/file.tar
echo "PACKAGE SIZE (uncompressed): $USIZE K" >> $REPOSTMP/PACKAGESBODY.TXT
REQUIRED=$(tar xzfO $i install/slack-required 2>/dev/null|xargs -r -iZ echo -n "Z,"|sed -e "s/,$//")
CONFLICTS=$(tar xzfO $i install/slack-conflicts 2>/dev/null|xargs -r -iZ echo -n "Z,"|sed -e "s/,$//")
SUGGESTS=$(tar xzfO $i install/slack-suggests 2>/dev/null|xargs -r )
echo "PACKAGE REQUIRED: $REQUIRED" >> $REPOSTMP/PACKAGESBODY.TXT
echo "PACKAGE CONFLICTS: $CONFLICTS" >> $REPOSTMP/PACKAGESBODY.TXT
echo "PACKAGE SUGGESTS: $SUGGESTS" >> $REPOSTMP/PACKAGESBODY.TXT
echo "PACKAGE DESCRIPTION:" >> $REPOSTMP/PACKAGESBODY.TXT
if test $DESCRIPTIONS -eq 0
then
tar xzOf $i install/slack-desc | sed /^$/d | sed /^#/d | sed /\|-/d >> $REPOSTMP/PACKAGESBODY.TXT 2> /dev/null
else
TDESC=${i%.tgz}
tar xzOf $i install/slack-desc | sed /^$/d | sed /^#/d | sed /\|-/d | tee $TDESC".txt" >> $REPOSTMP/PACKAGESBODY.TXT 2> /dev/null
fi
if test $SIGN -eq 1
then
rm $i.asc &>/dev/null
echo "$pass" | gpg --passphrase-fd 0 -o $i.asc -sba $i
fi
echo >> $REPOSTMP/PACKAGESBODY.TXT
echo >> $REPOSTMP/PACKAGESBODY.TXT
TOTALCSIZE=$(($TOTALCSIZE + $CSIZE))
TOTALUSIZE=$(($TOTALUSIZE + $USIZE))
tar tfz $i 2> /dev/null | sed -e "s/\.\*/${NEWCHANGENAMES[$j]}: \&/" >> $REPOSTMP/files.tmp
j=$(($j + 1))
done
TOTALCSIZE=$(($TOTALCSIZE + $CSIZE))
TOTALUSIZE=$(($TOTALUSIZE + $USIZE))
echo "Total size of all packages (compressed) : $TOTALCSIZE MB" >> $REPOSTMP/PACKAGESHEADER.TXT
echo "Total size of all packages (uncompressed) : $TOTALUSIZE MB" >> $REPOSTMP/PACKAGESHEADER.TXT
echo >> $REPOSTMP/PACKAGESHEADER.TXT
echo >> $REPOSTMP/PACKAGESHEADER.TXT
bzip2 $REPOSTMP/MANIFEST
grep [.]so $REPOSTMP/files.tmp | sort -t : -k 1 -r >> $REPOSTMP/libraries-repository.tmp
cat $REPOSTMP/libraries-repository.tmp $REPOSTMP/libraries-repository | sort -t : -k 1 -r > libraries-repository
}
create_MPL() {
if [ "$QUIET" -ne "1" ]; then
echo "MANIFEST.bz2, PACKAGES.TXT, libraries-repository olu?turuluyor..."
fi
echo "PACKAGES.TXT; `date`" > $REPOSTMP/PACKAGESHEADER.TXT
echo >> $REPOSTMP/PACKAGESHEADER.TXT
echo "This file provides details on the packages found on this site" >> $REPOSTMP/PACKAGESHEADER.TXT
if test $CHANGELOG -ne 1
then
N=0
FILELIST=`tree -fi --noreport | sed /"\/src\/"/d | grep [.]tgz$`
for i in $FILELIST
do
NEWCOMPLETENAMES[$N]="`basename $i`"
N=$(( $N + 1 ))
done
fi
TOTALCSIZE=0
TOTALUSIZE=0
j=0
for i in $FILELIST
do
echo "++========================================" >> $REPOSTMP/MANIFEST
echo "||" >> $REPOSTMP/MANIFEST
echo "|| Package: $i" >> $REPOSTMP/MANIFEST
echo "||" >> $REPOSTMP/MANIFEST
echo "++========================================" >> $REPOSTMP/MANIFEST
tar tvfz $i >> $REPOSTMP/MANIFEST
echo >> $REPOSTMP/MANIFEST
echo >> $REPOSTMP/MANIFEST
echo "PACKAGE NAME: ${NEWCOMPLETENAMES[$j]} " >> $REPOSTMP/PACKAGESBODY.TXT
echo "PACKAGE LOCATION: `dirname $i`" >> $REPOSTMP/PACKAGESBODY.TXT
CSIZE=$( expr `gunzip -l $i |tail -1|awk '{print $1}'` / 1024 )
USIZE=$( expr `gunzip -l $i |tail -1|awk '{print $2}'` / 1024 )
echo "PACKAGE SIZE (compressed): $CSIZE K" >> $REPOSTMP/PACKAGESBODY.TXT
gunzip -c $i > $REPOSTMP/file.tar
echo "PACKAGE SIZE (uncompressed): $USIZE K" >> $REPOSTMP/PACKAGESBODY.TXT
REQUIRED=$(tar xzfO $i install/slack-required 2>/dev/null|xargs -r -iZ echo -n "Z,"|sed -e "s/,$//")
CONFLICTS=$(tar xzfO $i install/slack-conflicts 2>/dev/null|xargs -r -iZ echo -n "Z,"|sed -e "s/,$//")
SUGGESTS=$(tar xzfO $i install/slack-suggests 2>/dev/null|xargs -r )
echo "PACKAGE REQUIRED: $REQUIRED" >> $REPOSTMP/PACKAGESBODY.TXT
echo "PACKAGE CONFLICTS: $CONFLICTS" >> $REPOSTMP/PACKAGESBODY.TXT
echo "PACKAGE SUGGESTS: $SUGGESTS" >> $REPOSTMP/PACKAGESBODY.TXT
echo "PACKAGE DESCRIPTION:" >> $REPOSTMP/PACKAGESBODY.TXT
if test $DESCRIPTIONS -eq 0
then
tar xzOf $i install/slack-desc | sed /^$/d | sed /^#/d | sed /\|-/d >> $REPOSTMP/PACKAGESBODY.TXT 2> /dev/null
else
TDESC=${i%.tgz}
tar xzOf $i install/slack-desc | sed /^$/d | sed /^#/d | sed /\|-/d | tee $TDESC".txt" >> $REPOSTMP/PACKAGESBODY.TXT 2> /dev/null
fi
if test $SIGN -eq 1
then
rm $i.asc &>/dev/null
echo "$pass" | gpg --passphrase-fd 0 -o $i.asc -sba $i
fi
echo >> $REPOSTMP/PACKAGESBODY.TXT
echo >> $REPOSTMP/PACKAGESBODY.TXT
TOTALCSIZE=$(($TOTALCSIZE + $CSIZE))
TOTALUSIZE=$(($TOTALUSIZE + $USIZE))
tar tfz $i 2> /dev/null | sed -e "s/\.\*/${NEWCOMPLETENAMES[$j]}: \&/" >> $REPOSTMP/files.tmp
j=$(($j + 1))
done
TOTALCSIZE=$(($TOTALCSIZE / 1024))
TOTALUSIZE=$(($TOTALUSIZE / 1024))
echo "Total size of all packages (compressed) : $TOTALCSIZE MB" >> $REPOSTMP/PACKAGESHEADER.TXT
echo "Total size of all packages (uncompressed) : $TOTALUSIZE MB" >> $REPOSTMP/PACKAGESHEADER.TXT
echo >> $REPOSTMP/PACKAGESHEADER.TXT
echo >> $REPOSTMP/PACKAGESHEADER.TXT
bzip2 $REPOSTMP/MANIFEST
grep [.]so $REPOSTMP/files.tmp | sort -t : -k 1 -r > $REPOSTMP/libraries-repository
}
create_changelog(){
if test -f ChangeLog.txt && test -f PACKAGES.TXT
then
mv ChangeLog.txt ChangeLog.old
CHANGE=`find ./ -cnewer PACKAGES.TXT | sed /"\/src\/"/d | grep [.]tgz$`
FILELIST=`tree -fi --noreport | sed /"\/src\/"/d | grep [.]tgz$`
NNEW=0
for i in $FILELIST
do
NEWCOMPLETENAMES[$NNEW]="`basename $i`"
NEWNAMES[$NNEW]=`completetoname ${NEWCOMPLETENAMES[$NNEW]}`
NNEW=$(( $NNEW + 1 ))
done
OLDPACKAGES=`cat PACKAGES.TXT | grep "PACKAGE NAME:" | awk '{print$3}'`
NOLD=0
for i in $OLDPACKAGES
do
OLDNAMES[$NOLD]=`completetoname $i`
NOLD=$(( $NOLD + 1 ))
done
N=0
for i in $CHANGE
do
NEWCHANGENAMES[$N]="`basename $i`"
if test -z "`echo $OLDPACKAGES | grep -E "(^| )${NEWCHANGENAMES[$N]}($| )"`"
then
t2="`completetoname ${NEWCHANGENAMES[$N]}`"
t3="`completetonolast ${NEWCHANGENAMES[$N]}`"
#added
if test -z "`echo ${OLDNAMES[@]} | grep -E "(^| )$t2($| )"`"
then
TN=${#ADD[@]}
ADD[$TN]="${NEWCHANGENAMES[$N]}"
#recomp
elif test "`echo $OLDPACKAGES | grep -E "(^| )$t3-"`"
then
TN=${#RECOM[@]}
RECOM[$TN]="${NEWCHANGENAMES[$N]}"
#upgraded
else
TN=${#UP[@]}
UP[$TN]="${NEWCHANGENAMES[$N]}"
fi
fi
N=$(($N + 1))
done
TN=0
for ((i=0; i < $NOLD; i++))
do
FOLD=0
for ((j=0; j < $NNEW; j++))
do
if test "${NEWNAMES[$j]}" = "${OLDNAMES[$i]}"
then
FOLD=1
break
fi
done
if test $FOLD -eq 0
then
REM[$TN]=${OLDNAMES[$i]}
TN=$(( $TN + 1 ))
fi
done
if test $(( ${#REM[@]} + ${#UP[@]} + ${#RECOM[@]} + ${#ADD[@]} )) -gt 0
then
date > ChangeLog.txt
for ((i=0; i<${#ADD[@]}; i++))
do
echo "eklendi :: ${ADD[$i]}">> ChangeLog.txt
done
for ((i=0; i<${#RECOM[@]}; i++))
do
echo "yeniden :: ${RECOM[$i]}">> ChangeLog.txt
done
for ((i=0; i<${#UP[@]}; i++))
do
echo "güncellendi :: ${UP[$i]}">> ChangeLog.txt
done
for ((i=0; i<${#REM[@]}; i++))
do
echo "kald?r?ld? :: ${REM[$i]}">> ChangeLog.txt
done
echo "+--------------------------+" >> ChangeLog.txt
fi
cat ChangeLog.old >> ChangeLog.txt
rm ChangeLog.old &>/dev/null
else
if test "$QUIET" -ne "1"
then
echo "ChangeLog.txt veya PACKAGES.TXT bulunamad?: assuming this is a new repository"
fi
FILELIST=`tree -fi --noreport | sed /"\/src\/"/d | grep [.]tgz$`
N=0
if test "$FILELIST"
then
date > ChangeLog.txt
for i in $FILELIST
do
NEWCOMPLETENAMES[$N]="`basename $i`"
echo "added :: ${NEWCOMPLETENAMES[$N]}">> ChangeLog.txt
N=$(( $N + 1 ))
done
fi
fi
}
create_filelist() {
if [ "$QUIET" -ne "1" ]; then
echo Creating FILELIST.txt
fi
FILELIST=`tree -fi --noreport`
date >> $REPOSTMP/FILELIST.TXT
echo >> $REPOSTMP/FILELIST.TXT
echo Here is the file list for this directory. >> $REPOSTMP/FILELIST.TXT
echo >> $REPOSTMP/FILELIST.TXT
for i in $FILELIST
do
ls -lad $i 2> /dev/null 1>> $REPOSTMP/FILELIST.TXT
done
}
create_checksums() {
if [ "$QUIET" -ne "1" ]; then
echo Creating CHECKSUMS.md5
fi
rm CHECKSUMS.md5 2> /dev/null
FILELIST=`tree -fi --noreport`
echo "These are the MD5 message digests for the files in this directory." >> $REPOSTMP/CHECKSUMS.md5
echo "If you want to test your files, use 'md5sum' and compare the values to" >> $REPOSTMP/CHECKSUMS.md
echo "the ones listed here." >> $REPOSTMP/CHECKSUMS.md5
echo >> $REPOSTMP/CHECKSUMS.md5
echo "To test all these files, use this command:" >> $REPOSTMP/CHECKSUMS.md5
echo >> $REPOSTMP/CHECKSUMS.md5
echo "md5sum -c CHECKSUMS.md5 | less" >> $REPOSTMP/CHECKSUMS.md5
echo >> $REPOSTMP/CHECKSUMS.md5
echo "'md5sum' can be found in the GNU textutils package on ftp.gnu.org in" >> $REPOSTMP/CHECKSUMS.md5
echo "/pub/gnu, or at any GNU mirror site." >> $REPOSTMP/CHECKSUMS.md5
echo >> $REPOSTMP/CHECKSUMS.md5
for i in $FILELIST
do
md5sum $i 2> /dev/null 1>> $REPOSTMP/CHECKSUMS.md5
done
}
cleanup() {
if [ "$QUIET" -ne "1" ]; then
echo Cleaning up temporary directory
fi
rm -f $REPOSTMP/* 2> /dev/null
}
REPOSTMP=/tmp/repos
rm -r $REPOSTMP &> /dev/null
check_settings "$@"
cd $REPOSDIR
if test $SIGN -eq 1
then
echo "If you need a passphrase to unlock your secret key, enter it here:"
read -s pass
fi
if test $CHANGELOG -ne 0
then
create_changelog
fi
if [[ "$PARTIAL" == "1" ]]; then
partial_MPL
else
create_MPL
fi
cat $REPOSTMP/PACKAGESHEADER.TXT $REPOSTMP/PACKAGESBODY.TXT | uniq > PACKAGES.TXT
gzip -9 -c PACKAGES.TXT > PACKAGES.TXT.gz
mv $REPOSTMP/MANIFEST.bz2 .
mv $REPOSTMP/libraries-repository .
create_filelist
mv $REPOSTMP/FILELIST.TXT .
create_checksums
mv $REPOSTMP/CHECKSUMS.md5 .
cleanup
Şimdi de betiğin bulunduğu dizine girin.
cd /home/atlantis
Betiği çalıştırın.
sh betik_adı paket_yolu
Betik çalıştırıldıktan sonra paket dizininde çeşitli dosyalar oluşturulur.
Paketleri toplarlayıp cd ya da dvd isosu haline getirin.
Slapt-get yazılımını ve grafik ortamda çalışmak isterseniz gslapt yazılımlarını kurun.
Cd ya da dvd kaynağını yerel depo olarak slapt-getrc dosyasına aşağıdaki gibi ekleyin.
SOURCE=file:///mnt/cdrom/
Eğer paketler cd içerisinde alt klasörde yer alıyorsa
SOURCE=file:///mnt/cdrom/slackware
şeklinde ekleyin.
Önünde # işareti olmayan diğer satırları # işareti koyup işleme aldırmayın.
Son olarakta yetkili kullanıcı ile
slapt-get --update
komutunu verin.
Bu işlem cd deki paket listesini diske kaydeder.
Artık
slapt-get --search paket_adı
şeklinde paket aratabilir,
slapt-get --install paket_adı
ile paket kurabilir,
slapt-get --remove paket_adı
ile paketleri kaldırabilirsiniz.
Kolay gelsin...
Onur ÖZDEMİR
Truva Linux Geliştiricisi
atlantis[a]truvalinux.org.tr