diff --git a/functions.sh b/functions.sh index 058f5a60..8c892700 100644 --- a/functions.sh +++ b/functions.sh @@ -378,17 +378,30 @@ function apt-get.update(){ cat Packages.gz | gunzip -c | grep -E "^Package:|^Filename:|^Depends:|^Version:" >> cache.txt || true + echo APT_GET_UPDATE while read line; do local line=$(echo "${line}" | sed 's|[[:space:]]| |g') local repo_info=($(echo ${line} | tr " " "\n")) local base_url=${repo_info[1]} local dist_name=${repo_info[2]} - for i in $(seq 3 $((${#repo_info[@]} - 1))); do - echo "Caching ${base_url} ${dist_name} ${repo_info[${i}]}..." - local repo_url="${base_url}/dists/${dist_name}/${repo_info[${i}]}/binary-amd64/Packages.gz" + echo line=${line} + echo repo_info=${repo_info} + echo base_url=${base_url} + echo dist_name=${dist_name} + + # Detect openSUSE Build Service (OBS) repositories, which are listed using a single / at the end (according to pkg2appimage documentation) + if test "${dist_name}" = "/" ; then + echo "Caching ${base_url} ${dist_name}..." + local repo_url="${base_url}/Packages.gz" wget -q "${repo_url}" -O - | gunzip -c | grep -E "^Package:|^Filename:|^Depends:|^Version:" | sed "s|^Filename: |Filename: ${base_url}/|g" >> cache.txt - done + else + for i in $(seq 3 $((${#repo_info[@]} - 1))); do + echo "Caching ${base_url} ${dist_name} ${repo_info[${i}]}..." + local repo_url="${base_url}/dists/${dist_name}/${repo_info[${i}]}/binary-amd64/Packages.gz" + wget -q "${repo_url}" -O - | gunzip -c | grep -E "^Package:|^Filename:|^Depends:|^Version:" | sed "s|^Filename: |Filename: ${base_url}/|g" >> cache.txt + done + fi done