|
@ -1,6 +1,6 @@ |
|
|
#!/usr/bin/env bash |
|
|
#!/usr/bin/env bash |
|
|
# |
|
|
# |
|
|
# getsource - Get build files from official Arch Linux repositories and AUR repositories |
|
|
|
|
|
|
|
|
# getsource - Get build files from Arch Linux official, AUR & ARM repositories |
|
|
# |
|
|
# |
|
|
# Copyright (C) 2021 Pekka Helenius <pekka.helenius@fjordtek.com> |
|
|
# Copyright (C) 2021 Pekka Helenius <pekka.helenius@fjordtek.com> |
|
|
# |
|
|
# |
|
@ -16,9 +16,7 @@ |
|
|
# |
|
|
# |
|
|
# You should have received a copy of the GNU General Public License |
|
|
# You should have received a copy of the GNU General Public License |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
|
|
|
|
|
##################################### |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
# TODO: Add support for wider range of processor architectures |
|
|
# TODO: Add support for wider range of processor architectures |
|
|
# TODO: Add directory support (e.g. getsource wine ~/winesource) |
|
|
# TODO: Add directory support (e.g. getsource wine ~/winesource) |
|
|
# TODO: create subdir for source files automatically to the current main dir |
|
|
# TODO: create subdir for source files automatically to the current main dir |
|
@ -61,7 +59,7 @@ ARCHIVEFORMATS=( |
|
|
|
|
|
|
|
|
################################## |
|
|
################################## |
|
|
|
|
|
|
|
|
DBS_TO_CHECK=('arch' 'aur' 'arch_deepscan') |
|
|
|
|
|
|
|
|
DBS_TO_CHECK=('arch' 'aur' 'arm' 'arch_deepscan') |
|
|
|
|
|
|
|
|
ARCH_DATABASES=( |
|
|
ARCH_DATABASES=( |
|
|
'core' |
|
|
'core' |
|
@ -70,6 +68,14 @@ ARCH_DATABASES=( |
|
|
'community-testing' |
|
|
'community-testing' |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
ARM_DATABASES=( |
|
|
|
|
|
'alarm' |
|
|
|
|
|
'aur' |
|
|
|
|
|
'community' |
|
|
|
|
|
'core' |
|
|
|
|
|
'extra' |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
# TODO |
|
|
# TODO |
|
|
# Fetch from pacman.conf |
|
|
# Fetch from pacman.conf |
|
|
CUSTOM_DATABASES=() |
|
|
CUSTOM_DATABASES=() |
|
@ -79,6 +85,10 @@ ARCH_GITBASES=( |
|
|
'archlinux/svntogit-community' |
|
|
'archlinux/svntogit-community' |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
ARM_GITBASES=( |
|
|
|
|
|
'archlinuxarm/PKGBUILDs' |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
################################## |
|
|
################################## |
|
|
|
|
|
|
|
|
function get_url() { |
|
|
function get_url() { |
|
@ -87,6 +97,8 @@ function get_url() { |
|
|
return 1 |
|
|
return 1 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
################################## |
|
|
|
|
|
|
|
|
function fetch_database() { |
|
|
function fetch_database() { |
|
|
|
|
|
|
|
|
case "${1}" in |
|
|
case "${1}" in |
|
@ -119,6 +131,7 @@ function fetch_database() { |
|
|
done |
|
|
done |
|
|
return 1 |
|
|
return 1 |
|
|
;; |
|
|
;; |
|
|
|
|
|
|
|
|
aur) |
|
|
aur) |
|
|
local ISSNAPSHOT |
|
|
local ISSNAPSHOT |
|
|
DOMAINURL="https://aur.archlinux.org" |
|
|
DOMAINURL="https://aur.archlinux.org" |
|
@ -132,9 +145,36 @@ function fetch_database() { |
|
|
fi |
|
|
fi |
|
|
return 1 |
|
|
return 1 |
|
|
;; |
|
|
;; |
|
|
|
|
|
|
|
|
|
|
|
arm) |
|
|
|
|
|
GITBASES=(${ARM_GITBASES[@]}) |
|
|
|
|
|
DATABASES=(${ARM_DATABASES[@]}) |
|
|
|
|
|
DOMAINURL="https://github.com" |
|
|
|
|
|
REPOMSG="Using Arch Linux ARM repositories" |
|
|
|
|
|
|
|
|
|
|
|
for GITBASE in ${GITBASES[@]}; do |
|
|
|
|
|
for DATABASE in ${DATABASES[@]}; do |
|
|
|
|
|
BASEURL="${DOMAINURL}/${GITBASE}/tree/master/${DATABASE}/${PACKAGE}" |
|
|
|
|
|
|
|
|
|
|
|
if get_url "${BASEURL}" "${URLFILE}"; then |
|
|
|
|
|
FILENAMES=() |
|
|
|
|
|
|
|
|
|
|
|
FILEHREFS=( $(grep -oP '(?<=data-pjax).*?(?=\<\/a)' "${URLFILE}" | sed -r "s/.*href=[\"|'](.*)[\"|']>.*/\1/; s/\/blob//g" | grep ${PACKAGE}) ) |
|
|
|
|
|
for i in ${FILEHREFS[@]}; do |
|
|
|
|
|
FILENAMES+=( $(echo "${i}" | sed 's/.*\///g') ) |
|
|
|
|
|
done |
|
|
|
|
|
DOMAINURL="https://raw.githubusercontent.com" |
|
|
|
|
|
download_sourcefiles && return 0 |
|
|
|
|
|
fi |
|
|
|
|
|
done |
|
|
|
|
|
done |
|
|
|
|
|
return 1 |
|
|
|
|
|
;; |
|
|
|
|
|
|
|
|
arch_deepscan) |
|
|
arch_deepscan) |
|
|
arch_repos_deepscan |
|
|
arch_repos_deepscan |
|
|
;; |
|
|
;; |
|
|
|
|
|
|
|
|
esac |
|
|
esac |
|
|
|
|
|
|
|
|
[[ -f "${URLFILE}" ]] || return 1 |
|
|
[[ -f "${URLFILE}" ]] || return 1 |
|
@ -153,12 +193,12 @@ function arch_repos_deepscan() { |
|
|
if [[ -f "${URLFILE}" ]]; then |
|
|
if [[ -f "${URLFILE}" ]]; then |
|
|
msg "$(gettext "Selecting another package name:")" |
|
|
msg "$(gettext "Selecting another package name:")" |
|
|
PACKAGE=$(grep "Source Files" "${URLFILE}" | sed "s/.*href=[\"'].*packages\///g; s/[\"'].*//g") |
|
|
PACKAGE=$(grep "Source Files" "${URLFILE}" | sed "s/.*href=[\"'].*packages\///g; s/[\"'].*//g") |
|
|
warning "$(gettext "Package name is %s.")" "$PACKAGE" |
|
|
|
|
|
|
|
|
warning "$(gettext "Package name is %s")" "${PACKAGE}" |
|
|
rm -rf "${URLFILE}" |
|
|
rm -rf "${URLFILE}" |
|
|
fetch_database arch ${ARCH_GITBASES[@]} |
|
|
fetch_database arch ${ARCH_GITBASES[@]} |
|
|
download_sourcefiles |
|
|
download_sourcefiles |
|
|
else |
|
|
else |
|
|
error "$(gettext "Couldn't find package %s.")" "$PACKAGE" |
|
|
|
|
|
|
|
|
error "$(gettext "Couldn't find package %s")" "${PACKAGE}" |
|
|
exit 1 |
|
|
exit 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
@ -192,7 +232,7 @@ function download_sourcefiles() { |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if [[ $? -eq 0 ]]; then |
|
|
if [[ $? -eq 0 ]]; then |
|
|
msg "$(gettext "Source files for %s downloaded".)" "$PACKAGE" |
|
|
|
|
|
|
|
|
msg "$(gettext "Source files for %s downloaded")" "${PACKAGE}" |
|
|
return 0 |
|
|
return 0 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|