summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin Anthony <kevin.s.anthony@gmail.com>2012-10-19 22:08:04 (EDT)
committer Kevin Anthony <kevin.s.anthony@gmail.com>2012-10-19 22:08:04 (EDT)
commitb0f526ebd172531a015833d6d4140d6dc77720fa (patch)
tree9729d16d7ab52ee1be1237cc1c392933c397625c /src
parent43de5a1e0030b64adfda15bd9a59961fad834d72 (diff)
Added find_depends
Diffstat (limited to 'src')
-rwxr-xr-xsrc/opkbootstrap.sh51
1 files changed, 45 insertions, 6 deletions
diff --git a/src/opkbootstrap.sh b/src/opkbootstrap.sh
index 3ad3c27..2ea0005 100755
--- a/src/opkbootstrap.sh
+++ b/src/opkbootstrap.sh
@@ -5,6 +5,7 @@
# Main program script.
#
# Copyright (C) 2012 Patrick "P. J." McDermott
+# Copyright (C) 2012 Kevin Anthony <Kevin.S.Anthony@gmail.com>
#
# 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
@@ -43,7 +44,7 @@ main()
print_help
exit
;;
- V)
+ /V)
print_version
exit
;;
@@ -208,8 +209,8 @@ get_dist_src_list()
# find_essential
find_essential()
{
- for _list in "${LISTS_DIR}/"*; do
- _pkg=
+ for _list in ${LISTS_DIR}/*; do
+ _pkg=
_essential=false
while read _line; do
if [ -z "${line}" ]; then
@@ -235,12 +236,49 @@ find_essential()
done
}
-# find_depends
find_depends()
{
- :
+ _pkgs=${PKGS_ALL}
+ for _list in ${LISTS_DIR}/*; do
+ recurs_find_deps "${_pkgs}" ${_list}
+ while [ "$deps" != "${_pkgs}" ]; do
+ _pkgs=$deps
+ recurs_find_deps "${_pkgs}" ${_list}
+ done
+ PKGS_ALL="${PKGS_ALL} ${_pkgs}"
+ PKGS_ALL=$(echo ${PKGS_ALL} | sed 's/ /\n/g' | sort | uniq)
+ done
+}
+
+recurs_find_deps()
+{
+ deps=$(awk -v pkgs="${1}" -v list="${2}" 'BEGIN {
+ deppkg = 0
+ while (getline line < list){
+ if (match(line,"Package:")){
+ split(line,linearr,": ")
+ if (index(pkgs,linearr[2]) != 0){
+ print linearr[2]
+ deppkg++
+ continue
+ }
+ }
+ if (deppkg > 0){
+ if (match(line,"Depends:")){
+ split(line,deps,": ")
+ split(deps[2],dep,",")
+ for (i in dep){
+ split(dep[i],d,r" ")
+ print d[1]
+ }
+ deppkg--
+ }
+ }
+ }
+ };' | sort | uniq)
}
+#check if libcurl exists or wget
# get_pkgs
get_pkgs()
{
@@ -248,11 +286,12 @@ get_pkgs()
}
# unpack_pkgs
+#test this fucntion
unpack_pkgs()
{
cd "${TARGET}"
- for _opk in "${PKGS_DIR}"/*; do
+ for _opk in ${PKGS_DIR}/*; do
_pkg="${opk##*/}"
_pkg="${pkg%%_*}"