aboutsummaryrefslogtreecommitdiff
path: root/spec/spec_helper.sh
blob: f62d9f65179b354de3a7f0938250ba2055de5463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# shellcheck shell=sh

pkgnum() {
    i=0
    cd "$CPT_ROOT/var/db/cpt/installed" || { printf '%s\n' 0; return 1 ;}
    for pkg in ./*; do
        [ -d "$pkg" ] || break
        i=$(( i + 1 ))
    done
    printf '%s\n' "$i"
}

getfirstpkg() {
    cd "$CPT_ROOT/var/db/cpt/installed" || return 1
    for pkg in ./*; do
        [ -d "$pkg" ] || return 1
        printf '%s\n' "${pkg##*/}"
        break
    done
}