]>
git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - pkgs/pakfire/src/index
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007, 2008, 2009 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 db_fields
="name version release group maintainer license summary description deps hash"
25 for field
in $db_fields; do
26 if [ -n "${fields}" ]; then
27 fields
="${fields}, '${field}'"
35 if [ -z "${database}" ]; then
36 echo "Database is not defined."
40 sqlite3
${database} "$@"
43 while [ "$#" -gt "0" ]; do
46 database
=${1#--database=}
52 packages
="${packages} ${1}"
55 echo "Unrecognized option: \"${1}\"."
61 if [ -e "${database}" ]; then
62 echo "Database \"${database}\" does already exist."
63 if [ "$FORCE" = "1" ]; then
70 echo "Collecting available packages..."
71 available
=$
(for package
in ${packages}; do
72 echo $
(pkg_name
$package)
75 printf " There are %4d packages available.\n\n" $
(echo "${available}" |
wc -w)
77 echo "Checking dependency tree..."
78 for package
in ${packages}; do
79 #echo " ${package##*/}"
80 for dep
in $
(pkg_deps
${package}); do
82 for avail
in ${available}; do
83 if [ "${dep}" = "${avail}" ]; then
88 if [ "${okay}" != "1" ]; then
89 echo "Dependency \"${dep}\" of \"${package##*/}\" could not be resolved."
90 [ "${FORCE}" = "1" ] ||
exit 1
95 echo "Creating database..."
96 db
"CREATE TABLE packages($fields);"
98 echo "Writing packages to database..."
99 for package
in ${packages}; do
100 echo " ${package##*/}"
103 for field
in $db_fields; do
104 if [ -n "${args}" ]; then
105 args
="${args}, \"$(pkg_$field ${package})\""
107 args
="\"$(pkg_$field ${package})\""
112 db
"INSERT INTO packages VALUES($args);"
115 db
"CREATE TABLE info(key, value);"
116 db
"INSERT INTO info(key, value) VALUES('date', '$(date -u)');"
117 db
"INSERT INTO info(key, value) VALUES('host', '$(cat /proc/sys/kernel/hostname)');"