7 for _file in "${@}"; do
8 if [[ -f "${_file}" ]]; then
15 echo "usage ${0} [options]"
17 echo "Outputs the package list of all channels in one file"
19 echo " General options:"
20 echo " -a | --arch Specify the architecture"
21 echo " -o | --out Specify the output dir"
22 echo " -s | --stdout Output to stdout (Ignore -o)"
23 echo " -h | --help This help message"
24 echo " --aur Include aur package to the list"
27 script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && cd .. && pwd )"
28 tools_dir="${script_path}/tools"
30 archs=("x86_64" "i686" "i486")
37 OPTL="arch:,out:,help,stdout,aur"
38 if ! OPT=$(getopt -o ${OPTS} -l ${OPTL} -- "${@}"); then
47 IFS=" " read -ra archs <<< "${2}"
75 if [[ -z "${out_dir}" ]] || [[ "${stdout}" = true ]]; then
83 for _file in "${@}"; do
84 [[ -f "${_file}" ]] && source "${_file}"
89 for arch in "${archs[@]}"; do
90 for channel in $("${tools_dir}/channel.sh" show -a "${arch}" -b -d -k zen -f); do
91 readarray -t modules < <(
92 load_config "${script_path}/default.conf" "${script_path}/custom.conf"
93 load_config "${channel}/config.any" "${channel}/config.${arch}"
94 if [[ -n "${include_extra+SET}" ]]; then
95 if [[ "${include_extra}" = true ]]; then
96 modules=("base" "share" "share-extra" "calamares" "zsh-powerline")
98 modules=("base" "share")
101 printf "%s\n" "${modules[@]}"
104 pkglist_opts=(-a "${arch}" -b -c "${channel}" -k zen -l en --line "${modules[@]}")
106 if [[ "${stdout}" = true ]]; then
107 readarray -O "${#pkglist[@]}" -t pkglist < <("${tools_dir}/pkglist.sh" "${pkglist_opts[@]}")
108 [[ "${include_aur}" = true ]] && readarray -O "${#pkglist[@]}" -t pkglist < <("${tools_dir}/pkglist.sh" --aur "${pkglist_opts[@]}") || true
111 "${tools_dir}/pkglist.sh" -d "${pkglist_opts[@]}"
112 [[ "${include_aur}" = true ]] && "${tools_dir}/pkglist.sh" --aur -d "${pkglist_opts[@]}" || true
113 ) 1> "${out_dir}/$(basename "${channel}").${arch}"
119 if [[ "${stdout}" = true ]]; then
120 readarray -t pkglist < <(printf "%s\n" "${pkglist[@]}" | sort |uniq)
121 printf "%s\n" "${pkglist[@]}"