integrate I

This commit is contained in:
udeved 2014-10-04 10:54:55 +02:00
parent b54266cc9e
commit 0ce003dfd5
9 changed files with 90 additions and 92 deletions

View file

@ -180,6 +180,8 @@ shopt -s extglob
source @libdir@/functions.sh
newroot=/mnt
#WORKDIR=${newroot}
hostcache=0
copykeyring=1
copymirrorlist=1

View file

@ -254,6 +254,8 @@ pacman_conf="@pkgdatadir@/pacman-${pacman_conf_arch}.conf"
makepkg_conf="@pkgdatadir@/makepkg-${arch}.conf"
chrootdir=${chroots}/${branch}-${arch}
#WORKDIR=${chrootdir}
if ${nosystemd};then
mkmanjaroroot_args+=(-x)

View file

@ -26,8 +26,9 @@ if [[ $arch == 'any' ]]; then
fi
STARTDIR=$(pwd)
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
cd "$TEMPDIR"
#TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
WORKDIR=$(setup_workdir)
cd "$WORKDIR"
for _pkgname in "${pkgname[@]}"; do
pkgfile=${_pkgname}-$(get_full_version $_pkgname)-${CARCH}${PKGEXT}
@ -82,4 +83,4 @@ for _pkgname in "${pkgname[@]}"; do
fi
done
msg "Files saved to $TEMPDIR"
msg "Files saved to $WORKDIR"

View file

@ -13,7 +13,8 @@ IFS="${IFS}:"
libdirs="/lib /usr/lib /usr/local/lib $(cat /etc/ld.so.conf.d/*)"
extras=
TEMPDIR=$(mktemp -d --tmpdir lddd-script.XXXX)
#TEMPDIR=$(mktemp -d --tmpdir lddd-script.XXXX)
WORKDIR=$(setup_workdir)
msg 'Go out and drink some tea, this will take a while :) ...'
# Check ELF binaries in the PATH and specified dir trees.
@ -33,18 +34,18 @@ for tree in $PATH $libdirs $extras; do
# Is an ELF binary.
if (( $(ldd $i 2>/dev/null | grep -c 'not found') != 0 )); then
# Missing lib.
echo "$i:" >> $TEMPDIR/raw.txt
ldd $i 2>/dev/null | grep 'not found' >> $TEMPDIR/raw.txt
echo "$i:" >> $WORKDIR/raw.txt
ldd $i 2>/dev/null | grep 'not found' >> $WORKDIR/raw.txt
fi
fi
done
done
grep '^/' $TEMPDIR/raw.txt | sed -e 's/://g' >> $TEMPDIR/affected-files.txt
grep '^/' $WORKDIR/raw.txt | sed -e 's/://g' >> $WORKDIR/affected-files.txt
# invoke pacman
for i in $(cat $TEMPDIR/affected-files.txt); do
pacman -Qo $i | awk '{print $4,$5}' >> $TEMPDIR/pacman.txt
for i in $(cat $WORKDIR/affected-files.txt); do
pacman -Qo $i | awk '{print $4,$5}' >> $WORKDIR/pacman.txt
done
# clean list
sort -u $TEMPDIR/pacman.txt >> $TEMPDIR/possible-rebuilds.txt
sort -u $WORKDIR/pacman.txt >> $WORKDIR/possible-rebuilds.txt
msg "Files saved to $TEMPDIR"
msg "Files saved to $WORKDIR"

View file

@ -172,6 +172,8 @@ shopt -s extglob
source @libdir@/functions.sh
#WORKDIR=${chrootdir}
usage() {
cat <<EOF
usage: ${0##*/} chroot-dir [command]

View file

@ -77,6 +77,8 @@ fi
working_dir="$(readlink -f ${1})"
shift 1
#WORKDIR=${working_dir}
[[ -z $working_dir ]] && die 'Please specify a working directory.'
if [[ -z $cache_dir ]]; then
@ -161,7 +163,7 @@ chroot_lock () {
# fi
# }
#
# api_fs_mount2() {
# api_fs_mount_build() {
# mount_conditionally "! mountpoint -q '$1'" "$1" "$1" --bind &&
# track_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
# track_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
@ -203,7 +205,9 @@ if [[ -n $RUN ]]; then
chroot_lock
if ${nosystemd};then
api_fs_mount2 "${working_dir}"
api_fs_mount "${working_dir}"
track_mount /etc/resolv.conf "${working_dir}/etc/resolv.conf" --bind
track_mount ${cache_dirs[0]} "${working_dir}/${cache_dirs[0]}" --bind
else
build_mount_args
fi

View file

@ -85,6 +85,7 @@ done
# Canonicalize chrootdir, getting rid of trailing /
chrootdir=$(readlink -e "$passeddir")
#WORKDIR=${chrootdir}
if [[ ${copy:0:1} = / ]]; then
copydir=$copy

View file

@ -1,7 +1,7 @@
# build-set config
# path to sets
# profiledir=/etc/devtools/sets
# profiledir=/etc/manjaro-tools/sets
# default chroot path
# chroots=/srv/manjarobuild

View file

@ -1,8 +1,9 @@
#!/bin/bash
shopt -s extglob
#shopt -s extglob
export LANG=C
# generated from util-linux source: libmount/src/utils.c
declare -A pseudofs_types=([anon_inodefs]=1
[autofs]=1
[bdev]=1
@ -33,7 +34,6 @@ declare -A pseudofs_types=([anon_inodefs]=1
[sysfs]=1
[tmpfs]=1)
# generated from: pkgfile -vbr '/fsck\..+' | awk -F. '{ print $NF }' | sort
declare -A fsck_types=([cramfs]=1
[exfat]=1
[ext2]=1
@ -53,9 +53,6 @@ declare -A fsck_types=([cramfs]=1
# msg2() { out " ->" "$@";}
# die() { error "$@"; exit 1; }
# Avoid any encoding problems
export LANG=C
# check if messages are to be printed using color
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
if [[ -t 2 ]]; then
@ -147,62 +144,49 @@ trap 'trap_exit' EXIT
ignore_error() {
"$@" 2>/dev/null
return 0
"$@" 2>/dev/null
return 0
}
track_mount() {
if [[ -z $CHROOT_ACTIVE_MOUNTS ]]; then
CHROOT_ACTIVE_MOUNTS=()
trap 'chroot_umount' EXIT
fi
if [[ -z $CHROOT_ACTIVE_MOUNTS ]]; then
CHROOT_ACTIVE_MOUNTS=()
trap 'chroot_umount' EXIT
fi
mount "$@" && CHROOT_ACTIVE_MOUNTS=("$2" "${CHROOT_ACTIVE_MOUNTS[@]}")
mount "$@" && CHROOT_ACTIVE_MOUNTS=("$2" "${CHROOT_ACTIVE_MOUNTS[@]}")
}
mount_conditionally() {
local cond=$1; shift
if eval "$cond"; then
track_mount "$@"
fi
local cond=$1; shift
if eval "$cond"; then
track_mount "$@"
fi
}
api_fs_mount() {
mount_conditionally "! mountpoint -q '$1'" "$1" "$1" --bind &&
track_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
track_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
ignore_error mount_conditionally "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
track_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
track_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
track_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
track_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
track_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
}
api_fs_mount2() {
mount_conditionally "! mountpoint -q '$1'" "$1" "$1" --bind &&
track_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
track_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
ignore_error mount_conditionally "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
track_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
track_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
track_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
track_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
track_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
track_mount /etc/resolv.conf "$1/etc/resolv.conf" --bind
track_mount ${cache_dirs[0]} "$1/${cache_dirs[0]}" --bind
}
chroot_umount() {
umount "${CHROOT_ACTIVE_MOUNTS[@]}"
umount "${CHROOT_ACTIVE_MOUNTS[@]}"
}
fstype_is_pseudofs() {
(( pseudofs_types["$1"] ))
(( pseudofs_types["$1"] ))
}
fstype_has_fsck() {
(( fsck_types["$1"] ))
(( fsck_types["$1"] ))
}
# in_array() {
@ -211,6 +195,7 @@ fstype_has_fsck() {
# [[ $1 = "$i" ]] && return
# done
# }
##
# usage : in_array( $needle, $haystack )
# return : 0 - found
@ -226,66 +211,66 @@ in_array() {
}
valid_number_of_base() {
local base=$1 len=${#2} i=
local base=$1 len=${#2} i=
for (( i = 0; i < len; i++ )); do
{ _=$(( $base#${2:i:1} )) || return 1; } 2>/dev/null
done
for (( i = 0; i < len; i++ )); do
{ _=$(( $base#${2:i:1} )) || return 1; } 2>/dev/null
done
return 0
return 0
}
mangle() {
local i= chr= out=
local i= chr= out=
unset {a..f} {A..F}
unset {a..f} {A..F}
for (( i = 0; i < ${#1}; i++ )); do
chr=${1:i:1}
case $chr in
[[:space:]\\])
printf -v chr '%03o' "'$chr"
out+=\\
;;
esac
out+=$chr
done
for (( i = 0; i < ${#1}; i++ )); do
chr=${1:i:1}
case $chr in
[[:space:]\\])
printf -v chr '%03o' "'$chr"
out+=\\
;;
esac
out+=$chr
done
printf '%s' "$out"
printf '%s' "$out"
}
unmangle() {
local i= chr= out= len=$(( ${#1} - 4 ))
local i= chr= out= len=$(( ${#1} - 4 ))
unset {a..f} {A..F}
unset {a..f} {A..F}
for (( i = 0; i < len; i++ )); do
chr=${1:i:1}
case $chr in
\\)
if valid_number_of_base 8 "${1:i+1:3}" ||
valid_number_of_base 16 "${1:i+1:3}"; then
printf -v chr '%b' "${1:i:4}"
(( i += 3 ))
fi
;;
esac
out+=$chr
done
for (( i = 0; i < len; i++ )); do
chr=${1:i:1}
case $chr in
\\)
if valid_number_of_base 8 "${1:i+1:3}" ||
valid_number_of_base 16 "${1:i+1:3}"; then
printf -v chr '%b' "${1:i:4}"
(( i += 3 ))
fi
;;
esac
out+=$chr
done
printf '%s' "$out${1:i}"
printf '%s' "$out${1:i}"
}
dm_name_for_devnode() {
read dm_name <"/sys/class/block/${1#/dev/}/dm/name"
if [[ $dm_name ]]; then
printf '/dev/mapper/%s' "$dm_name"
else
# don't leave the caller hanging, just print the original name
# along with the failure.
print '%s' "$1"
error 'Failed to resolve device mapper name for: %s' "$1"
fi
read dm_name <"/sys/class/block/${1#/dev/}/dm/name"
if [[ $dm_name ]]; then
printf '/dev/mapper/%s' "$dm_name"
else
# don't leave the caller hanging, just print the original name
# along with the failure.
print '%s' "$1"
error 'Failed to resolve device mapper name for: %s' "$1"
fi
}
##