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

announce: apt-detach draft v0.1



i'm posting a draft for the design of apt-detach tool i started
coding few days ago.

comments are very welcome.

cheers
domenico


draft -- draft -- draft -- draft -- draft -- draft -- draft -- draft
 -- draft -- draft -- draft -- draft -- draft -- draft -- draft --


                           apt-detach v0.1

                             9 Oct 2001
                Domenico Andreoli <cavok@debian.org>



Terms
~~~~~
origin - is an apt powered linux box. usually it has not internet
         connection.

host   - is like a "origin" box but with internet connection.

unit   - is a properly conditioned directory created from a "origin".
         apt units remember which packages were installed on their
         "origin" at the moment of their creation.


What
~~~~
apt-detach tool allows creation of independent units from a working
apt system. units can be used on a "host" to download updated lists
of available packages from any number of apt sources. optionally new
versions of packages can be downloaded and stored in the unit itself
for a later installation on "origin". 

units work on a host like a detached (hence the name) apt subsystem
which represents its origin. operations made on a unit are the same
that apt provides on the origin[1]. of course first working releases
of apt-detach will not implement all the functionalities of apt but
it is desirable to keep this as a long term goal.

origin does not modify its state up on generation of new units, so it
can have more than one unit. subsequent modifications of state on the
origin should not influence the success of future "merging" with updated
units. apt/dpkg should be used by apt-detach in a way that cannot put
origin in a previous or older state, unless this is not explicitly
requested by the user.

apt-detach must be a "good" apt tool and must share the same conventions
of the other apt tools. it shares the same apt.conf and provides the
ability to deviate from its default behaviors.

letting the user someway run dselect (or aptitude/deity/whatever) on
a unit could be a very interesting secondary goal as well.

user on "origin" must be able to choose which of the packages contained
in a unit should be installed.


Why
~~~
i know, internet is going everywhere... anyway i think that many users,
like i am, cannot effort a wide bandwidth connection for their private
use and then cannot upgrade their beloved unstable/testing boxes at
home. apt-zip is good to keep manually in sync your distribution but
for serious upgrades we (me for sure) want to use more of the power
apt provides. allowing me serious upgrades is my primary target. 
this way users "book" an installation and let the "dirty" work of
updating and downloading for a better connected machine.


How
~~~
actually apt-detach is a script shell. this weekend i worked at its
behavior as an apt tool. in the meantime i made some tests with very
useful apt-get options (Dir one is my preferred). nothing works :)
my idea is to put in a unit the following info/files:
  - /etc/apt/sources.list
  - /var/lib/apt/lists/
  - /var/cache/apt/ (this would be the part of unit filled with packages
                     to be installed on origin)
  - /var/lib/dpkg/status
  - random scripts to ease the use of the unit on hosts
  - others that for sure are needed and which i'm not aware of

apt on host should have all the needed pieces to complete the update
of available lists of packages and to download the required ones.
once the unit is updated it needs to me "merged" with its origin in order
to update origin's availability lists and fill its cache dir in order to
make it perform a full and hopefully clean apt-get upgrade. to the user
the choice of running apt-get upgrade or dselect (or whatever).


Conclusions
~~~~~~~~~~~
this is a draft, a dump of my ideas for the moment. i'm sure i'll achieve
my goals sooner or later. i'm opening my intention to the community in
order to provide a really useful tool to the others too. i'm announcing on
this list because here i hope to find most of the support. i need to know
the needings that you might have and maybe a solution for some problems i
can still find on my way. i also know that you know apt much better than
me and maybe find problems, as well as solutions, much earlier then me.

i'm open to any kind and number of criticisms. please feel free to
comment publicly this sort of draft. moreover i'm not a native english
speaker then this document might sound "odd" somewhere. please feel free
to discuss the form too.


thanks

sincerely
cavok


Notes
~~~~~
[1] - here i still need to choose how to implement some parts of
      apt-detach. i'm currently thinking at 3 different "designs":
      1. on origin apt-detach creates a particular set of scripts for
         each unit. these scripts eventually download on host required
         packages and make the origin available of download packages.
         this is how the problem apt-detach should solve is handled by
         apt-zip. of course, since apt-zip does its work nicely, i never
         really thought at this as a feasible option. anyway it has the
         benefit that accordingly created units would be very portable
         across many operating system. however it would lack to update
         apt availabilities on origin.
      2. units can use local installation of apt on host in order to
         update themselves and download required packages. of course apt
         status of the host would not get modified in any way from these
         operations on units.
      3. optionally, units could acquire status and maybe the packages
         too from the host itself without assuming it should be connected
         to internet.
      Design number 2 is my preferred one at moment




draft -- draft -- draft -- draft -- draft -- draft -- draft -- draft
 -- draft -- draft -- draft -- draft -- draft -- draft -- draft --

-----[ Domenico Andreoli, aka cavok
 --[ http://filibusta.crema.unimi.it/~cavok/gpgkey.asc
   ---[ 3A0F 2F80 F79C 678A 8936  4FEE 0677 9033 A20E BC50
#!/bin/sh

VERSION="0.0.1"
APT_DETACH=`basename $0`

DEBUG="true"

if [ -n "${DEBUG}" ]; then
	DEBUG_APT_DIR="${HOME}/devel/apt-detach/tmp/"
	DEBUG_APT_CONF="${DEBUG_APT_DIR}etc/apt/apt.conf"
fi

DEFAULT_ADMIN_DIR="var/lib/apt-detach/"
ADMIN_DIR=${DEFAULT_ADMIN_DIR}

DEFAULT_MOUNTPOINT="mnt"
MOUNTPOINT=${DEFAULT_MOUNTPOINT}

DEFAULT_NOMOUNT="true"
NOMOUNT=${DEFAULT_NOMOUNT}

function about()
{
	echo "${APT_DETACH} ${VERSION}"
	echo "Usage: ${APT_DETACH} [options] <command>"
	echo ""
	echo "Commands:"
	echo "  detach"
	echo "  merge"
	echo ""
	echo "Options:"
	echo "  -h/--help     This help text."
	echo "  -v/--version  Print version info."
	echo ""
	echo "See the apt-detach(8) and apt.conf(5) manual pages."
}

TEMP=`getopt -o c:ho:v -l config-file:,help,option:,version -n "${APT_DETACH}" -- "$@"`
if [ $? != 0 ]; then about; exit 1; fi

eval set -- "$TEMP"

if [ -n "${DEBUG}" ]; then
	APT_CONF="-c ${DEBUG_APT_CONF}"
	APT_OPTIONS="-o Dir=${DEBUG_APT_DIR}"
fi

while true ; do
	case "$1" in
		-c|--config-file)
			APT_CONF="-c $2"
			shift 2;;
		
		-o|--option)
			APT_OPTIONS="${APT_OPTIONS} -o $2"
			shift 2;;
		
		-v|--version)
			echo "${APT_DETACH} ${VERSION}"
			echo ""
			echo "This is free software, please read GPL license for more info."
			exit;;
		
		--)
			shift
			break;;
	
		*)
			about
			exit 1;;
	esac
done

if [ $# == 0 ]; then about; exit 1; fi

if [ -n "${DEBUG}" ]; then
	echo "apt-config $APT_CONF $APT_OPTIONS dump"
	apt-config $APT_CONF $APT_OPTIONS dump
	echo ""
fi

set -e
eval `apt-config $APT_CONF $APT_OPTIONS shell \
                 ADMIN_DIR Dir::Detach::Admin/d \
                 APT_DIR Dir/d \
                 MOUNTPOINT Acquire::Detach::Mount-Point/d \
                 NOMOUNT Acquire::Detach::NoMount/b`
set +e
				 
echo "ADMIN_DIR=${APT_DIR}${ADMIN_DIR}"
echo "MOUNTPOINT=${APT_DIR}${MOUNTPOINT}"
echo "NOMOUNT=$NOMOUNT"
echo ""

if [ "${NOMOUNT}" != "true" ]; then
	mount ${APT_DIR}${MOUNTPOINT} || echo "E: Unable to mount ${APT_DIR}${MOUNTPOINT} - is it in /etc/fstab?"
	exit 1
fi

if [ ! -d "${APT_DIR}${ADMIN_DIR}" -o ! -x "${APT_DIR}${ADMIN_DIR}" ]; then
	echo "E: Unable to change to ${APT_DIR}${ADMIN_DIR} - is it a directory?"
	exit 1
fi

case "$1" in
	detach)
		echo "detaching...";;
	
	merge)
		echo "merging...";;
	
	*)
		echo "E: Invalid operation: $1"
		exit 1;;
esac

Attachment: pgp0spYmT3Fv8.pgp
Description: PGP signature


Reply to: