# -*- Shell-script -*-
# This file contains data that is used by ALT `distribute' program 
# to explain something to the user.
# 
# This is a part of ALT `distribute' program
# by Ivan Zakharyaschev <imz@altlinux.ru>
# licensed to you under the terms of GPL version 2.
#
# Last change: 2002 Jul 10
#################################


# Configuration patterns:

function general_conf() {

cat <<EOF
# Configuration for $0.
#
# When this script will be executed \$TASKNAME will be the name of the 
# task.
#
# In bytes; this is the space you allocate for the packages on a disk --
# remember: the directories and the indexes also consume some space.
# default:
#CDVOLUME=650000000
# another example:
#CDVOLUME=100000000

# Default:
#ONLY_REAL_FILES=yes

# Default:
#INDEX_FOR_APT=yes
#CREATE_PLAIN_INDEX=yes

EOF

}

function task_conf() {

general_conf
cat <<EOF
# Set this to the suffix 
# (that is appended to the distribution name to indentify a variant of it)
#
#SUFFIX=sisyphus\$(date +%Y%m%d)
# or (default):
#SUFFIX="\$TASKNAME"\$(date +%Y%m%d)
# or (to disable it -- not for APT):
#SUFFIX=

# A general name for the collection
#PREFIX=Mandrake
#PREFIX=RedHat
PREFIX=ALTLinux

# This must be here (if you are going to index for APT).
ARCH=i586

# type (as well as PREFIX and SUFFIX) is important for how the packages
# will be laid out on the disks; the path to a local mirror specifyies 
# how to find the packges of a certain type that you want to put on the 
# disks.
TYPE_N_LOCALMIRROR_TABLE="
# Empty lines are ignored; a line _beginning_ with '#' is a comment.
  \$ARCH/RPMS  /user/ALT/Sisyphus/i586/Mandrake/RPMS
  SRPMS       /user/ALT/Sisyphus/SRPMS

#  \$ARCH/RPMS  /var/cache/apt/archives
"


# Every CD in the set will be label with the title and some other info.
#
#CD_COLLECTION_TITLE='Sysiphus snapshot'
# or (default):
#CD_COLLECTION_TITLE='\$TASKNAME'
# or:
#CD_COLLECTION_TITLE='$TASKNAME'

# You can publish the lists of packages in fixed bases 
# (using rsync by default) 
# at the specified location:
#PUBLIC_SITE=remote:my_site/some_dir
EOF

}

# Help:

function help() {
echo "$0: Distribute a collection of packages on multiple CDs, issue updates to the released distribution."
echo "Especially good at distributing such collections for future use \
by APT."
echo
echo "This is '$PROGNAME' version $PROGVERSION,"
echo " Copyright (C) 2002 Ivan Zakharyaschev <imz@altlinux.ru>."
echo "'$PROGNAME' comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under 
certain conditions; see /usr/share/doc/$PROGNAME-$PROGVERSION/COPYING
for details."
echo
echo "The ways of how you can use this script are summarized here"
echo 
echo "You have just made an error or called smth like:"
echo " $0 (--usage|--help)"
echo
echo "First of all, you should set up a new 'task'. Or, you can use one of the already set up tasks (system-wide or your own; this program comes with an example of a system-wide task configuration: Sisyphus)."
echo "To set up a new task, think of a good name \
for it, then print out the \
example of a task configuration and edit it. (The simplest way is to invoke this mode without the optional FILENAME.):"
echo " $0 TASKNAME --gen-taskconf [ FILENAME ]"
echo
echo The configuration file should define a table of locations of packages you want to distribute.
echo
echo "The first step in creating a distribution is to fixate the state of the collections of packages. The fixed state will be called 'base'. To perform this initial step, run:"
echo " $0 TASKNAME --fix-base STATE_ID"
echo ", where STATE_ID will be used in future to refer to this fixed state."
echo "You can give a special title to the fixed collection of packages (it's the title, not the identifier/name; there is a default value for the title that should be OK): to do this, edit a file called 'title' in the directory where distribute has stored the base (smth like '~/.var/distribute/bases/TASKNAME/STATE_ID/)."
echo
echo " $0 TASKNAME (--ls-base | --rm-base) STATE_ID_PATTERN"
echo ", where STATE_ID_PATTERN (i.e. '*') matches state IDs fixed before."
echo
echo "After that you may lay out the future disks (this won't take much \
time because no actual copying is made):"
echo " $0 TASKNAME --LAYOUT-FULL STATE_ID"
echo
echo "Smaller steps that are done when you call --LAYOUT can also be \
performed by you by invoking one of these:"
echo " $0 TASKNAME (--clear | --split-full STATE_ID | --index | --list)"
echo
echo "When you have laid out the future disks, you will probably want \
to manipulate the ISOs for them:"
echo " $0 TASKNAME (--mkiso | --record | --rmiso | --lsiso) [ N ]"
echo "If you wish to write disks on fly, use "
echo " $0 TASKNAME (--recordcd | --recorddvd) [ N ]"
echo
echo
echo
echo "There is also another mode of splitting the collection of packages into disks: the one that you have been already told about is called 'full', which means that it puts ALL packages from the fixed base (identified by STATE_ID) onto the disks (the correcponding commands are '--LAYOUT-FULL' and '--split-full'). The other mode is putting only the difference between the given base and another base that was fixed some time ago and has another identifier (that's mainly what we need the bases for!). This mode is called 'diff'. The corresponding commands, as you can guess, are '--LAYOUT-DIFF' and '--split-diff'. Here is the way you can invoke them:"
echo
echo " $0 TASKNAME --LAYOUT-DIFF STATE_ID ANOTHER_BASE_ID"
echo ", where ANOTHER_BASE_ID identifies the base from which the difference has to be calculated. ANOTHER_BASE_ID is of the form: ANOTHER_TASKNAME/ANOTHER_STATE_ID, where ANOTHER_TASKNAME may be equal to TASKNAME if you have fixed the previous state for the same task (task determines the original locations of the packages)."
echo
echo "Fixing the state of a collection of packages by calling --fix-base is good for collections that change with the flow of time (like Sisyphus). But if you want to deal with a fixed collection that won't change in future (such as a released distribution like ALTLInux Junior), then you can just link the location of it inside the directory for distribute's bases and do not call '--fix-base'. (Look inside the directory to understand how it is organized.)"
echo
echo
echo 
echo "There are more supplementary commands to operate on a base state:"
echo " $0 TASKNAME --make-plain-index STATE_ID "
echo ", which dumps lists of package-filenames fixed in this base to several files at the place where the base STATE_ID is stored (the last is done by --fix-base by default). If your PUBLIC_SITE parameter is not empty, they will be published into a subdirectory of your site with the name of this base. These lists are put in .disk/ on every CD, generated from this base."
echo "And: "
echo " $0 TASKNAME --rm-base STATE_ID"
echo "to remove all data that stores the base STATE_ID."
echo
echo "In these two commands STATE_ID can have a special value '*', which means that this command will be applied to each of your bases."
echo
echo
echo "You can change some parameters of distribute by setting corresponding environment variables (either in command line or in a config file). The most useful is probably CDVOLUME (in bytes)."
echo
echo "If you are not happy with the settings your administrator or \
distribution packgers have done for you, and you do not want to change \
them in every task configuration (created by --gen-taskconf) or in every command line invokation of distribute, then you \
can create your own global confgiuration file by invoking:"
echo " $0 --gen-myconf [ FILENAME ]"
echo
echo "Report bugs to the author: Ivan Zakharyaschev <imz@altlinux.ru>"
echo "Last change: February 2002."
echo "You may use ALT 'distribute' under the terms of GPL version 2."
}

function usage() {
echo "$0: Distribute a collection of packages on multiple CDs, issue updates to the released distribution."
echo "Especially good at distributing such collections for future use \
by APT."
echo
echo "This is '$PROGNAME' version $PROGVERSION,"
echo " Copyright (C) 2002 Ivan Zakharyaschev <imz@altlinux.ru>."
echo "'$PROGNAME' comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under 
certain conditions; see /usr/share/doc/$PROGNAME-$PROGVERSION/COPYING 
for details."
echo
echo " $0 (--usage|--help)  for more detailed help"
echo " $0 TASKNAME --gen-taskconf [ FILENAME ]"
echo " $0 TASKNAME --fix-base STATE_ID"
echo " $0 TASKNAME (--ls-base | --rm-base) STATE_ID_PATTERN"
echo " $0 TASKNAME --LAYOUT-FULL STATE_ID"
echo " $0 TASKNAME (--clear | --split-full STATE_ID | --index | --list)"
echo " $0 TASKNAME (--mkiso | --record | --rmiso | --lsiso) [ N ]"
echo " $0 TASKNAME (--recordcd | --recorddvd ) [ N ]"
echo " $0 TASKNAME --LAYOUT-DIFF STATE_ID ANOTHER_BASE_ID"
echo " $0 TASKNAME --rm-base STATE_ID"
echo " $0 TASKNAME --make-plain-index STATE_ID [ DEST_DIR ]"
echo " $0 --gen-myconf [ FILENAME ]"
echo
echo "Report bugs to the author: Ivan Zakharyaschev <imz@altlinux.ru>"
echo "Last change: February 2002."
echo "You may use ALT 'distribute' under the terms of GPL version 2."
}

