Commit 332c7815 authored by udeved's avatar udeved

clean up old code

parent 7c1c9f45
......@@ -31,7 +31,6 @@ branch=stable
usage() {
echo "usage: ${0##*/} [options] root [packages...]"
echo " -C <config> Use an alternate config file for pacman"
echo " -S <config> Use an alternate config file for pacman-mirrors"
echo " -B <branch> Use an alternate branch"
echo ' -U <url> Use a specific mirror'
echo " -c Use the package cache on the host, rather than the target"
......@@ -60,14 +59,13 @@ opts=':C:B:U:cdGiM'
while getopts ${opts} arg; do
case "${arg}" in
C) pacman_config=$OPTARG ;;
# S) mirrors_conf="$OPTARG" ;;
B) branch="$OPTARG" ;;
U) mirror="$OPTARG" ;;
d) directory=true ;;
c) hostcache=true ;;
i) interactive=true ;;
G) copykeyring=false ;;
M) copymirrorlist=false ;;
B) branch="$OPTARG" ;;
U) mirror="$OPTARG" ;;
:) echo "invalid argument ${arg}:$OPTARG"; usage 1;;
?) usage 0 ;;
esac
......@@ -79,6 +77,7 @@ check_root
(( $# )) || die "No root directory specified"
newroot=$1; shift
pacman_args=("${@:-base}")
pm_args=(-a -p "$newroot" -S "${branch}")
${hostcache} && pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg")
......@@ -86,33 +85,26 @@ ${interactive} && pacman_args+=(--noconfirm)
[[ -n $pacman_config ]] && pacman_args+=(--config="$pacman_config")
[[ -n ${mirror} ]] && pm_args+=(-U "${mirror}")
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
if ! mountpoint -q "$newroot" && ! ${directory}; then
die '%s is not a mountpoint!' "$newroot"
fi
mv "$working_dir/etc/locale.gen" "$working_dir/etc/locale.gen.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 'LANG=%s.UTF-8\n' en_US > "$working_dir/etc/locale.conf"
printf 'LC_MESSAGES=C\n' >> "$working_dir/etc/locale.conf"
pm_args=(-a -p "$newroot" -S "${branch}")
[[ -n ${mirror} ]] && pm_args+=(-U "${mirror}")
mv "$newroot/etc/locale.gen" "$newroot/etc/locale.gen.bak"
mv "$newroot/etc/locale.conf" "$newroot/etc/locale.conf.bak"
printf '%s.UTF-8 UTF-8\n' en_US > "$newroot/etc/locale.gen"
printf 'LANG=%s.UTF-8\n' en_US > "$newroot/etc/locale.conf"
printf 'LC_MESSAGES=C\n' >> "$newroot/etc/locale.conf"
# create obligatory directories
create_min_fs "$newroot"
# if [[ -n $mirrors_conf ]]; then
# if [[ ! -e $newroot/etc/pacman-mirrors.conf ]]; then
prepare_pac_mirrors "$newroot"
info "Configuring pacman-mirrors: %s" "${branch}"
pacman-mirrors "${pm_args[@]}"
# fi
# rm $newroot/usr/share/pacman-mirrors/mirrors.json
# fi
if [[ ! -e $newroot/etc/pacman-mirrors.conf ]]; then
pacman-mirrors "${pm_args[@]}"
fi
# mount API filesystems
chroot_api_mount "$newroot" || die "failed to setup API filesystems in new root"
......
......@@ -41,8 +41,6 @@ prepare_build(){
pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
fi
# local mirrors_conf=${DATADIR}/pacman-mirrors.conf
iso_file=$(gen_iso_fn).iso
mkchroot_args+=(-C ${pacman_conf} -U "${build_mirror}/" -B "${target_branch}")
......
......@@ -111,8 +111,6 @@ prepare_build(){
[[ "$pac_arch" == 'multilib' ]] && target_arch='x86_64'
# local mirrors_conf=${DATADIR}/pacman-mirrors.conf
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -U "${build_mirror}/" -B "${target_branch}")
mkchrootpkg_args+=(-r ${work_dir})
......
......@@ -30,7 +30,6 @@ usage() {
echo ' options:'
echo ' -C <file> Location of a pacman config file'
echo ' -M <file> Location of a makepkg config file'
echo ' -S <file> Location of a pacman-mirrors config file'
echo ' -c <dir> Set pacman cache'
echo ' -f <file> Copy file from the host to the chroot'
echo ' -s Do not run setarch'
......@@ -43,13 +42,12 @@ usage() {
orig_argv=("$0" "$@")
opts='hC:M:S:c:r:w:f:s'
opts='hC:M:c:r:w:f:s'
while getopts ${opts} arg; do
case "${arg}" in
C) pac_conf="$OPTARG" ;;
M) makepkg_conf="$OPTARG" ;;
S) mirrors_conf="$OPTARG" ;;
c) cache_dir="$OPTARG" ;;
f) files+=("$OPTARG") ;;
s) nosetarch=true ;;
......
......@@ -32,7 +32,6 @@ usage() {
echo ' options:'
echo ' -C <file> Location of a pacman config file'
echo ' -M <file> Location of a makepkg config file'
echo ' -S <file> Location of a pacman-mirrors config file'
echo ' -B <branch> Set branch'
echo ' -U <url> Set a specific mirror'
echo ' -c <dir> Set pacman cache'
......@@ -50,12 +49,11 @@ while getopts ${opts} arg; do
case "${arg}" in
C) pac_conf="$OPTARG" ;;
M) makepkg_conf="$OPTARG" ;;
# S) mirrors_conf="$OPTARG" ;;
B) branch="$OPTARG" ;;
U) mirror="$OPTARG" ;;
c) cache_dir="$OPTARG" ;;
f) files+=("$OPTARG") ;;
s) nosetarch=true ;;
B) branch="$OPTARG" ;;
U) mirror="$OPTARG" ;;
h|?) usage ;;
*) error "invalid argument '%s'" "$arg"; usage ;;
esac
......
......@@ -18,16 +18,10 @@ copy_keyring(){
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(){
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/etc/pacman.d $1/var/lib/pacman-mirrors $1/usr/share/pacman-mirrors
mkdir -m 1777 -p $1/tmp
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