summaryrefslogtreecommitdiff
path: root/src/xi.sh
blob: afff70f6b47d16dae7a3c1a1b78f10b5ffcca1b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh

[ -z "${LIBDIR}" ] && LIBDIR=/usr/lib/xipkg

export SYSROOT=/
export CONF_FILE="/etc/xipkg.conf"
export VERBOSE=false
export QUIET=false
export RESOLVE_DEPS=true
export DO_SYNC=true
export UNSAFE=false
export NOCONFIRM=false

while getopts ":r:c:qnluyv" opt; do
    case "${opt}" in
        r)
            SYSROOT=$(realpath ${OPTARG})
            ;;
        c)
            CONF_FILE="${OPTARG}"
            ;;
        n)
            RESOLVE_DEPS=false
            ;;
        l)
            DO_SYNC=false
            ;;
        u)
            UNSAFE=true
            ;;
        y)
            NOCONFIRM=true
            ;;
        v)
            VERBOSE=true
            ;;
        q)
            QUIET=true
            ;;
    esac
done

. ${LIBDIR}/profile.sh
. ${LIBDIR}/util.sh
. ${LIBDIR}/validate.sh

. ${LIBDIR}/query.sh
. ${LIBDIR}/sync.sh
. ${LIBDIR}/install.sh
. ${LIBDIR}/get.sh

shift $((OPTIND-1))

if [ "$#" = "0" ]; then
    echo "xilinux running xipkg (palceholder text)"
else 
    case "$1" in
        "sync")
            sync
            ;;
        "install" | "update")
            shift
            install $@
            ;;
        "search")
            shift
            search $@
            ;;
        "files")
            shift
            files $@
            ;;
        "file")
            shift
            file $@
            ;;
        *)
            $DO_SYNC && sync
            fetch $@
            ;;
    esac
fi
printf "${RESET}"