- Главная... arrow - Статьи... arrow | - Linux arrow Создаем локальное зеркало репозитория UBUNTU или DEBIAN

#Записки о Unix/Linux/BSD/Solaris

Создаем локальное зеркало репозитория UBUNTU или DEBIAN
Автор H@wk!   
28:11:2008 г.
Оглавление
Создаем локальное зеркало репозитория UBUNTU или DEBIAN
Страница 2
Страница 3
Приведенные ниже скрипты выкачивают репозитории main, universe, multiverse и restricted с официального зеркала Ubuntu http://ftp.acc.umu.se  Репозитории free и non-free не входят в число официальных репозиториев Ubuntu, так как не отвечают требованиям лицензионной чистоты дистрибутива, скрипт скачивает их с ресурса проекта Medibuntu http://medibuntu.org
Скрипт local_repository.sh предназначен для создания локального среза репозиториев выбранного дистрибутива Debian или Ubuntu. Скрипт install_packages.sh предназначен для автоматической установки выбранных пакетов дистрибутива Ubuntu 8.04 Hardy Heron.

Содержание скрипта local_repository.sh:

#!/bin/sh
clear
echo '----------------------------------------------------------------------'
echo 'Данный сценарий создаёт локальный репозиторий для заданной архитектуры'
echo 'заданного дистрибутива Debian/Ubuntu по найденным файлам описаний,'
echo 'хранимых в каталогах /путь/dists/дистрибутив/репозиторий/архитектура/'
echo '----------------------------------------------------------------------'
# Выбор семейства
apply=n
dist_family=n
echo '1: debian;'
echo '2: ubuntu;'
while [ $apply = n ]
do
while [ $dist_family = n ]
do
echo -n 'Выберите семейство: '
read dist_family
dist_family=`echo $dist_family | tr -d [' ']`
case $dist_family in
'') dist_family=n
;;
esac
if [ $dist_family != 1 ] && [ $dist_family != 2 ]; then
dist_family=n
else
if [ $dist_family = 1 ]; then
dist_family=debian
elif [ $dist_family = 2 ]; then
dist_family=ubuntu
fi
echo -n 'Семейство '$dist_family'. Подтверждаете (y/n)? '
read apply
apply=`echo $apply | tr -d [' ']`
case $apply in
'') apply=n
;;
*) apply=`echo $apply | tr [A-Z] [a-z]`
;;
esac
if [ $apply != y ]; then
apply=n
dist_family=n
fi
fi
done
done
# Выбор дистрибутива
apply=n
dist=n
echo '----------------------------------------------------------------------'
while [ $apply = n ]
do
while [ $dist = n ]
do
echo -n 'Введите название дистрибутива (lenny, hardy и пр.): '
read dist
dist=`echo $dist | tr -d [' ']`
case $dist in
'') dist=n
;;
*) dist=`echo $dist | tr [A-Z] [a-z]`
;;
esac
echo -n 'Дистрибутив '$dist'. Подтверждаете (y/n)? '
read apply
apply=`echo $apply | tr -d [' ']`
case $apply in
'') apply=n
;;
*) apply=`echo $apply | tr [A-Z] [a-z]`
;;
esac
if [ $apply != y ]; then
apply=n
dist=n
fi
done
done
# Выбор архитектуры
apply=n
architecture=n
contents=n
echo '----------------------------------------------------------------------'
echo '1: binary-i386;'
echo '2: binary-amd64;'
if [ $dist_family = debian ]; then
echo '3: binary-ia64;'
fi
while [ $apply = n ]
do
while [ $architecture = n ]
do
echo -n 'Выберите архитектуру: '
read architecture
architecture=`echo $architecture | tr -d [' ']`
case $architecture in
'') architecture=n
;;
esac
if [ $architecture != 1 ] && [ $architecture != 2 ] && [ $architecture != 3 ]; then
architecture=n
else
if [ $architecture = 1 ]; then
architecture=binary-i386
contents=Contents-i386.gz
elif [ $architecture = 2 ]; then
architecture=binary-amd64
contents=Contents-amd64.gz
elif [ $architecture = 3 ]; then
architecture=binary-ia64
contents=Contents-ia64.gz
fi
echo -n 'Архитектура '$architecture'. Подтверждаете (y/n)? '
read apply
apply=`echo $apply | tr -d [' ']`
case $apply in
'') apply=n
;;
*) apply=`echo $apply | tr [A-Z] [a-z]`
;;
esac
if [ $apply != y ]; then
apply=n
architecture=n
contents=n
fi
fi
done
done
# Выбор репозиториев
apply=n
main=n
contrib=n
universe=n
multiverse=n
restricted=n
free=n
non_free=n
echo '----------------------------------------------------------------------'
echo 'Выберите, какие репозитории небходимо скачать'
while [ $apply = n ]
do
echo -n 'Репозиторий main. Подтверждаете (y/n)? '
read main
main=`echo $main | tr -d [' ']`
case $main in
'') main=n
;;
*) main=`echo $main | tr [A-Z] [a-z]`
;;
esac
if [ $main != y ]; then
main=n
else
main=main
fi
if [ $dist_family = debian ]; then
echo -n 'Репозиторий contrib. Подтверждаете (y/n)? '
read contrib
contrib=`echo $contrib | tr -d [' ']`
case $contrib in
'') contrib=n
;;
*) contrib=`echo $contrib | tr [A-Z] [a-z]`
;;
esac
if [ $contrib != y ]; then
contrib=n
else
contrib=contrib
fi
echo -n 'Репозиторий non-free. Подтверждаете (y/n)? '
read non_free
non_free=`echo $non_free | tr -d [' ']`
case $non_free in
'') non_free=n
;;
*) non_free=`echo $non_free | tr [A-Z] [a-z]`
;;
esac
if [ $non_free != y ]; then
non_free=n
else
non_free=non-free
fi
elif [ $dist_family = ubuntu ]; then
echo -n 'Репозиторий universe. Подтверждаете (y/n)? '
read universe
universe=`echo $universe | tr -d [' ']`
case $universe in
'') universe=n
;;
*) universe=`echo $universe | tr [A-Z] [a-z]`
;;
esac
if [ $universe != y ]; then
universe=n
else
universe=universe
fi
echo -n 'Репозиторий multiverse. Подтверждаете (y/n)? '
read multiverse
multiverse=`echo $multiverse | tr -d [' ']`
case $multiverse in
'') multiverse=n
;;
*) multiverse=`echo $multiverse | tr [A-Z] [a-z]`
;;
esac
if [ $multiverse != y ]; then
multiverse=n
else
multiverse=multiverse
fi
echo -n 'Репозиторий restricted. Подтверждаете (y/n)? '
read restricted
restricted=`echo $restricted | tr -d [' ']`
case $restricted in
'') restricted=n
;;
*) restricted=`echo $restricted | tr [A-Z] [a-z]`
;;
esac
if [ $restricted != y ]; then
restricted=n
else
restricted=restricted
fi
echo -n 'Репозиторий free. Подтверждаете (y/n)? '
read free
free=`echo $free | tr -d [' ']`
case $free in
'') free=n
;;
*) free=`echo $free | tr [A-Z] [a-z]`
;;
esac
if [ $free != y ]; then
free=n
else
free=free
fi
echo -n 'Репозиторий non-free. Подтверждаете (y/n)? '
read non_free
non_free=`echo $non_free | tr -d [' ']`
case $non_free in
'') non_free=n
;;
*) non_free=`echo $non_free | tr [A-Z] [a-z]`
;;
esac
if [ $non_free != y ]; then
non_free=n
else
non_free=non-free
fi
fi
echo -n 'Выбранные репозитории:'
if [ $main = main ]; then
echo -n ' '$main
fi
if [ $contrib = contrib ]; then
echo -n ' '$contrib
fi
if [ $universe = universe ]; then
echo -n ' '$universe
fi
if [ $multiverse = multiverse ]; then
echo -n ' '$multiverse
fi
if [ $restricted = restricted ]; then
echo -n ' '$restricted
fi
if [ $free = free ]; then
echo -n ' '$free
fi
if [ $non_free = non-free ]; then
echo -n ' '$non_free
fi

echo -n '. Подтверждаете (y/n)? '
read apply
apply=`echo $apply | tr -d [' ']`
case $apply in
'') apply=n
;;
*) apply=`echo $apply | tr [A-Z] [a-z]`
;;
esac
if [ $apply != y ]; then
apply=n
fi
done
# Закачка файлов описаний пакетов
echo '----------------------------------------------------------------------'
echo 'Закачка выбранных репозиториев'
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$contents -o ./Contents`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/Release -a ./Contents`
#`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/Release.gpg -a ./Contents`
if [ $main = main ]; then
echo 'Закачка репозитория main...'
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$main/$architecture/Packages.bz2 -o ./Log_Main`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$main/$architecture/Packages.gz -a ./Log_Main`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$main/$architecture/Release -a ./Log_Main`
`cp ./ftp.acc.umu.se/$dist_family/dists/$dist/$main/$architecture/Packages.bz2 ./`
`bzip2 -d ./Packages.bz2`
`grep '^Filename *' ./Packages | awk '{print $2}' > Packages_Main`
`rm ./Packages`
`wget -r -x -c -t 0 -B http://ftp.acc.umu.se/$dist_family/ -i ./Packages_Main -a ./Log_Main`
fi


if [ $dist_family = debian ]; then
if [ $contrib = contrib ]; then
echo 'Закачка репозитория contrib...'
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$contrib/$architecture/Packages.bz2 -o ./Log_Contrib`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$contrib/$architecture/Packages.gz -a ./Log_Contrib`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$contrib/$architecture/Release -a ./Log_Contrib`
`cp ./ftp.acc.umu.se/$dist_family/dists/$dist/$contrib/$architecture/Packages.bz2 ./`
`bzip2 -d ./Packages.bz2`
`grep '^Filename *' ./Packages | awk '{print $2}' > Packages_Contrib`
`rm ./Packages`
`wget -r -x -c -t 0 -B http://ftp.acc.umu.se/$dist_family/ -i ./Packages_Contrib -a ./Log_Contrib`
fi
if [ $non_free = non-free ]; then
echo 'Закачка репозитория non-free...'
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$non_free/$architecture/Packages.bz2 -o ./Log_Non-Free`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$non_free/$architecture/Packages.gz -a ./Log_Non-Free`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$non_free/$architecture/Release -a ./Log_Non-Free`
`cp ./ftp.acc.umu.se/$dist_family/dists/$dist/$non_free/$architecture/Packages.bz2 ./`
`bzip2 -d ./Packages.bz2`
`grep '^Filename *' ./Packages | awk '{print $2}' > Packages_Non-Free`
`rm ./Packages`
`wget -r -x -c -t 0 -B http://ftp.acc.umu.se/$dist_family/ -i ./Packages_Non-Free -a ./Log_Non-Free`
fi
elif [ $dist_family = ubuntu ]; then
if [ $universe = universe ]; then
echo 'Закачка репозитория universe...'
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$universe/$architecture/Packages.bz2 -o ./Log_Universe`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$universe/$architecture/Packages.gz -a ./Log_Universe`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$universe/$architecture/Release -a ./Log_Universe`
`cp ./ftp.acc.umu.se/$dist_family/dists/$dist/$universe/$architecture/Packages.bz2 ./`
`bzip2 -d ./Packages.bz2`
`grep '^Filename *' ./Packages | awk '{print $2}' > Packages_Universe`
`rm ./Packages`
`wget -r -x -c -t 0 -B http://ftp.acc.umu.se/$dist_family/ -i ./Packages_Universe -a ./Log_Universe`
fi
if [ $multiverse = multiverse ]; then
echo 'Закачка репозитория multiverse...'
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$multiverse/$architecture/Packages.bz2 -o ./Log_Multiverse`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$multiverse/$architecture/Packages.gz -a ./Log_Multiverse`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$multiverse/$architecture/Release -a ./Log_Multiverse`
`cp ./ftp.acc.umu.se/$dist_family/dists/$dist/$multiverse/$architecture/Packages.bz2 ./`
`bzip2 -d ./Packages.bz2`
`grep '^Filename *' ./Packages | awk '{print $2}' > Packages_Multiverse`
`rm ./Packages`
`wget -r -x -c -t 0 -B http://ftp.acc.umu.se/$dist_family/ -i ./Packages_Multiverse -a ./Log_Multiverse`
fi
if [ $restricted = restricted ]; then
echo 'Закачка репозитория restricted...'
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$restricted/$architecture/Packages.bz2 -o ./Log_Restricted`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$restricted/$architecture/Packages.gz -a ./Log_Restricted`
`wget -r -x -c -t 0 http://ftp.acc.umu.se/$dist_family/dists/$dist/$restricted/$architecture/Release -a ./Log_Restricted`
`cp ./ftp.acc.umu.se/$dist_family/dists/$dist/$restricted/$architecture/Packages.bz2 ./`
`bzip2 -d ./Packages.bz2`
`grep '^Filename *' ./Packages | awk '{print $2}' > Packages_Restricted`
`rm ./Packages`
`wget -r -x -c -t 0 -B http://ftp.acc.umu.se/$dist_family/ -i ./Packages_Restricted -a ./Log_Restricted`
fi
if [ $free = free ]; then
`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/$contents -a ./Contents`
`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/Release -a ./Contents`
#`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/Release.gpg -a ./Contents`
echo 'Закачка репозитория free...'
`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/$free/$architecture/Packages.bz2 -o ./Log_Free`
`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/$free/$architecture/Packages.gz -a ./Log_Free`
`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/$free/$architecture/Release -a ./Log_Free`
`cp ./medibuntu.org/repo/dists/$dist/$free/$architecture/Packages.bz2 ./`
`bzip2 -d ./Packages.bz2`
`grep '^Filename *' ./Packages | awk '{print $2}' > Packages_Free`
`rm ./Packages`
`wget -r -x -c -t 0 -B http://medibuntu.org/repo/ -i ./Packages_Free -a ./Log_Free`
fi
if [ $non_free = non-free ]; then
`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/$contents -a ./Contents`
`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/Release -a ./Contents`
#`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/Release.gpg -a ./Contents`
echo 'Закачка репозитория non-free...'
`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/$non_free/$architecture/Packages.bz2 -o ./Log_Non-Free`
`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/$non_free/$architecture/Packages.gz -a ./Log_Non-Free`
`wget -r -x -c -t 0 http://medibuntu.org/repo/dists/$dist/$non_free/$architecture/Release -a ./Log_Non-Free`
`cp ./medibuntu.org/repo/dists/$dist/$non_free/$architecture/Packages.bz2 ./`
`bzip2 -d ./Packages.bz2`
`grep '^Filename *' ./Packages | awk '{print $2}' > Packages_Non-Free`
`rm ./Packages`
`wget -r -x -c -t 0 -B http://medibuntu.org/repo/ -i ./Packages_Non-Free -a ./Log_Non-Free`
fi
fi
echo '----------------------------------------------------------------------'
echo 'Готово'



 
« Ubuntu firewall UFW (Uncomplicated firewall), настройки и примеры   Программный RAID. Мониторинг. »

#COMMENT

Блокируем Ylmf-pc на Exim, Bru...
Благодарю за кучу уцелевших нервов:) постоянно приходилось б...
30/05/17 00:02 More...
By Mus

Установка даты и времени в кон...
Спасибо
12/05/17 17:49 More...
By dushka

Раскладка в rdesktop
Огромное спасибо!
28/04/17 14:01 More...
By Виктор

Аутентификация средствами Apac...
подскажите как писать пороль цифры ?пж! :sigh
28/03/17 13:06 More...
By Лиза

Logwatch - мониторинг журналов...
Отлично, очень не хватало. Автору большое спасибо, пиши еще.
25/01/17 02:44 More...
By Gregg