Commit ea0df5a9 authored by udeved's avatar udeved

mkchroot, basestrap: fixes, still to solve the mirrors.json issue

parent c3495083
...@@ -31,7 +31,7 @@ branch=stable ...@@ -31,7 +31,7 @@ branch=stable
usage() { usage() {
echo "usage: ${0##*/} [options] root [packages...]" echo "usage: ${0##*/} [options] root [packages...]"
echo " -C <config> Use an alternate config file for pacman" echo " -C <config> Use an alternate config file for pacman"
echo " -P <config> Use an alternate config file for pacman-mirrors" echo " -S <config> Use an alternate config file for pacman-mirrors"
echo " -B <branch> Use an alternate branch" echo " -B <branch> Use an alternate branch"
echo ' -U <url> Use a specific mirror' echo ' -U <url> Use a specific mirror'
echo " -c Use the package cache on the host, rather than the target" echo " -c Use the package cache on the host, rather than the target"
...@@ -55,12 +55,12 @@ usage() { ...@@ -55,12 +55,12 @@ usage() {
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts=':C:P:cdGiM:B:U' opts=':C:S: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 ;;
P) 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 ;;
...@@ -85,7 +85,6 @@ ${hostcache} && pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg") ...@@ -85,7 +85,6 @@ ${hostcache} && pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg")
${interactive} && pacman_args+=(--noconfirm) ${interactive} && pacman_args+=(--noconfirm)
[[ -n $pacman_config ]] && pacman_args+=(--config="$pacman_config") [[ -n $pacman_config ]] && pacman_args+=(--config="$pacman_config")
[[ -n $mirrors_conf ]] && cp ${mirrors_conf} "$newroot/etc/pacman-mirrors.conf"
[[ -d $newroot ]] || die "%s is not a directory" "$newroot" [[ -d $newroot ]] || die "%s is not a directory" "$newroot"
...@@ -93,20 +92,24 @@ if ! mountpoint -q "$newroot" && ! ${directory}; then ...@@ -93,20 +92,24 @@ if ! mountpoint -q "$newroot" && ! ${directory}; then
die '%s is not a mountpoint!' "$newroot" die '%s is not a mountpoint!' "$newroot"
fi fi
mv "$working_dir/etc/locale.gen" "$working_dir/etc/locale.gen.bak" mv "$working_dir/etc/locale.gen" "$working_dir/etc/locale.gen.bak"
mv "$working_dir/etc/locale.conf" "$working_dir/etc/locale.conf.bak" mv "$working_dir/etc/locale.conf" "$working_dir/etc/locale.conf.bak"
printf '%s.UTF-8 UTF-8\n' en_US > "$working_dir/etc/locale.gen" 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 -p "$newroot" -S "${branch}" -R) pm_args=(-a -R -p "$newroot" -S "${branch}")
[[ -n ${mirror} ]] && pm_args+=(-U "${mirror}" -n) [[ -n ${mirror} ]] && pm_args+=(-n -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
cp ${mirrors_conf} "$newroot/etc/pacman-mirrors.conf"
fi
info "Configuring pacman-mirrors: %s" "${branch}" info "Configuring pacman-mirrors: %s" "${branch}"
pacman-mirrors "${pm_args[@]}" pacman-mirrors "${pm_args[@]}"
...@@ -125,4 +128,3 @@ fi ...@@ -125,4 +128,3 @@ fi
if ${copymirrorlist};then if ${copymirrorlist};then
copy_mirrorlist "$newroot" copy_mirrorlist "$newroot"
fi fi
...@@ -45,7 +45,7 @@ prepare_build(){ ...@@ -45,7 +45,7 @@ prepare_build(){
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} -S ${mirrors_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}"
...@@ -141,7 +141,7 @@ iso_only=false ...@@ -141,7 +141,7 @@ iso_only=false
verbose=false verbose=false
persist=false persist=false
mkchroot_args=(-L) mkchroot_args=()
usage() { usage() {
echo "Usage: ${0##*/} [options]" echo "Usage: ${0##*/} [options]"
......
...@@ -89,7 +89,7 @@ sign=false ...@@ -89,7 +89,7 @@ sign=false
udev_root=false udev_root=false
is_multilib=false is_multilib=false
mkchroot_args=(-L) mkchroot_args=()
mkchrootpkg_args=() mkchrootpkg_args=()
install_pkgs=() install_pkgs=()
...@@ -113,7 +113,7 @@ prepare_build(){ ...@@ -113,7 +113,7 @@ prepare_build(){
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} -S ${mirrors_conf} -U "${build_mirror}/" -B "${target_branch}")
mkchrootpkg_args+=(-r ${work_dir}) mkchrootpkg_args+=(-r ${work_dir})
......
...@@ -44,7 +44,7 @@ usage() { ...@@ -44,7 +44,7 @@ usage() {
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts='hC:M:S:c:f:s:U:B' opts='hC:M:S:U:B:c:f:s'
while getopts ${opts} arg; do while getopts ${opts} arg; do
case "${arg}" in case "${arg}" in
...@@ -100,7 +100,7 @@ for file in "${files[@]}"; do ...@@ -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"} ${cache_dirs[@]/#/--cachedir=} -B ${branch:+-"$branch"} ${mirrors_conf:+-P "$mirrors_conf"}) basestrap_args=(-GMcd ${pac_conf:+-C "$pac_conf"} -B "${branch}" -S "$mirrors_conf")
[[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}") [[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}")
...@@ -109,8 +109,7 @@ while read -r varname; do ...@@ -109,8 +109,7 @@ while read -r varname; do
_env+=("$varname=${!varname}") _env+=("$varname=${!varname}")
done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$') done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$')
env -i "${_env[@]}" \ env -i "${_env[@]}" \
basestrap "${basestrap_args[@]}" "$working_dir" ${cache_dirs[@]/#/--cachedir=} "$@" || die 'Failed to install all packages'
basestrap "${basestrap_args[@]}" "$working_dir" "$@" || die 'Failed to install all packages'
echo "$version" > "$working_dir/.manjaro-tools" echo "$version" > "$working_dir/.manjaro-tools"
...@@ -120,4 +119,3 @@ ${nosetarch} && chroot_args+=(${nosetarch:+-s}) ...@@ -120,4 +119,3 @@ ${nosetarch} && chroot_args+=(${nosetarch:+-s})
exec chroot-run \ exec chroot-run \
${chroot_args[*]} \ ${chroot_args[*]} \
"$working_dir" locale-gen "$working_dir" locale-gen
...@@ -20,7 +20,7 @@ copy_keyring(){ ...@@ -20,7 +20,7 @@ copy_keyring(){
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} $1/{dev,run,etc} mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/{pacman,log,pacman-mirrors}} $1/{dev,run,etc/pacman.d}
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}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment