little tweaks related to new pm api

This commit is contained in:
udeved 2017-06-06 17:58:43 +02:00
parent 9573ffe982
commit 9c8cca5997
8 changed files with 29 additions and 56 deletions

View file

@ -47,18 +47,13 @@ usage() {
exit $1
}
# if [[ -z $1 || $1 = @(-h|--help) ]]; then
# usage
# exit $(( $# ? 0 : 1 ))
# fi
orig_argv=("$0" "$@")
opts=':C:B:U:cdGiM'
while getopts ${opts} arg; do
case "${arg}" in
C) pacman_config=$OPTARG ;;
C) pacman_conf=$OPTARG ;;
B) branch="$OPTARG" ;;
U) mirror="$OPTARG" ;;
d) directory=true ;;
@ -83,7 +78,7 @@ ${hostcache} && pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg")
${interactive} && pacman_args+=(--noconfirm)
[[ -n $pacman_config ]] && pacman_args+=(--config="$pacman_config")
[[ -n $pacman_conf ]] && pacman_args+=(--config="$pacman_conf")
[[ -n ${mirror} ]] && pm_args+=(-U "${mirror}")
@ -108,7 +103,7 @@ if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
die 'Failed to install packages to new root'
fi
set_branch "$newroot" "${branch}"
# set_branch "$newroot" "${branch}"
if ${copykeyring};then
copy_keyring "$newroot"

View file

