[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#294031: script for local/offiline repository of debs



Package: apt
Version: 0.5.27
Severity: wishlist

i hope that this mail does not reach you twice, if it is
accept my apologies (i do not see my original message in the
archives)


an unfinished , example of concept script, a lot of corrections
needed, "download once - re-use anywhere"









#!/bin/sh
# /usr/local/sbin/apt-slow
# this script downloads deb packages slowly with wget
# http://www.mail-archive.com/wget@sunsite.dk/msg05958.html
#
# bash program to arrange *.debs per pkg name, can be combined
# with a crontab job at a remote dsl feed to pull files during low
# link utilization time (e.g. night), gathers "__DEPENDS__".debs together
# in the same folder named $PKG_NAME
#
# the master objective is to have as fewer logins/logouts/re-logins,
# conn/disconnections of wget from a possibly fragile ftp server, also
# not to re-download already downloaded .debs that exist in the cache ,
# be able to easily cp the cache in another machine and use it there
#
# maybe too poor compared to apt-proxy
# deity __hotmail__ lists.debian.org


# get up-to-date list
#apt-get update -c /etc/apt_ftp.conf && echo $(date)>>/update

# will hold files containing lists of .deb filenames
#mkdir /tmp/deb_lists

# some sample packages
# make a hierarchy of importance, firstly install e.g gcc and glibc and
# then less common/frequent, when the less frequent packages (e.g. gtk-dev)
# come they will find gcc already there no re-download
#
# gcc-3.4
# x-windows-system
# lynx mc lftp wget hdparm traceroute make make unzip bzip2 dpkg-multicd screen
# nedit xchat cdrecord mkisofs mozilla tethereal
# glade-2 gfc-examples libgtk2.0-dev postgresql -doc -dev -contrib -client
# apt-doc apt-howto-en dpkg-doc

# wget will put everything at /tmp/
#cd /tmp/

# download from the net the file that holds the names of the packages to
# fetch
#wget http://__MY_HOMEPAGE__/pkg_data -c --limit-rate=20k -a /tmp/pkg_listfile -r -nd --background

# update archive/cache listfile of debs currently in the cache
# pathprefix option fixes all "file not found" problems
#dpkg-scanpackages /deb1 /dev/null /deb1/|gzip >/deb1/Packages.gz
#apt-get update


# have the -d], the ] is delimiter , so that no bogus \n are read
# thus making the loop running on empty lines
#
#while read -d] pkg_name
#do

# create a file into /tmp/deb_lists/ that contains ftp:// uris of debs
# to be downloaded with wget
# options can be used -o dir::state::status="/base_install/status"
# -o dir::cache::archives="/deb/"
#apt-get install ${pkg_name} -qq -c /etc/apt.conf.old|awk -F\' '{print $2}'|grep .deb>/tmp/deb_lists/${pkg_name}

#mk the dirs that will accept the final sorted/seperated .debs
#mkdir /tmp/${pkg_name}

#done < /pkg_data

#verify what pwd is
cd /down
#cat /tmp/deb_lists/*>/tmp/uris.tmp

wget -i /deb.txt -c --limit-rate=20k -a /tmp/download-apt-slow -r -np --background



#-B 195.170.0.2 -nd

#
# nested loops, first (outside) loop gets name of package, nested (inside)
# loop gets deb filenames for each packages and mv the debs to their
# respective folder
#
#while read -d] pkg_name
#do
#  while read fname
#  do
#  echo /tmp/$(basename $fname) /tmp/$pkg_name/
#  done</tmp/deb_lists/$pkg_name
  #echo george
#done</pkg_data

# view the download process
#tail -f /tmp/download-apt-slow



# dpkg -i -R /tmp/
# export la=${la}tra

# if download completed correctly (wget exit code correct)
# mv /var/cache/apt-slow/*.deb /var/cache/apt/archives ; apt-get deselect-upgrade








apt.conf.old




// the state dir is diverted to a directory that is a copy of the state
// of a freshly installed sid, the state effectively "freezes" and the
// script operation is isolated from the package changes that happen on the
// machine

// $Id: configure-index,v 1.10 2004/07/17 19:37:16 mdz Exp $
/* This file is an index of all APT configuration directives. It should
   NOT actually be used as a real config file, though it is (except for the
   last line) a completely valid file. Most of the options have sane default
   values, unless you have specific needs you should NOT include arbitary
   items in a custom configuration.

   In some instances involving filenames it is possible to set the default
   directory when the path is evaluated. This means you can use relative
   paths within the sub scope.

   The configuration directives are specified in a tree with {} designating
   a subscope relative to the tag before the {}. You can further specify
   a subscope using scope notation eg,
     APT::Architecture "i386";
   This is prefixed with the current scope. Scope notation must be used
   if an option is specified on the command line with -o.
*/

quiet "0";

// Options for APT in general

APT
{
  Architecture "i386";
  //Build-Essential "build-essential";

  // Options for apt-get
  Get
  {
     Arch-Only "false";
     Download-Only "true";
     Simulate "false";
     Assume-Yes "true";
     Force-Yes "false";             // I would never set this.
     Fix-Broken "false";
     Fix-Missing "false";
     Show-Upgraded "false";
     Show-Versions "false";
     Upgrade "true";
     Print-URIs "true";
     Compile "false";
     Download "false";
     Purge "false";
     List-Cleanup "true";
     ReInstall "false";
     Trivial-Only "false";
     Remove "true";
     Only-Source "";
     Diff-Only "false";
     Tar-Only "false";
  };

/*
  Cache
  {
     Important "false";
     AllVersions "false";
     GivenOnly "false";
     RecurseDepends "false";
     ShowFull "false";
     Generate "true";
     NamesOnly "false";
     AllNames "false";
     Installed "false";
  };

*/

/*
  CDROM
  {
     Rename "false";
     NoMount "false";
     Fast "false";
     NoAct "false";
  };
*/
  // Some general options
/*
  Ignore-Hold "false";
  Clean-Installed "true";
  Immediate-Configure "true";      // DO NOT turn this off, see the man page
  Force-LoopBreak "false";         // DO NOT turn this on, see the man page
  Cache-Limit "4194304";
  Default-Release "";
*/
};

// Options for the downloading routines
Acquire
{
  Queue-Mode "host";       // host|access
  Retries "0";
  Source-Symlinks "true";

  // HTTP method configuration
/*
  http
  {
    Proxy "http://127.0.0.1:3128";;
    Proxy::http.us.debian.org "DIRECT";  // Specific per-host setting
    Timeout "120";
    Pipeline-Depth "5";

    // Cache Control. Note these do not work with Squid 2.0.2
    No-Cache "false";
    Max-Age "86400";     // 1 Day age on index files
    No-Store "false";    // Prevent the cache from storing archives
  };
*/

  ftp
  {
    //Proxy "ftp://192.168.10.2:21/";;
    //Proxy::debian.otenet.gr "DIRECT";  //Specific per-host setting

    /* Required script to perform proxy login. This example should work
       for tisfwtk */
    ProxyLogin
    {
       //"USER $(PROXY_USER)";
       //"PASS $(PROXY_PASS)";
       "USER $(SITE_USER)@$(SITE):$(SITE_PORT)";
       "PASS $(SITE_PASS)";
       //"PASS k@";

     };

    Timeout "120";

    /* Passive mode control, proxy, non-proxy and per-host. Pasv mode
       is prefered if possible */
    Passive "true";
    //Proxy::Passive "true";
    Passive::debian.otenet.gr "true"; // Specific per-host setting
  };

/*
  cdrom
  {
    mount "/cdrom";

    // You need the trailing slash!
    "/cdrom/"
    {
       Mount "sleep 1000";
       UMount "sleep 500";
    }
  };
 */

};

// Directory layout



Dir "/"
{
  // Location of the state dir


 //State "var/lib/apt/"
 State "/base_install/apt/"
   {
     Lists "lists/";
     xstatus "xstatus";
     userstatus "status.user";
     //status "/var/lib/dpkg/status";
     status "/base_install/status";
     cdroms "cdroms.list";
  };

/*
  // Location of the cache dir
  Cache "var/cache/apt/" {
     Archives "archives/";
     srcpkgcache "srcpkgcache.bin";
     pkgcache "pkgcache.bin";
  };

  // Config files


  Etc "etc/apt/" {
     SourceList "sources.list";
    // Main "apt.conf";
    // Preferences "preferences";
    // Parts "apt.conf.d/";
  };


  // Locations of binaries

  Bin {
     methods "/usr/lib/apt/methods/";
     gzip "/bin/gzip";
     dpkg "/usr/bin/dpkg";
     dpkg-source "/usr/bin/dpkg-source";
     dpkg-buildpackage "/usr/bin/dpkg-buildpackage"
     apt-get "/usr/bin/apt-get";
     apt-cache "/usr/bin/apt-cache";
  };*/

};


// Things that effect the APT dselect method
/*
DSelect
{
   Clean "auto";   // always|auto|prompt|never
   Options "-f";
   UpdateOptions "";
   PromptAfterUpdate "no";
   CheckDir "no";
}
*/

/*
DPkg
{
   // Probably don't want to use force-downgrade..
   Options {"--force-overwrite";"--force-downgrade";}

   // Auto re-mounting of a readonly /usr
   Pre-Invoke {"mount -o remount,rw /usr";};
   Post-Invoke {"mount -o remount,ro /usr";};

   // Prevents daemons from getting cwd as something mountable (default)
   Run-Directory "/";

   // Build options for apt-get source --compile
   Build-Options "-b -uc";

   // Pre-configure all packages before they are installed using debconf.
   Pre-Install-Pkgs {"dpkg-preconfigure --apt --priority=low --frontend=dialog";};

   // Flush the contents of stdin before forking dpkg.
   FlushSTDIN "true";

   // Control the size of the command line passed to dpkg.
   MaxBytes 1024;
   MaxArgs 350;
}
*/

/* Options you can set to see some debugging text They correspond to names
   of classes in the source code */


/*
Debug
{
//  pkgProblemResolver "false";
//  pkgAcquire "false";
//  pkgAcquire::Worker "false";
//  pkgDPkgPM "false";
//  pkgOrderList "false";

//  pkgInitialize "false";   // This one will dump the configuration space
//  NoLocking "false";
  Acquire::Ftp "true";    // Show ftp command traffic
//  Acquire::Http "false";   // Show http command traffic
//  aptcdrom "false";        // Show found package files
//  IdentCdrom "false";
}
*/


/* Whatever you do, do not use this configuration file!! Take out ONLY
   the portions you need! */

//This Is Not A Valid Config File













apt_ftp.conf // fast ftp access

// $Id: configure-index,v 1.10 2004/07/17 19:37:16 mdz Exp $
/* This file is an index of all APT configuration directives. It should
   NOT actually be used as a real config file, though it is (except for the
   last line) a completely valid file. Most of the options have sane default
   values, unless you have specific needs you should NOT include arbitary
   items in a custom configuration.

   In some instances involving filenames it is possible to set the default
   directory when the path is evaluated. This means you can use relative
   paths within the sub scope.

   The configuration directives are specified in a tree with {} designating
   a subscope relative to the tag before the {}. You can further specify
   a subscope using scope notation eg,
     APT::Architecture "i386";
   This is prefixed with the current scope. Scope notation must be used
   if an option is specified on the command line with -o.
*/

quiet "0";

// Options for APT in general

APT
{
  Architecture "i386";
  //Build-Essential "build-essential";

  // Options for apt-get
  Get
  {
     Arch-Only "false";
     Download-Only "true";
     Simulate "false";
     Assume-Yes "false";
     Force-Yes "false";             // I would never set this.
     Fix-Broken "false";
     Fix-Missing "false";
     Show-Upgraded "false";
     Show-Versions "false";
     Upgrade "true";
     Print-URIs "false";
     Compile "false";
     Download "true";
     Purge "false";
     List-Cleanup "true";
     ReInstall "false";
     Trivial-Only "false";
     Remove "true";
     Only-Source "";
     Diff-Only "false";
     Tar-Only "false";
  };

};

// Options for the downloading routines
Acquire
{
  Queue-Mode "host";       // host|access
  Retries "0";
  Source-Symlinks "true";


  ftp
  {
    //Proxy "ftp://anonymous:anonymous@192.168.10.2:21";;

    /* Required script to perform proxy login. This example should work
       for tisfwtk */
    ProxyLogin
    {
       //"USER $(PROXY_USER)";
       //"PASS $(PROXY_PASS)";
       "USER $(SITE_USER)@$(SITE):$(SITE_PORT)";
       "PASS $(SITE_PASS)";
    };

    Timeout "120";

    /* Passive mode control, proxy, non-proxy and per-host. Pasv mode
       is prefered if possible */
    Passive "true";
    //Proxy::Passive "true";
    Passive::debian.otenet.gr "true"; // Specific per-host setting
  };


};

/* Whatever you do, do not use this configuration file!! Take out ONLY
   the portions you need! */

//This Is Not A Valid Config File









#deb file:///cdrom/ sarge main

deb cdrom:[Debian GNU/Linux testing _Sarge_ - Official Snapshot i386 Binary-1 (20040909)]/ unstable contrib main

# deb http://security.debian.org/ testing/updates main contrib





#deb file:///cdrom/ sarge main

#deb cdrom:[Debian GNU/Linux testing _Sarge_ - Official Snapshot i386 Binary-1 (20040909)]/ unstable contrib main

#deb http://security.debian.org/ testing/updates main contrib
#deb http://debian.otenet.gr/debian/ experimental main
deb file:/ deb/
deb ftp://195.170.0.21:21/pub/linux/debian unstable main
#deb file:/deb/ unstable









Reply to: