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

Re: Generacion de CD-Rom con paquetes



Gordon Gekko wrote:
> 
> Ante todo Salu2,
> 
>     Tengo una pequeña duda, me he hecho varias copias de diferentes lugares
> con paquetes (kernel 2.4, XFree4, ...) y quería generarme un CD-Rom que
> añadir al origen de paquetes con "apt-cdrom add" a un Debian que tengo en
> casa, aunque tengo una buena conexion prefiero no bajarme las cosas mas de
> una vez.
> 
> He buscado informacion sobre como deberia ser la extructura de este CD pero
> no he encontrado nada "satisfactorio" ¿ Alguna Idea ?.
> 
> Se que podria hacerlo indicando en el sources.list la ruta de los diferentes
> directorios con "file" (aunque estuviesen en un CD-Rom montado) aunque lo
> que busco (si es posible ;-) ) es como hacerlo con un CD para que me
> solicitase este el apt-get install cada vez que instalase algo (es mucho más
> comodo).
Se hace generando un Packages.gz con el parametro -m 

Yo utilizo los siguientes scripts para hacerlo:
el 1º make_dist_dirs te generara una estructura de directorios adecuada.
el 2º make_packages_file te generara los Packages.gz, Release.gz,
Sources.gz etc.

Los otros dos son los ficheros de configuracion de los mismos.

Hazte un directorio, create en el un directorio .disk,copia los dos
ficheros info y parametros y modificalos a tu gusto (info contiene el
nombre que utilizara apt para pedir el disco) 
la sintaxis de parametros la obtienes con make_dist_dirs -h

NOTA FINAL.
La estructura de directorios no tiene porque ser la generada por
make_dist_dirs, pero es una forma de organizar las cosas.




--
Antonio Calvo Rodriguez
antocalvo@jazzfree.com
Vigo/Galicia/España
--
Potato - Local packages
#parametros para herramientas de creacion de cd
CODENAME="potato"
STATE="stable"
#STATE="unstable"
#STATE="frozen"
ARCH="i386"
LOCALSECTIONS="antonio etc"
#!/bin/bash

###########################################################################
#
#	Shell program to Makes directory structure for a local .deb set.
#
#	Copyright 2000, Antonio Calvo Rodriguez,,, <ant@ice>.
#
#	This program is free software; you can redistribute it and/or
#	modify it under the terms of the GNU General Public License as
#	published by the Free Software Foundation; either version 2 of the
#	License, or (at your option) any later version. 
#
#	This program is distributed in the hope that it will be useful, but
#	WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#	General Public License for more details.
#
#	Description:
#
#
#
#	Usage:
#
#		make_dist_dirs [ -h | --help ]
#
#	Options:
#
#		-h, --help	Display this help message and exit.
#
#
#	Revisions:
#
#	11/16/2000	File created
#
###########################################################################


###########################################################################
#	Constants
###########################################################################

PROGNAME=$(basename $0)
VERSION="0.0"

###########################################################################
#	Functions
###########################################################################

function graceful_exit
{
	#####
	#	Function called for a graceful exit
	#	No arguments
	#####

	exit
}


function error_exit 
{
	#####	
	# 	Function for exit due to fatal program error
	# 	Accepts 1 argument
	#		string containing descriptive error message
	#####

	
	echo "${PROGNAME}: ${1:-"Unknown Error"}" >&2
	exit 1
}


function term_exit
{
	#####
	#	Function to perform exit if termination signal is trapped
	#	No arguments
	#####

	echo "${PROGNAME}: Terminated"
	exit
}


function int_exit
{
	#####
	#	Function to perform exit if interrupt signal is trapped
	#	No arguments
	#####

	echo "${PROGNAME}: Aborted by user"
	exit
}


function usage
{
	#####
	#	Function to display usage message (does not exit)
	#	No arguments
	#####

	echo "Usage: ${PROGNAME} [-h | --help]"
}


function helptext
{
	#####
	#	Function to display help message for program
	#	No arguments
	#####
	
	local tab=$(echo -en "\t\t")
		
	cat <<- -EOF-

	${PROGNAME} ver. ${VERSION}	
	This is a program to make a directory structure for a local .deb set.
	
	$(usage)
	
	Options:
	
	-h, --help	Display this help message and exit.
	
	Creates in the working directory a tree conforming to the 
	Debian dists tree structure.
	
	Uses a file called .disk/parametros with the structure that follows:
	#parametros para herramientas de creacion de cd
	CODENAME="potato"
	STATE="stable"
	#STATE="unstable"
	#STATE="frozen"
	ARCH="i386"
	LOCALSECTIONS="antonio helix-gnome updates kernel"
		
-EOF-
}	

function make_dirs
{
	#####
	#	Function to make the dirs.
	#	No arguments. Dont fail if the dir exists
	#####

mkdir -p dists/$CODENAME

for i in $LOCALSECTIONS
do
	mkdir -p dists/$CODENAME/local/binary-$ARCH/$i
	mkdir -p dists/$CODENAME/local/binary-all/$i
	mkdir -p dists/$CODENAME/local/source/$i
done
}

function make_links
{
	#####
	#	Function to make the symbolic links.
	#	No arguments. Dont fail if the link exists
	#####
test -L debian && rm debian
test -L dists/${STATE} && rm dists/${STATE}	

ln -s --force . debian
ln -s --force $CODENAME dists/${STATE}
}



###########################################################################
#	Program starts here
###########################################################################

# Trap TERM, HUP, and INT signals and properly exit
set -e
trap term_exit TERM HUP
trap int_exit INT

# Process command line arguments

if [ "$1" = "--help" ]; then
	helptext
	graceful_exit
fi

# Process arguments - edit to taste

while getopts ":h" opt; do
	case $opt in

		h )	helptext
			graceful_exit ;;
		* )	usage
			exit 1
	esac
done

if [ -r .disk/parametros ]	
    then	
	. .disk/parametros
    else	
	error_exit "Error parameter file .disk/parametros not found."
fi

if [ "$CODENAME" ]
    then
	make_dirs
	make_links
    else
	error_exit "Error .disk/parametros is incorrect."
fi

echo "OK tree created..."
graceful_exit

#!/bin/bash

###########################################################################
#
#	Shell program to make Packages.gz for a cdrom.
#
#	Copyright 2000, Antonio Calvo Rodriguez,,, <ant@ice>.
#
#	This program is free software; you can redistribute it and/or
#	modify it under the terms of the GNU General Public License as
#	published by the Free Software Foundation; either version 2 of the
#	License, or (at your option) any later version. 
#
#	This program is distributed in the hope that it will be useful, but
#	WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#	General Public License for more details.
#
#	Description:
#
#
#
#	Usage:
#
#		make_packages_file [ -h | --help ]
#
#	Options:
#
#		-h, --help	Display this help message and exit.
#
#
#	Revisions:
#
#	11/16/2000	File created
#
###########################################################################


###########################################################################
#	Constants
###########################################################################

PROGNAME=$(basename $0)
VERSION="0.0"

###########################################################################
#	Functions
###########################################################################

function graceful_exit
{
	#####
	#	Function called for a graceful exit
	#	No arguments
	#####

	exit
}


function error_exit 
{
	#####	
	# 	Function for exit due to fatal program error
	# 	Accepts 1 argument
	#		string containing descriptive error message
	#####
	
	echo "${PROGNAME}: ${1:-"Unknown Error"}" >&2
	exit 1
}


function term_exit
{
	#####
	#	Function to perform exit if termination signal is trapped
	#	No arguments
	#####

	echo "${PROGNAME}: Terminated"
	exit
}


function int_exit
{
	#####
	#	Function to perform exit if interrupt signal is trapped
	#	No arguments
	#####

	echo "${PROGNAME}: Aborted by user"
	exit
}


function usage
{
	#####
	#	Function to display usage message (does not exit)
	#	No arguments
	#####

	echo "Usage: ${PROGNAME} [-h | --help]"
}


function helptext
{
	#####
	#	Function to display help message for program
	#	No arguments
	#####
	
	local tab=$(echo -en "\t\t")
		
	cat <<- -EOF-

	${PROGNAME} ver. ${VERSION}	
	This is a program to make Packages.gz for a cdrom of debian packages.
	
	$(usage)
	
	Options:
	
	-h, --help	Display this help message and exit.

	Call it from the root of the cdrom image.
	Needs a file .disk/parametros and a file .disk/info 		
	
	See make_dist_dirs -h 
		
-EOF-
}	


###########################################################################
#	Program starts here
###########################################################################

# Trap TERM, HUP, and INT signals and properly exit

trap term_exit TERM HUP
trap int_exit INT

# Process command line arguments

if [ "$1" = "--help" ]; then
	helptext
	graceful_exit
fi

# Process arguments - edit to taste

while getopts ":h" opt; do
	case $opt in

		h )	helptext
			graceful_exit ;;
		* )	usage
			exit 1
	esac
done

test -r .disk/parametros && . .disk/parametros || error_exit "Error .disk/parametros not found."
test -r .disk/info || error_exit "Error .disk/info not found." 

# local binary
dpkg-scanpackages -m "`cat .disk/info`" \
     dists/$CODENAME/local/binary-$ARCH \
     /dev/null |gzip > dists/$CODENAME/local/binary-$ARCH/Packages.gz
    cp dists/$CODENAME/local/binary-$ARCH/Packages.gz dists/$CODENAME/local/binary-$ARCH/Release.gz

# local sources
dpkg-scansources \
     dists/$CODENAME/local/source \
     /dev/null |gzip > dists/$CODENAME/local/source/Sources.gz
    cp dists/$CODENAME/local/source/Sources.gz dists/$CODENAME/local/source/Release.gz

graceful_exit


Reply to: