Merge branch 'devel' of github.com:manjaro/manjaro-tools

This commit is contained in:
udeved 2016-03-04 00:06:08 +01:00
commit 56b4672f16
3 changed files with 51 additions and 25 deletions

View file

@ -35,12 +35,17 @@ set_mkinicpio_hooks(){
fi fi
} }
set_silent_switch_root(){
sed -e 's|"$@"|"$@" >/dev/null 2>&1|' -i $1/usr/lib/initcpio/init
}
copy_initcpio(){ copy_initcpio(){
msg2 "Copying initcpio ..." msg2 "Copying initcpio ..."
cp /usr/lib/initcpio/hooks/miso* $2/usr/lib/initcpio/hooks cp /usr/lib/initcpio/hooks/miso* $2/usr/lib/initcpio/hooks
cp /usr/lib/initcpio/install/miso* $2/usr/lib/initcpio/install cp /usr/lib/initcpio/install/miso* $2/usr/lib/initcpio/install
cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf
set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf" set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf"
set_silent_switch_root "$2"
} }
# $1: work_dir # $1: work_dir

View file

@ -444,26 +444,50 @@ chroot_create(){
mkchroot ${mkchroot_args[*]} ${flag} $@ mkchroot ${mkchroot_args[*]} ${flag} $@
} }
# $1: image path
clean_up_image(){ clean_up_image(){
msg2 "Cleaning up [%s]" "${1##*/}" msg2 "Cleaning [%s]" "${1##*/}"
[[ -d "$1/boot/" ]] && find "$1/boot" -name 'initramfs*.img' -delete #&> /dev/null
[[ -f "$1/etc/locale.gen.bak" ]] && mv "$1/etc/locale.gen.bak" "$1/etc/locale.gen"
[[ -f "$1/etc/locale.conf.bak" ]] && mv "$1/etc/locale.conf.bak" "$1/etc/locale.conf"
find "$1/var/lib/pacman" -maxdepth 1 -type f -delete #&> /dev/null local path
find "$1/var/lib/pacman/sync" -type f -delete #&> /dev/null if [[ ${1##*/} == 'mhwd-image' ]];then
#find "$1/var/cache/pacman/pkg" -type f -delete &> /dev/null path=$1/var
find "$1/var/log" -type f -delete #&> /dev/null if [[ -d $path ]];then
#find "$1/var/tmp" -mindepth 1 -delete &> /dev/null find "$path" -mindepth 0 -delete &> /dev/null
#find "$1/tmp" -mindepth 1 -delete &> /dev/null fi
path=$1/etc
if [[ -d $path ]];then
find "$path" -mindepth 0 -delete &> /dev/null
fi
rm -f "$1/cache-packages.txt"
else
[[ -f "$1/etc/locale.gen.bak" ]] && \
mv "$1/etc/locale.gen.bak" "$1/etc/locale.gen"
[[ -f "$1/etc/locale.conf.bak" ]] && \
mv "$1/etc/locale.conf.bak" "$1/etc/locale.conf"
path=$1/boot
if [[ -d "$path" ]]; then
find "$path" -name 'initramfs*.img' -delete &> /dev/null
fi
path=$1/var/lib/pacman/sync
if [[ -d $path ]];then
find "$path" -type f -delete &> /dev/null
fi
path=$1/var/cache/pacman/pkg
if [[ -d $path ]]; then
find "$path" -type f -delete &> /dev/null
fi
path=$1/var/log
if [[ -d $path ]]; then
find "$path" -type f -delete &> /dev/null
fi
path=$1/var/tmp
if [[ -d $path ]];then
find "$path" -mindepth 1 -delete &> /dev/null
fi
path=$1/tmp
if [[ -d $path ]];then
find "$path" -mindepth 1 -delete &> /dev/null
fi
fi
# find "${work_dir}" -name *.pacnew -name *.pacsave -name *.pacorig -delete # find "${work_dir}" -name *.pacnew -name *.pacsave -name *.pacorig -delete
} }
clean_up_mhwd_image(){
msg2 "Cleaning up [%s]" "${1##*/}"
rm -r $1/var
rm -rf "$1/etc"
rm -f "$1/cache-packages.txt"
}

View file

@ -161,9 +161,9 @@ make_iso() {
touch "${work_dir}/iso/.miso" touch "${work_dir}/iso/.miso"
for d in $(find "${work_dir}" -maxdepth 1 -type d -name '[^.]*'); do for d in $(find "${work_dir}" -maxdepth 1 -type d -name '[^.]*'); do
if [[ "$d" != "${work_dir}/iso" ]] && \ if [[ "$d" != "${work_dir}/iso" ]] && \
[[ "${d##*/}" != "iso" ]] && \ [[ "${d##*/}" != "iso" ]] && \
[[ "${d##*/}" != "efiboot" ]] && \ [[ "${d##*/}" != "efiboot" ]] && \
[[ "$d" != "${work_dir}" ]]; then [[ "$d" != "${work_dir}" ]]; then
make_sqfs "$d" make_sqfs "$d"
fi fi
done done
@ -240,7 +240,6 @@ make_image_custom() {
${is_custom_pac_conf} && clean_pacman_conf "${path}" ${is_custom_pac_conf} && clean_pacman_conf "${path}"
umount_image umount_image
clean_up_image "${path}" clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME} : > ${work_dir}/build.${FUNCNAME}
msg "Done [Desktop installation] (%s-image)" "${profile}" msg "Done [Desktop installation] (%s-image)" "${profile}"
@ -304,9 +303,7 @@ make_image_mhwd() {
configure_mhwd_drivers "${path}" configure_mhwd_drivers "${path}"
umount_image umount_image
clean_up_image "${path}"
clean_up_mhwd_image "${path}"
: > ${work_dir}/build.${FUNCNAME} : > ${work_dir}/build.${FUNCNAME}
msg "Done [drivers repository] (mhwd-image)" msg "Done [drivers repository] (mhwd-image)"
fi fi