Skip to content
seblu-list 1.68 KiB
Newer Older
Seblu's avatar
Seblu committed
#!/bin/bash

# Copyright © Sébastien Luttringer
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

shopt -s xpg_echo

db='seblu.db.tar.gz'
Seblu's avatar
Seblu committed
repo='/srv/ftp/archlinux/seblu'
Seblu's avatar
Seblu committed

# source makepkg config
. /etc/makepkg.conf

cleanup() {
	[[ -e $arch32_file ]] && rm -f "$arch32_file"
	[[ -e $arch64_file ]] && rm -f "$arch64_file"
}

# remove temp file on exit
trap cleanup 0

# create temporary files for computes diff
arch32_file=$(mktemp -t ${0##*/}.XXXXX)
arch64_file=$(mktemp -t ${0##*/}.XXXXX)

# get pkg list from db
bsdtar -xOf "$repo/i686/$db" | awk '/^%NAME%/{getline;print}'|sort > "$arch32_file"
bsdtar -xOf "$repo/x86_64/$db" | awk '/^%NAME%/{getline;print}'|sort > "$arch64_file"

# list pkg in both arch
echo "\e[1;32m:: Package in both arch\e[0m"
comm -12 "$arch32_file" "$arch64_file"

# list pkg in arch i686
echo "\e[1;32m:: Package only in i686 arch\e[0m"
comm -23 "$arch32_file" "$arch64_file"

# list pkg in arch x86_64
echo "\e[1;32m:: Package only in x86_64 arch\e[0m"
comm -13 "$arch32_file" "$arch64_file"

exit 0

# vim:set ts=2 sw=2 ft=sh noet: