ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Mikhail Yakshin <greycat@altlinux.ru>
To: devel <devel@altlinux.ru>
Subject: [devel] APT unified command line interface
Date: Tue, 14 Oct 2003 08:15:30 +0400
Message-ID: <3F8B7862.6070209@altlinux.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 914 bytes --]

Приветствую всех!

Я тут поначитался статьи под названием "Why Debian is not my favourite 
operating system", и под ее влияением сел и написал вот это вот. Потому 
как точно так же, как и автор вышеупомянутой статьи, я окончательно 
замучался набирать для простой установки пакеты строчки по 20 символов 
(особенно без zsh) и объяснять новичкам, в чем сакральная истина отличий 
apt-cache и apt-get.

То, что приложено - очень простенький sh-скрипт, торжественно и, видимо, 
очень неправильно идеологически называющийся просто "apt". У меня - 
работает. Все команды apt-get и apt-cache понимает. Какие-то опции им 
передавать умеет. Usage message тоже вроде бы имеется, хотя надо бы его 
через gettext (или еще проще - просто из файла отдельного брать). Может 
кому еще пригодится, кроме меня? А может вообще, ее, того, опакетить?..

P.S. Если кто не читал -
http://www.miketaylor.org.uk/tech/wxinmfpl/debian.html

[-- Attachment #2: apt --]
[-- Type: text/plain, Size: 3224 bytes --]

#!/bin/sh

msg_usage()
{
	self=$0
	apt-get -v|head -n1
	cat <<EOF
Usage: $self [options] command
       $self [options] install|remove pkg1 [pkg2 ...]
       $self [options] source pkg1 [pkg2 ...]
       $self [options] add file1 [file2 ...]
       $self [options] showpkg pkg1 [pkg2 ...]
       $self [options] showsrc pkg1 [pkg2 ...]

apt is a unified command line interface tool for all apt utilities,
including apt-get, apt-cache and apt-cdrom. Basically, it understands
all the command these utilities use and redirect them to appropriate
one.

Commands:
   update - Retrieve new lists of packages
   upgrade - Perform an upgrade
   install - Install new packages (pkg is libc6 not libc6.rpm)
   remove - Remove packages
   source - Download source archives
   build-dep - Configure build-dependencies for source packages
   dist-upgrade - Distribution upgrade, see apt-get(8)
   clean - Erase downloaded archive files
   autoclean - Erase old downloaded archive files
   check - Verify that there are no broken dependencies
   add - Add a package file to the source cache
   gencaches - Build both the package and source cache
   showpkg - Show some general information for a single package
   showsrc - Show source records
   stats - Show some basic statistics
   dump - Show the entire file in a terse form
   dumpavail - Print an available file to stdout
   unmet - Show unmet dependencies
   search - Search the package list for a regex pattern
   show - Show a readable record for the package
   depends - Show raw dependency information for a package
   whatdepends - Show raw dependency information on a package
   pkgnames - List the names of all packages
   dotty - Generate package graphs for GraphVis
   policy - Show policy settings

Options:
  -h   This help text.
  -q   Loggable output - no progress indicator
  -qq  No output except for errors
  -d   Download only - do NOT install or unpack archives
  -s   No-act. Perform ordering simulation
  -y   Assume Yes to all queries and do not prompt
  -f   Attempt to continue if the integrity check fails
  -m   Attempt to continue if archives are unlocatable
  -u   Show a list of upgraded packages as well
  -b   Build the source package after fetching it
  -D   When removing packages, remove dependencies as possible
  -p=? The package cache.
  -s=? The source cache.
  -i   Show only important deps for the unmet command.
  -c=? Read this configuration file
  -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp

See the apt-get(8) and apt-cache(8) manual pages for more information.
EOF
}

while getopts ":hq:dsyfmubDip:s:c:o:" option
do
	case $option in
	h)
		msg_usage
		exit 1
		;;
	d | s | y | f | m | u | b | D | i)
		opts="$opts -$option"
		;;
	q | p | s | c | o)
		opts="$opts -$option$OPTARG"
		;;
	h | *)
		msg_usage
		exit 1
	esac
done

shift $(($OPTIND - 1))

cmd=$1
shift
case "$cmd" in
	update | upgrade | install | remove | source | build-dep | dist-upgrade | clean | autoclean | check)
		apt-get $opts $cmd $@
		;;
	add | gencaches | showpkg | showsrc | stats | dump | dumpavail | unmet | search | show | depends | whatdepends | pkgnames | dotty | policy)
		apt-cache $opts $cmd $@
		;;
	*)
		msg_usage
		exit 1
		;;
esac

             reply	other threads:[~2003-10-14  4:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-14  4:15 Mikhail Yakshin [this message]
2003-10-14 17:20 ` Andrey Rahmatullin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F8B7862.6070209@altlinux.ru \
    --to=greycat@altlinux.ru \
    --cc=devel@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git