@ -115,6 +115,8 @@ prepare_build(){
mkchrootpkg_args+=(-r ${work_dir})
prepare_dir "${work_dir}"
eval_build_list "${list_dir_pkg}" "${build_list_pkg}"
init_base_devel

View file

@ -46,7 +46,7 @@ opts='hC:M:c:r:w:f:s'
while getopts ${opts} arg; do
case "${arg}" in
C) pac_conf="$OPTARG" ;;
C) pacman_conf="$OPTARG" ;;
M) makepkg_conf="$OPTARG" ;;
c) cache_dir="$OPTARG" ;;
f) files+=("$OPTARG") ;;
@ -77,7 +77,7 @@ fi
copy_hostconf () {
cp -a /etc/pacman.d/gnupg "$1/etc/pacman.d"
[[ -n $pac_conf ]] && cp $pac_conf "$1/etc/pacman.conf"
[[ -n $pacman_conf ]] && cp $pacman_conf "$1/etc/pacman.conf"
[[ -n $makepkg_conf ]] && cp $makepkg_conf "$1/etc/makepkg.conf"
@ -127,5 +127,3 @@ eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
${nosetarch} && unset CARCH
${CARCH:+setarch "$CARCH"} chroot "${working_dir}" "$@"
# kill_chroot_process "${working_dir}"

View file

@ -47,7 +47,7 @@ opts='hC:M:U:B:c:f:s'
while getopts ${opts} arg; do
case "${arg}" in
C) pac_conf="$OPTARG" ;;
C) pacman_conf="$OPTARG" ;;
M) makepkg_conf="$OPTARG" ;;
B) branch="$OPTARG" ;;
U) mirror="$OPTARG" ;;
@ -75,7 +75,7 @@ else
cache_dirs=(${cache_dir})
fi
basestrap_args=(-GMcd ${pac_conf:+-C "$pac_conf"} -B "${branch}")
basestrap_args=(-GMcd ${pacman_conf:+-C "$pacman_conf"} -B "${branch}")
[[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}")
umask 0022
@ -96,9 +96,9 @@ if is_btrfs "$working_dir"; then
chmod 0755 "$working_dir"
fi
for file in "${files[@]}"; do
mkdir -p "$(dirname "$working_dir$file")"
cp "$file" "$working_dir$file"
for f in "${files[@]}"; do
mkdir -p "$(dirname "$working_dir$f")"
cp "$f" "$working_dir$f"
done
_env=()
@ -112,7 +112,7 @@ echo "$version" > "$working_dir/.manjaro-tools"
set_locale "$working_dir"
chroot_args=(${pac_conf:+-C "$pac_conf"} ${makepkg_conf:+-M "$makepkg_conf"} ${cache_dir:+-c "$cache_dir"})
chroot_args=(${pacman_conf:+-C "$pacman_conf"} ${makepkg_conf:+-M "$makepkg_conf"} ${cache_dir:+-c "$cache_dir"})
${nosetarch} && chroot_args+=(${nosetarch:+-s})
exec chroot-run \

View file

@ -21,7 +21,6 @@ copy_keyring(){
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}
}
@ -53,6 +52,7 @@ set_branch(){
set_locale(){
local mnt="$1"
if [[ ! -f "$mnt/etc/locale.gen.bak" ]] && [[ ! -f "$mnt/etc/locale.conf.bak" ]];then
info "Setting locale ..."
mv "$mnt/etc/locale.gen" "$mnt/etc/locale.gen.bak"
mv "$mnt/etc/locale.conf" "$mnt/etc/locale.conf.bak"
printf '%s.UTF-8 UTF-8\n' en_US > "$mnt/etc/locale.gen"
@ -63,6 +63,7 @@ set_locale(){
reset_locale(){
local mnt="$1"
info "Resetting locale ..."
[[ -f "$mnt/etc/locale.gen.bak" ]] && mv "$mnt/etc/locale.gen.bak" "$mnt/etc/locale.gen"
[[ -f "$mnt/etc/locale.conf.bak" ]] && mv "$mnt/etc/locale.conf.bak" "$mnt/etc/locale.conf"
}

View file

@ -266,13 +266,12 @@ gen_iso_fn(){
echo $name
}
reset_pac_conf(){
local fs="$1"
info "Restoring [%s/etc/pacman.conf] ..." "$fs"
sed -e 's|^.*HoldPkg.*|HoldPkg = pacman glibc manjaro-system|' \
-e "s|^.*#CheckSpace|CheckSpace|" \
-i "$fs/etc/pacman.conf"
}
# reset_pac_conf(){
# local fs="$1"
# info "Restoring [%s/etc/pacman.conf] ..." "$fs"
# -e "s|^.*#CheckSpace|CheckSpace|" \
# -i "$fs/etc/pacman.conf"
# }
copy_overlay(){
local src="$1" dest="$2"
@ -292,11 +291,9 @@ make_image_root() {
create_chroot "${mkchroot_args[@]}" "${rootfs}" "${packages[@]}"
# pacman -Qr "${rootfs}" > "${rootfs}/rootfs-pkgs.txt"
copy_overlay "${root_overlay}" "${rootfs}"
reset_pac_conf "${rootfs}"
# reset_pac_conf "${rootfs}"
configure_lsb "${rootfs}"
@ -317,13 +314,9 @@ make_image_desktop() {
create_chroot "${mkchroot_args[@]}" "${desktopfs}" "${packages[@]}"
# pacman -Qr "${desktopfs}" > "${desktopfs}/desktopfs-pkgs.txt"
# cp "${desktopfs}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
copy_overlay "${desktop_overlay}" "${desktopfs}"
reset_pac_conf "${desktopfs}"
# reset_pac_conf "${desktopfs}"
umount_fs
clean_up_image "${desktopfs}"
@ -343,13 +336,11 @@ make_image_live() {
create_chroot "${mkchroot_args[@]}" "${livefs}" "${packages[@]}"
# pacman -Qr "${livefs}" > "${livefs}/livefs-pkgs.txt"
copy_overlay "${live_overlay}" "${livefs}"
configure_live_image "${livefs}"
reset_pac_conf "${livefs}"
# reset_pac_conf "${livefs}"
umount_fs
@ -368,7 +359,7 @@ make_image_mhwd() {
mount_fs "${mhwdfs}" "${work_dir}" "${desktop_list}"
reset_pac_conf "${mhwdfs}"
# reset_pac_conf "${mhwdfs}"
copy_from_cache "${mhwdfs}" "${packages[@]}"
@ -401,6 +392,8 @@ make_image_boot() {
mount_fs "${bootfs}" "${work_dir}" "${desktop_list}"
pacman -Qr "${bootfs}" > ${iso_dir}/$(gen_iso_fn)-pkgs.txt
prepare_initcpio "${bootfs}"
prepare_initramfs "${bootfs}"

View file

@ -135,9 +135,7 @@ reset_profile(){
unset password
unset addgroups
unset enable_systemd
unset disable_systemd
unset enable_openrc
unset disable_openrc
unset enable_live
unset login_shell
unset netinstall

View file

@ -62,7 +62,7 @@ write_bootloader_conf(){
}
write_servicescfg_conf(){
local conf="${modules_dir}/servicescfg.conf" disable_openrc=()
local conf="${modules_dir}/servicescfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo '---' > "$conf"
echo '' >> "$conf"
@ -72,18 +72,10 @@ write_servicescfg_conf(){
echo " - name: $s" >> "$conf"
echo ' runlevel: default' >> "$conf"
done
if [[ -n ${disable_openrc[@]} ]];then
echo ' disabled:' >> "$conf"
for s in ${disable_openrc[@]};do
echo " - name: $s" >> "$conf"
echo ' runlevel: default' >> "$conf"
echo '' >> "$conf"
done
fi
}
write_services_conf(){
local conf="${modules_dir}/services.conf" disable_systemd=('pacman-init')
local conf="${modules_dir}/services.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo '---' > "$conf"
echo '' >> "$conf"
@ -97,12 +89,6 @@ write_services_conf(){
echo ' - name: "graphical"' >> "$conf"
echo ' mandatory: true' >> "$conf"
echo '' >> "$conf"
echo 'disable:' >> "$conf"
for s in ${disable_systemd[@]};do
echo " - name: $s" >> "$conf"
echo ' mandatory: false' >> "$conf"
echo '' >> "$conf"
done
}
write_displaymanager_conf(){