The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Автоматизированная сборка загрузочного DVD из CD-образов Russian Fedora 13
Ниже представлен вариант автоматизированной сборки DVD из CD-образов Russian
Remix Fedora (RFRemix). Тестировалось под OS RFRemix 11 и RFRemix 12.

Изложенные в инструкции действия следует выполнять под пользователем root.
Создаем каталог куда копируем 6-ть образов CD (закачены с yandex):

   RFRemix-13-i386-disc1.iso
   RFRemix-13-i386-disc2.iso
   RFRemix-13-i386-disc3.iso
   RFRemix-13-i386-disc4.iso
   RFRemix-13-i386-disc5.iso
   RFRemix-13-i386-disc6.iso

В каталоге создаем bash-скрипт MakeDVD.sh со следующим содержимым:

   #!/bin/bash
   #Script create DVD ISO-image from CD ISO-images for Fedora 13

   RFREMIX13_MEDIA_ID="1274745691.442497"
   MAX_DISC_NUM=6
   RFREMIX_DISC_NAME="RFRemix-13-i386-disc"
   COMPS_FILE="RFRemix-13-comps.xml"
   RPM_DIR="Packages"
   DVD_LABEL="RFRemix 13"

   RFRENIX_VER11=`((cat /etc/system-release) | awk '{  if(match($0,"11")!=0) print "11" }')`
   RFRENIX_VER12=`((cat /etc/system-release) | awk '{ if(match($0,"12")!=0) print "12" }')`

   CURDIR="$(pwd)"
   COMPSFILE=$CURDIR"/srcdvd/repodata/"$COMPS_FILE
   SRCDVDDIR="$CURDIR""/srcdvd"
   DVDISOFILE="$CURDIR""/dvd-iso/RFRemix-13-i386-DVD.iso"

   cleandata()
   {
   echo
   echo 'Cleaning temporary data...'
   echo

   for ((i=1;i<=$MAX_DISC_NUM;i++)) ; do 
       if [ -a ./mnt/disc$i ]; then
   	  umount -f ./mnt/disc$i ; 
       fi
   done

   rm -f -R ./mnt
   rm -f -R ./srcdvd
   }

   echo
   echo 'Create directories...'
   echo

   cleandata
   rm -f -R ./dvd-iso

   mkdir ./srcdvd
   mkdir ./dvd-iso
   mkdir ./mnt
   for ((i=1;i<=$MAX_DISC_NUM;i++)) ; do mkdir ./mnt/disc$i ; done

   echo
   echo 'Mount a CD ISO-image...'
   echo

   for ((i=1;i<=$MAX_DISC_NUM;i++)) ; do mount -t iso9660  ./$RFREMIX_DISC_NAME$i.iso ./mnt/disc$i -o loop ; done

   echo
   echo 'Data preparation...'
   echo

   echo 'Copying packages from disc 1...'
   cp -f -R ./mnt/disc1/* ./srcdvd
   cp -f ./mnt/disc1/.discinfo ./srcdvd

   rm -f ./srcdvd/repodata/*
   cp ./mnt/disc1/repodata/*-comps.xml ./srcdvd/repodata/$COMPS_FILE
   rm -f `(find ./srcdvd/*.TBL ./srcdvd/ | grep .TBL)`

   for ((i=2;i<=$MAX_DISC_NUM;i++)) ; do
       echo 'Copying packages from disc '$i'...';
       cp ./mnt/disc$i/$RPM_DIR/* ./srcdvd/$RPM_DIR;
   done

   if [ "v"$RFRENIX_VER12 == "v12" ] && [ ! -e /usr/lib/python2.6/site-packages/createrepo/createrepo_rfremix12.patch ]; then
      echo
      echo 'Patching utility createrepo...'
      echo

      cp -f ./createrepo_rfremix12.patch /usr/lib/python2.6/site-packages/createrepo
      cp /usr/lib/python2.6/site-packages/createrepo/__init__.py /usr/lib/python2.6/site-packages/createrepo/__init__OLD.py
      patch -i /usr/lib/python2.6/site-packages/createrepo/createrepo_rfremix12.patch /usr/lib/python2.6/site-packages/createrepo/__init__.py
   fi

   if [ "v"$RFRENIX_VER11 == "v11" ] && [ ! -e /usr/lib/python2.6/site-packages/createrepo/createrepo.patch ]; then
      echo
      echo 'Patching utility createrepo...'
      echo

      cp -f ./createrepo.patch /usr/lib/python2.6/site-packages/createrepo
      cp /usr/lib/python2.6/site-packages/createrepo/__init__.py /usr/lib/python2.6/site-packages/createrepo/__init__OLD.py
      patch -i /usr/lib/python2.6/site-packages/createrepo/createrepo.patch /usr/lib/python2.6/site-packages/createrepo/__init__.py
    fi

   echo
   echo 'Creation of information repositories...'
   echo

   createrepo -g "$COMPSFILE" --baseurl "media://"$RFREMIX13_MEDIA_ID -d -o "$SRCDVDDIR" "$SRCDVDDIR"

   echo
   echo 'Checksum repodata/repomd.xml...'
   echo

   SHA256REPO=`(sha256sum ./srcdvd/repodata/repomd.xml) | awk '{ print $1 }'`
   REPOINFO="repodata/repomd.xml = sha256:""$SHA256REPO"
   (cat ./mnt/disc1/.treeinfo) | awk '{ if(match($0,"repodata")==0) print; else print "'"$REPOINFO"'" }' > ./srcdvd/.treeinfo

   echo
   echo 'Creating a bootable DVD ISO-image...'
   echo

   mkisofs -r -T -joliet-long -V "$DVD_LABEL" -b isolinux/isolinux.bin -c isolinux/boot.cat \
      -no-emul-boot -boot-load-size 4 -boot-info-table -o  "$DVDISOFILE" "$SRCDVDDIR" 2> ./make_iso.log

   cleandata

   ls -l ./dvd-iso

   echo
   echo 'Create DVD ISO completed!'
   echo


В каталоге размещаем два patch-файла для createrepo 
(пакет должен быть установлен). Патчи необходимы, иначе
мы получим пропуск некоторых rpm-пакетов.

Файл createrepo.patch (для RFRemix 11):

   *** ./__init__.py	2010-05-29 22:51:15.000000000 +0300
   --- ./__init__update.py	2010-05-30 07:26:02.000000000 +0300
   ***************
   *** 72,78 ****
          self.oldpackage_paths = [] # where to look for the old packages - 
          self.deltafile = 'prestodelta.xml.gz'
          self.num_deltas = 1 # number of older versions to delta (max)
   !      self.max_delta_rpm_size = 100000000
          self.update_md_path = None 
          self.skip_stat = False
          self.database = False
   --- 72,78 ----
          self.oldpackage_paths = [] # where to look for the old packages - 
          self.deltafile = 'prestodelta.xml.gz'
          self.num_deltas = 1 # number of older versions to delta (max)
   !      self.max_delta_rpm_size = 1000000000L
          self.update_md_path = None 
          self.skip_stat = False
          self.database = False
   ***************
   *** 588,594 ****
          """
          
          # duck and cover if the pkg.size is > whatever
   !      if int(pkg.size) > self.conf.max_delta_rpm_size:
              if not self.conf.quiet: 
                  self.callback.log("Skipping %s package " \
                                      "that is > max_delta_rpm_size"  % pkg)
   --- 588,594 ----
          """
          
          # duck and cover if the pkg.size is > whatever
   !      if long(pkg.size) > self.conf.max_delta_rpm_size:
              if not self.conf.quiet: 
                  self.callback.log("Skipping %s package " \
                                      "that is > max_delta_rpm_size"  % pkg)
   ***************
   *** 638,644 ****
          for d in self.conf.oldpackage_paths:
              for f in self.getFileList(d, 'rpm'):
                  fp = d + '/' + f
   !              if int(os.stat(fp)[stat.ST_SIZE]) > self.conf.max_delta_rpm_size:
                      self.callback.log("Skipping %s package " \
                                        "that is > max_delta_rpm_size"  % f)
                      continue
   --- 638,644 ----
          for d in self.conf.oldpackage_paths:
              for f in self.getFileList(d, 'rpm'):
                  fp = d + '/' + f
   !              if long(os.stat(fp)[stat.ST_SIZE]) > self.conf.max_delta_rpm_size:
                      self.callback.log("Skipping %s package " \
                                        "that is > max_delta_rpm_size"  % f)
                      continue


Файл createrepo_rfremix12.patch (для RFRemix 12):


   *** ./__init__.py	2010-05-30 09:28:40.000000000 +0300
   --- ./__init__update_f12.py	2010-05-30 09:38:01.000000000 +0300
   ***************
   *** 74,80 ****
          self.oldpackage_paths = [] # where to look for the old packages - 
          self.deltafile = 'prestodelta.xml.gz'
          self.num_deltas = 1 # number of older versions to delta (max)
   !      self.max_delta_rpm_size = 100000000
          self.update_md_path = None 
          self.skip_stat = False
          self.database = False
   --- 74,80 ----
          self.oldpackage_paths = [] # where to alook for the old packages - 
          self.deltafile = 'prestodelta.xml.gz'
          self.num_deltas = 1 # number of older versions to delta (max)
   !      self.max_delta_rpm_size = 1000000000L
          self.update_md_path = None 
          self.skip_stat = False
          self.database = False
   ***************
   *** 613,619 ****
          """
          drpm_pkg_time = time.time()
          # duck and cover if the pkg.size is > whatever
   !      if int(pkg.size) > self.conf.max_delta_rpm_size:
              if not self.conf.quiet: 
                  self.callback.log("Skipping %s package " \
                                      "that is > max_delta_rpm_size"  % pkg)
   --- 613,619 ----
          """
          drpm_pkg_time = time.time()
          # duck and cover if the pkg.size is > whatever
   !      if long(pkg.size) > self.conf.max_delta_rpm_size:
              if not self.conf.quiet: 
                  self.callback.log("Skipping %s package " \
                                      "that is > max_delta_rpm_size"  % pkg)
   ***************
   *** 671,677 ****
              for f in self.getFileList(d, 'rpm'):
                  fp = d + '/' + f
                  fpstat = os.stat(fp)
   !              if int(fpstat[stat.ST_SIZE]) > self.conf.max_delta_rpm_size:
                      self.callback.log("Skipping %s package " \
                                        "that is > max_delta_rpm_size"  % f)
                      continue
   --- 671,677 ----
              for f in self.getFileList(d, 'rpm'):
                  fp = d + '/' + f
                  fpstat = os.stat(fp)
   !              if long(fpstat[stat.ST_SIZE]) > self.conf.max_delta_rpm_size:
                      self.callback.log("Skipping %s package " \
                                        "that is > max_delta_rpm_size"  % f)
                      continue


Установить атрибут MakeDVD.sh на выполнение.
Запустить файл MakeDVD.sh.
В каталоге dvd-iso получим DVD ISO-образ Russian Remix Fedora 13.
Исходники скрипта и патчей.
 
31.05.2010 , Автор: Igor
Ключи: fedora, dvd, cd, packet, iso / Лицензия: CC-BY
Раздел:    Корень / Администратору / Система / Linux специфика / Установка и работа с пакетами программ в Linux

Обсуждение [ RSS ]
  • 1, Igor (??), 14:45, 31/05/2010 [ответить]  
  • +/
    Автор - не тот Igor, который зарегистрирован. :)
     

     Добавить комментарий
    Имя:
    E-Mail:
    Заголовок:
    Текст:




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру