forked from mirrored-repos/manjaro-tools
basestrap: adopt latest pacman-mirrors channges
This commit is contained in:
parent
ea0df5a966
commit
8b5c1bc3ff
7 changed files with 28 additions and 57 deletions
3
Makefile
3
Makefile
|
@ -23,8 +23,7 @@ LIBS_BASE = \
|
||||||
|
|
||||||
SHARED_BASE = \
|
SHARED_BASE = \
|
||||||
data/pacman-default.conf \
|
data/pacman-default.conf \
|
||||||
data/pacman-multilib.conf \
|
data/pacman-multilib.conf
|
||||||
data/pacman-mirrors.conf
|
|
||||||
|
|
||||||
LIST_PKG = \
|
LIST_PKG = \
|
||||||
$(wildcard data/pkg.list.d/*.list)
|
$(wildcard data/pkg.list.d/*.list)
|
||||||
|
|
|
@ -55,12 +55,12 @@ usage() {
|
||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts=':C:S:B:U:cdGiM'
|
opts=':C:B:U:cdGiM'
|
||||||
|
|
||||||
while getopts ${opts} arg; do
|
while getopts ${opts} arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
C) pacman_config=$OPTARG ;;
|
C) pacman_config=$OPTARG ;;
|
||||||
S) mirrors_conf="$OPTARG" ;;
|
# S) mirrors_conf="$OPTARG" ;;
|
||||||
d) directory=true ;;
|
d) directory=true ;;
|
||||||
c) hostcache=true ;;
|
c) hostcache=true ;;
|
||||||
i) interactive=true ;;
|
i) interactive=true ;;
|
||||||
|
@ -98,20 +98,21 @@ printf '%s.UTF-8 UTF-8\n' en_US > "$working_dir/etc/locale.gen"
|
||||||
printf 'LANG=%s.UTF-8\n' en_US > "$working_dir/etc/locale.conf"
|
printf 'LANG=%s.UTF-8\n' en_US > "$working_dir/etc/locale.conf"
|
||||||
printf 'LC_MESSAGES=C\n' >> "$working_dir/etc/locale.conf"
|
printf 'LC_MESSAGES=C\n' >> "$working_dir/etc/locale.conf"
|
||||||
|
|
||||||
pm_args=(-a -R -p "$newroot" -S "${branch}")
|
pm_args=(-a -p "$newroot" -S "${branch}")
|
||||||
|
|
||||||
[[ -n ${mirror} ]] && pm_args+=(-n -U "${mirror}")
|
[[ -n ${mirror} ]] && pm_args+=(-U "${mirror}")
|
||||||
|
|
||||||
info "pm_args: %s" "${pm_args[*]}"
|
|
||||||
# create obligatory directories
|
# create obligatory directories
|
||||||
create_min_fs "$newroot"
|
create_min_fs "$newroot"
|
||||||
|
|
||||||
if [[ -n $mirrors_conf ]]; then
|
# if [[ -n $mirrors_conf ]]; then
|
||||||
cp ${mirrors_conf} "$newroot/etc/pacman-mirrors.conf"
|
# if [[ ! -e $newroot/etc/pacman-mirrors.conf ]]; then
|
||||||
fi
|
prepare_pac_mirrors "$newroot"
|
||||||
|
|
||||||
info "Configuring pacman-mirrors: %s" "${branch}"
|
info "Configuring pacman-mirrors: %s" "${branch}"
|
||||||
pacman-mirrors "${pm_args[@]}"
|
pacman-mirrors "${pm_args[@]}"
|
||||||
|
# fi
|
||||||
|
# rm $newroot/usr/share/pacman-mirrors/mirrors.json
|
||||||
|
# fi
|
||||||
|
|
||||||
# mount API filesystems
|
# mount API filesystems
|
||||||
chroot_api_mount "$newroot" || die "failed to setup API filesystems in new root"
|
chroot_api_mount "$newroot" || die "failed to setup API filesystems in new root"
|
||||||
|
|
|
@ -41,11 +41,11 @@ prepare_build(){
|
||||||
pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
|
pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local mirrors_conf=${DATADIR}/pacman-mirrors.conf
|
# local mirrors_conf=${DATADIR}/pacman-mirrors.conf
|
||||||
|
|
||||||
iso_file=$(gen_iso_fn).iso
|
iso_file=$(gen_iso_fn).iso
|
||||||
|
|
||||||
mkchroot_args+=(-C ${pacman_conf} -S ${mirrors_conf} -U "${build_mirror}/" -B "${target_branch}")
|
mkchroot_args+=(-C ${pacman_conf} -U "${build_mirror}/" -B "${target_branch}")
|
||||||
work_dir=${chroots_iso}/${profile}/${target_arch}
|
work_dir=${chroots_iso}/${profile}/${target_arch}
|
||||||
|
|
||||||
iso_dir="${cache_dir_iso}/${edition}/${profile}/${dist_release}"
|
iso_dir="${cache_dir_iso}/${edition}/${profile}/${dist_release}"
|
||||||
|
|
|
@ -111,9 +111,9 @@ prepare_build(){
|
||||||
|
|
||||||
[[ "$pac_arch" == 'multilib' ]] && target_arch='x86_64'
|
[[ "$pac_arch" == 'multilib' ]] && target_arch='x86_64'
|
||||||
|
|
||||||
local mirrors_conf=${DATADIR}/pacman-mirrors.conf
|
# local mirrors_conf=${DATADIR}/pacman-mirrors.conf
|
||||||
|
|
||||||
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -U "${build_mirror}/" -B "${target_branch}")
|
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -U "${build_mirror}/" -B "${target_branch}")
|
||||||
|
|
||||||
mkchrootpkg_args+=(-r ${work_dir})
|
mkchrootpkg_args+=(-r ${work_dir})
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,13 @@ usage() {
|
||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='hC:M:S:U:B:c:f:s'
|
opts='hC:M:U:B:c:f:s'
|
||||||
|
|
||||||
while getopts ${opts} arg; do
|
while getopts ${opts} arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
C) pac_conf="$OPTARG" ;;
|
C) pac_conf="$OPTARG" ;;
|
||||||
M) makepkg_conf="$OPTARG" ;;
|
M) makepkg_conf="$OPTARG" ;;
|
||||||
S) mirrors_conf="$OPTARG" ;;
|
# S) mirrors_conf="$OPTARG" ;;
|
||||||
c) cache_dir="$OPTARG" ;;
|
c) cache_dir="$OPTARG" ;;
|
||||||
f) files+=("$OPTARG") ;;
|
f) files+=("$OPTARG") ;;
|
||||||
s) nosetarch=true ;;
|
s) nosetarch=true ;;
|
||||||
|
@ -100,7 +100,7 @@ for file in "${files[@]}"; do
|
||||||
cp "$file" "$working_dir$file"
|
cp "$file" "$working_dir$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
basestrap_args=(-GMcd ${pac_conf:+-C "$pac_conf"} -B "${branch}" -S "$mirrors_conf")
|
basestrap_args=(-GMcd ${pac_conf:+-C "$pac_conf"} -B "${branch}")
|
||||||
|
|
||||||
[[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}")
|
[[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}")
|
||||||
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
##
|
|
||||||
## /etc/pacman-mirrors.conf
|
|
||||||
##
|
|
||||||
|
|
||||||
## Branch Pacman should use (stable, testing, unstable)
|
|
||||||
Branch = stable
|
|
||||||
|
|
||||||
## Generation method
|
|
||||||
## 1) rank - rank mirrors depending on their access time
|
|
||||||
## 2) random - randomly generate the output mirrorlist
|
|
||||||
# Method = rank
|
|
||||||
|
|
||||||
## Define protocols and priority
|
|
||||||
## separated by comma 'https,http' or 'http,https'
|
|
||||||
## ATM available protocols are: http, https, ftp
|
|
||||||
## Not specifying a protocol will ban the protocol from being used
|
|
||||||
## If a mirror has more than one protocol defined only the first is written to the mirrorlist
|
|
||||||
## Empty means all in reversed alphabetic order
|
|
||||||
# Protocols =
|
|
||||||
|
|
||||||
## Specify to use only mirrors from a specific country.
|
|
||||||
## Can add multiple countries
|
|
||||||
## separated by comma 'Germany,France,Belgium'
|
|
||||||
## Get a list of all available counties with 'pacman-mirrors -l'
|
|
||||||
## Empty means all
|
|
||||||
# OnlyCountry =
|
|
||||||
|
|
||||||
## Mirrors directory
|
|
||||||
# MirrorlistsDir = /var/lib/pacman-mirrors
|
|
||||||
|
|
||||||
## Output file
|
|
||||||
# OutputMirrorlist = /etc/pacman.d/mirrorlist
|
|
||||||
|
|
||||||
## When set to False - all certificates are accepted.
|
|
||||||
## Use only if you fully trust all ssl-enabled mirrors.
|
|
||||||
# SSLVerify = True
|
|
|
@ -18,9 +18,16 @@ copy_keyring(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepare_pac_mirrors(){
|
||||||
|
mkdir -m 0755 -p $1/etc/pacman.d $1/var/lib/pacman-mirrors $1/usr/share/pacman-mirrors
|
||||||
|
# curl https://raw.githubusercontent.com/manjaro/pacman-mirrors/master/share/mirrors.json -o $1/usr/share/pacman-mirrors/mirrors.json
|
||||||
|
#curl https://raw.githubusercontent.com/manjaro/pacman-mirrors/master/conf/pacman-mirrors.conf -o $1/etc/pacman-mirrors.conf
|
||||||
|
# cp ${DATADIR}/pacman-mirrors.conf $1/etc
|
||||||
|
}
|
||||||
|
|
||||||
create_min_fs(){
|
create_min_fs(){
|
||||||
msg "Creating install root at %s" "$1"
|
msg "Creating install root at %s" "$1"
|
||||||
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/{pacman,log,pacman-mirrors}} $1/{dev,run,etc/pacman.d}
|
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,run,etc}
|
||||||
mkdir -m 1777 -p $1/tmp
|
mkdir -m 1777 -p $1/tmp
|
||||||
mkdir -m 0555 -p $1/{sys,proc}
|
mkdir -m 0555 -p $1/{sys,proc}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue