mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-15 10:56:19 +02:00
Compare commits
54 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c22a6014d7 | ||
![]() |
d440e5998d | ||
![]() |
611314a740 | ||
![]() |
c39e59892d | ||
![]() |
f76261f073 | ||
![]() |
a37c07a8cb | ||
![]() |
72a2b4789a | ||
![]() |
30cfcdc501 | ||
![]() |
f09baea392 | ||
![]() |
d68e7cb031 | ||
![]() |
106a0cddfe | ||
![]() |
0e43db65b2 | ||
![]() |
3e3b32641d | ||
![]() |
16dd1fe6e0 | ||
![]() |
f8ab1fb7a7 | ||
![]() |
4ea489ad85 | ||
![]() |
0346db0ff7 | ||
![]() |
a1ede4dd4b | ||
![]() |
7ce9cd6965 | ||
![]() |
a7d88845a8 | ||
![]() |
ea4b0d0a67 | ||
![]() |
0c17e0d9fc | ||
![]() |
6922cc39f0 | ||
![]() |
61e8cd97fb | ||
![]() |
23aa9719a8 | ||
![]() |
40791b305f | ||
![]() |
db962d9b7c | ||
![]() |
4fb916c824 | ||
![]() |
169c33195f | ||
![]() |
86416b25b3 | ||
![]() |
fd82cb3eb7 | ||
![]() |
54ae50500b | ||
![]() |
bb1ab73c74 | ||
![]() |
219ec9f196 | ||
![]() |
14947cf645 | ||
![]() |
381f91c336 | ||
![]() |
fa47bd1a17 | ||
![]() |
8130fd3846 | ||
![]() |
3d9c9c1b46 | ||
![]() |
70e48eff7a | ||
![]() |
e82825dd6d | ||
![]() |
80061e2051 | ||
![]() |
eebe3a49b7 | ||
![]() |
06b02906b8 | ||
![]() |
71a6d2c895 | ||
![]() |
3b383b50fc | ||
![]() |
29b19aaa8b | ||
![]() |
e1b0d23027 | ||
![]() |
a5651376b4 | ||
![]() |
9561089142 | ||
![]() |
92a83232e3 | ||
![]() |
40251235a8 | ||
![]() |
c9d1b3457c | ||
![]() |
0a35566e2b |
6
Makefile
6
Makefile
@@ -9,8 +9,10 @@ install:
|
|||||||
ln -sf commitpkg $(DESTDIR)/usr/bin/corepkg
|
ln -sf commitpkg $(DESTDIR)/usr/bin/corepkg
|
||||||
ln -sf commitpkg $(DESTDIR)/usr/bin/testingpkg
|
ln -sf commitpkg $(DESTDIR)/usr/bin/testingpkg
|
||||||
ln -sf commitpkg $(DESTDIR)/usr/bin/communitypkg
|
ln -sf commitpkg $(DESTDIR)/usr/bin/communitypkg
|
||||||
|
ln -sf commitpkg $(DESTDIR)/usr/bin/community-testingpkg
|
||||||
# arch{co,release,rm}
|
# arch{co,release,rm}
|
||||||
install -m 755 archco $(DESTDIR)/usr/bin
|
install -m 755 archco $(DESTDIR)/usr/bin
|
||||||
|
install -m 755 communityco $(DESTDIR)/usr/bin
|
||||||
install -m 755 archrelease $(DESTDIR)/usr/bin
|
install -m 755 archrelease $(DESTDIR)/usr/bin
|
||||||
install -m 755 archrm $(DESTDIR)/usr/bin
|
install -m 755 archrm $(DESTDIR)/usr/bin
|
||||||
# new chroot tools, only usable by root
|
# new chroot tools, only usable by root
|
||||||
@@ -20,6 +22,7 @@ install:
|
|||||||
#Additional packaging helper scripts
|
#Additional packaging helper scripts
|
||||||
install -m 755 lddd $(DESTDIR)/usr/bin
|
install -m 755 lddd $(DESTDIR)/usr/bin
|
||||||
install -m 755 finddeps $(DESTDIR)/usr/bin
|
install -m 755 finddeps $(DESTDIR)/usr/bin
|
||||||
|
install -m 755 rebuildpkgs $(DESTDIR)/usr/bin
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
# remove all files we installed
|
# remove all files we installed
|
||||||
@@ -29,6 +32,7 @@ uninstall:
|
|||||||
rm $(DESTDIR)/usr/bin/corepkg
|
rm $(DESTDIR)/usr/bin/corepkg
|
||||||
rm $(DESTDIR)/usr/bin/testingpkg
|
rm $(DESTDIR)/usr/bin/testingpkg
|
||||||
rm $(DESTDIR)/usr/bin/communitypkg
|
rm $(DESTDIR)/usr/bin/communitypkg
|
||||||
|
rm $(DESTDIR)/usr/bin/community-testingpkg
|
||||||
rm $(DESTDIR)/usr/sbin/mkarchroot
|
rm $(DESTDIR)/usr/sbin/mkarchroot
|
||||||
rm $(DESTDIR)/usr/sbin/makechrootpkg
|
rm $(DESTDIR)/usr/sbin/makechrootpkg
|
||||||
rm $(DESTDIR)/usr/bin/lddd
|
rm $(DESTDIR)/usr/bin/lddd
|
||||||
@@ -36,3 +40,5 @@ uninstall:
|
|||||||
rm $(DESTDIR)/usr/bin/archco
|
rm $(DESTDIR)/usr/bin/archco
|
||||||
rm $(DESTDIR)/usr/bin/archrelease
|
rm $(DESTDIR)/usr/bin/archrelease
|
||||||
rm $(DESTDIR)/usr/bin/archrm
|
rm $(DESTDIR)/usr/bin/archrm
|
||||||
|
rm $(DESTDIR)/usr/bin/communityco
|
||||||
|
rm $(DESTDIR)/usr/bin/rebuildpkgs
|
||||||
|
43
archrelease
43
archrelease
@@ -5,7 +5,7 @@ if [ "$1" = "" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "PKGBUILD" ]; then
|
if [ ! -f PKGBUILD ]; then
|
||||||
echo "archrelease: PKGBUILD not found"
|
echo "archrelease: PKGBUILD not found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -15,34 +15,17 @@ if [ "$(basename $(readlink -f .))" != "trunk" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d ../repos/$1 ]; then
|
if [ "$(svn diff)" != "" ]; then
|
||||||
pushd ..
|
echo "archrelease: You have not committed your changes yet!"
|
||||||
[ -d repos ] || mkdir repos
|
echo " Please run 'upgpkg' or 'svn commit' first"
|
||||||
svn copy -r HEAD trunk repos/$1
|
exit 1
|
||||||
svn commit -m "archrelease: new repo $1"
|
|
||||||
pushd repos/$1
|
|
||||||
svnmerge init
|
|
||||||
svn commit -F svnmerge-commit-message.txt
|
|
||||||
rm svnmerge-commit-message.txt
|
|
||||||
popd
|
|
||||||
popd
|
|
||||||
else
|
|
||||||
svnmerge merge ../repos/$1
|
|
||||||
pushd ..
|
|
||||||
if [ -f trunk/svnmerge-commit-message.txt ]; then
|
|
||||||
svn commit -F trunk/svnmerge-commit-message.txt
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
# The user is going to have to clean things up a bit
|
|
||||||
echo "*** ATTENTION: There was a problem merging the package changes ***"
|
|
||||||
echo "To fix it, edit the conflicting files in repos/$1 (the ones that are C in svn status)."
|
|
||||||
echo "Once you have resolved conflicts, execute 'svn resolved <path to file>' to tell svn the error was resolved."
|
|
||||||
echo "Then to finish the merge commit, execute 'svn commit -F trunk/svnmerge-commit-message.txt' and, if there are no problems, delete trunk/svnmerge-commit-message.txt"
|
|
||||||
exit $?
|
|
||||||
fi
|
|
||||||
rm trunk/svnmerge-commit-message.txt
|
|
||||||
else
|
|
||||||
echo "Nothing to commit"
|
|
||||||
fi
|
|
||||||
popd
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
pushd .. >/dev/null
|
||||||
|
if [ -d repos/$1 ]; then
|
||||||
|
svn rm --force -q repos/$1
|
||||||
|
svn commit -q -m "archrelease: remove $1"
|
||||||
|
fi
|
||||||
|
svn copy -q -r HEAD trunk repos/$1
|
||||||
|
svn commit -q -m "archrelease: copy trunk to $1"
|
||||||
|
popd >/dev/null
|
||||||
|
89
checkpkg
89
checkpkg
@@ -23,65 +23,72 @@ if [ ! -f PKGBUILD ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
source PKGBUILD
|
source PKGBUILD
|
||||||
|
if [ "$arch" == "any" ]; then
|
||||||
pkgfile=${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
|
CARCH="any"
|
||||||
oldstylepkgfile=${pkgname}-${pkgver}-${pkgrel}${PKGEXT}
|
|
||||||
|
|
||||||
if [ -f "$(pwd)/$pkgfile" ]; then
|
|
||||||
pkgfile=$(pwd)/$pkgfile
|
|
||||||
elif [ -f "$PKGDEST/$pkgfile" ]; then
|
|
||||||
pkgfile=$PKGDEST/$pkgfile
|
|
||||||
elif [ -f "$(pwd)/$oldstylepkgfile" ]; then
|
|
||||||
pkgfile=$(pwd)/$oldstylepkgfile
|
|
||||||
elif [ -f "$PKGDEST/$oldstylepkgfile" ]; then
|
|
||||||
pkgfile=$PKGDEST/$oldstylepkgfile
|
|
||||||
else
|
|
||||||
echo "File \"$pkgfile\" doesn't exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmp=`pacman -Spd --noconfirm $pkgname`
|
for _pkgname in ${pkgname[@]}; do
|
||||||
|
pkgfile=${_pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
|
||||||
|
oldstylepkgfile=${_pkgname}-${pkgver}-${pkgrel}${PKGEXT}
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ -f "$(pwd)/$pkgfile" ]; then
|
||||||
echo "Couldn't download previous package."
|
pkgfile=$(pwd)/$pkgfile
|
||||||
|
elif [ -f "$PKGDEST/$pkgfile" ]; then
|
||||||
|
pkgfile=$PKGDEST/$pkgfile
|
||||||
|
elif [ -f "$(pwd)/$oldstylepkgfile" ]; then
|
||||||
|
pkgfile=$(pwd)/$oldstylepkgfile
|
||||||
|
elif [ -f "$PKGDEST/$oldstylepkgfile" ]; then
|
||||||
|
pkgfile=$PKGDEST/$oldstylepkgfile
|
||||||
|
else
|
||||||
|
echo "File \"$pkgfile\" doesn't exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pkgurl=`echo $tmp | rev | cut -d ' ' -f 1 | rev`
|
tmp=`pacman -Spd --noconfirm $_pkgname`
|
||||||
|
|
||||||
oldpkg=`strip_url $pkgurl`
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Couldn't download previous package for $_pkgname."
|
||||||
if [ "$(basename $oldpkg)" = "$(basename $pkgfile)" ]; then
|
|
||||||
echo "The built package is the one in the repo right now!"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $oldpkg ]; then
|
pkgurl=`echo $tmp | rev | cut -d ' ' -f 1 | rev`
|
||||||
|
|
||||||
|
oldpkg=`strip_url $pkgurl`
|
||||||
|
|
||||||
|
if [ "$(basename $oldpkg)" = "$(basename $pkgfile)" ]; then
|
||||||
|
echo "The built package ($_pkgname) is the one in the repo right now!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f $oldpkg ]; then
|
||||||
if echo $pkgurl | grep "^file:///" > /dev/null 2>&1; then
|
if echo $pkgurl | grep "^file:///" > /dev/null 2>&1; then
|
||||||
cp `echo $pkgurl | sed 's#^file://##'` .
|
cp `echo $pkgurl | sed 's#^file://##'` .
|
||||||
|
elif [ -f $PKGDEST/$oldpkg ]; then
|
||||||
|
cp $PKGDEST/$oldpkg .
|
||||||
else
|
else
|
||||||
wget $pkgurl
|
wget --quiet $pkgurl
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bsdtar tf $oldpkg > filelist-old
|
bsdtar tf $oldpkg > filelist-$_pkgname-old
|
||||||
bsdtar tf "$pkgfile" > filelist
|
bsdtar tf "$pkgfile" > filelist-$_pkgname
|
||||||
|
|
||||||
sort -o filelist filelist
|
sort -o filelist-$_pkgname filelist-$_pkgname
|
||||||
sort -o filelist-old filelist-old
|
sort -o filelist-$_pkgname-old filelist-$_pkgname-old
|
||||||
|
|
||||||
diff filelist-old filelist
|
diff filelist-$_pkgname-old filelist-$_pkgname
|
||||||
|
|
||||||
if diff filelist-old filelist | grep '\.so\.' > /dev/null 2>&1; then
|
if diff filelist-$_pkgname-old filelist-$_pkgname | grep '\.so\.' > /dev/null 2>&1; then
|
||||||
mkdir -p pkg
|
mkdir -p pkg
|
||||||
cd pkg
|
cd pkg
|
||||||
bsdtar xf "$pkgfile" > /dev/null
|
bsdtar xf "$pkgfile" > /dev/null
|
||||||
for i in `diff ../filelist-old ../filelist | grep \> | grep \.so\. | awk '{print $2}'`; do
|
for i in `diff ../filelist-$_pkgname-old ../filelist-$_pkgname | grep \> | grep \.so\. | awk '{print $2}'`; do
|
||||||
echo -n "${i}: "
|
echo -n "${i}: "
|
||||||
objdump -p $i | grep SONAME
|
objdump -p $i | grep SONAME
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "No filename differences"
|
echo "No filename differences for $_pkgname."
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# vim:ft=sh:ts=4:sw=4:et:
|
# vim:ft=sh:ts=4:sw=4:et:
|
||||||
|
162
commitpkg
162
commitpkg
@@ -1,119 +1,99 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
abort() {
|
||||||
|
echo ${1:-"Cancelled"}
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Source makepkg.conf; fail if it is not found
|
# Source makepkg.conf; fail if it is not found
|
||||||
if [ -r "/etc/makepkg.conf" ]; then
|
if [ -r "/etc/makepkg.conf" ]; then
|
||||||
source "/etc/makepkg.conf"
|
source "/etc/makepkg.conf"
|
||||||
else
|
else
|
||||||
echo "/etc/makepkg.conf not found!"
|
abort "/etc/makepkg.conf not found!"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Source user-specific makepkg.conf overrides
|
# Source user-specific makepkg.conf overrides
|
||||||
if [ -r ~/.makepkg.conf ]; then
|
if [ -r ~/.makepkg.conf ]; then
|
||||||
source ~/.makepkg.conf
|
source ~/.makepkg.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmd=$(basename $0)
|
cmd=$(basename "$0")
|
||||||
|
|
||||||
if [ ! -f PKGBUILD ]; then
|
if [ ! -f PKGBUILD ]; then
|
||||||
echo "No PKGBUILD file"
|
abort "No PKGBUILD file"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$CARCH" ]; then
|
|
||||||
echo "CARCH must be set to a recognized value!"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source PKGBUILD
|
source PKGBUILD
|
||||||
pkgbase=${pkgbase:-${pkgname[0]}}
|
pkgbase=${pkgbase:-$pkgname}
|
||||||
|
|
||||||
for _pkgname in ${pkgname[@]}; do
|
|
||||||
pkgfile=${_pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
|
|
||||||
anypkgfile=${_pkgname}-${pkgver}-${pkgrel}-any${PKGEXT}
|
|
||||||
|
|
||||||
if [ ! -f $pkgfile ]; then
|
|
||||||
if [ -f $PKGDEST/$pkgfile ]; then
|
|
||||||
pkgfile=$PKGDEST/$pkgfile
|
|
||||||
elif [ -f $anypkgfile ]; then
|
|
||||||
pkgfile=$anypkgfile
|
|
||||||
CARCH=any
|
|
||||||
elif [ -f $PKGDEST/$anypkgfile ]; then
|
|
||||||
pkgfile=$PKGDEST/$anypkgfile
|
|
||||||
CARCH=any
|
|
||||||
else
|
|
||||||
echo "File $pkgfile doesn't exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set up repo-specific opts depending on how we were called
|
# set up repo-specific opts depending on how we were called
|
||||||
server="gerolde.archlinux.org"
|
server="gerolde.archlinux.org"
|
||||||
if [ "$cmd" == "extrapkg" ]; then
|
if [ "$cmd" == "extrapkg" ]; then
|
||||||
repo="extra"
|
repo="extra"
|
||||||
elif [ "$cmd" == "corepkg" ]; then
|
elif [ "$cmd" == "corepkg" ]; then
|
||||||
repo="core"
|
repo="core"
|
||||||
elif [ "$cmd" == "testingpkg" ]; then
|
elif [ "$cmd" == "testingpkg" ]; then
|
||||||
repo="testing"
|
repo="testing"
|
||||||
elif [ "$cmd" == "communitypkg" ]; then
|
elif [ "$cmd" == "communitypkg" ]; then
|
||||||
repo="community"
|
repo="community"
|
||||||
server="aur.archlinux.org"
|
server="aur.archlinux.org"
|
||||||
else
|
elif [ "$cmd" == "community-testingpkg" ]; then
|
||||||
if [ $# -eq 0 ]; then
|
repo="community-testing"
|
||||||
echo "usage: commitpkg <reponame> [-l limit] [commit message]"
|
server="aur.archlinux.org"
|
||||||
exit 1
|
else
|
||||||
fi
|
if [ $# -eq 0 ]; then
|
||||||
repo="$1"
|
abort "usage: commitpkg <reponame> [-l limit] [commit message]"
|
||||||
shift
|
|
||||||
fi
|
fi
|
||||||
|
repo="$1"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
# see if any limit options were passed, we'll send them to SCP
|
# check if all local source files are under version control
|
||||||
unset scpopts
|
(for s in ${source[@]} $install; do
|
||||||
if [ "$1" = "-l" ]; then
|
echo $s | grep -vq '://' && \
|
||||||
scpopts="$1 $2"
|
svn status $s | grep -q '?' && \
|
||||||
shift 2
|
abort "$s is not under version control"
|
||||||
fi
|
done) || true
|
||||||
|
|
||||||
# combine what we know into a variable
|
# see if any limit options were passed, we'll send them to rsync
|
||||||
uploadto="staging/${repo}/$(basename ${pkgfile})"
|
unset rsyncopts
|
||||||
scp ${scpopts} "${pkgfile}" "${server}:${uploadto}"
|
if [ "$1" = "-l" ]; then
|
||||||
if [ "$(md5sum "${pkgfile}" | cut -d' ' -f1)" != "$(ssh ${server} md5sum "${uploadto}" | cut -d' ' -f1)" ]; then
|
rsyncopts="--bwlimit=$2"
|
||||||
echo "File got corrupted during upload, cancelled."
|
shift 2
|
||||||
exit 1
|
fi
|
||||||
else
|
|
||||||
echo "File integrity okay."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ -n "$1" ]; then
|
||||||
echo "Cancelled"
|
svn commit -q -m "upgpkg: $pkgbase $pkgver-$pkgrel
|
||||||
exit 1
|
$1" || abort
|
||||||
fi
|
else
|
||||||
echo "===> Uploaded $pkgfile"
|
svn commit -q || abort
|
||||||
|
fi
|
||||||
|
|
||||||
|
for _arch in ${arch[@]}; do
|
||||||
|
for _pkgname in ${pkgname[@]}; do
|
||||||
|
pkgfile=$_pkgname-$pkgver-$pkgrel-${_arch}$PKGEXT
|
||||||
|
|
||||||
|
if [ ! -f $pkgfile -a -f "$PKGDEST/$pkgfile" ]; then
|
||||||
|
pkgfile="$PKGDEST/$pkgfile"
|
||||||
|
elif [ ! -f $pkgfile ]; then
|
||||||
|
echo "Skipping ${_arch}"
|
||||||
|
continue 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
rsync -c -h --progress $rsyncopts "${pkgfile}" -e ssh $server:staging/$repo || abort
|
||||||
|
done
|
||||||
|
archrelease $repo-${_arch} || abort
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$1" != "" ]; then
|
if [ "${arch[*]}" == "any" ]; then
|
||||||
svn commit -m "upgpkg: $pkgbase $pkgver-$pkgrel
|
if [ -d ../repos/$repo-i686 -a -d ../repos/$repo-x86_64 ]; then
|
||||||
$1" > /dev/null
|
pushd ../repos/ >/dev/null
|
||||||
if [ $? -ne 0 ]; then
|
svn rm $repo-i686
|
||||||
echo "Cancelled"
|
svn rm $repo-x86_64
|
||||||
exit 1
|
svn commit -m "removed $repo-i686 and $repo-x86_64 for $pkgname"
|
||||||
|
popd >/dev/null
|
||||||
fi
|
fi
|
||||||
echo "===> Commited with \"upgpkg: $pkgbase $pkgver-$pkgrel
|
|
||||||
$1\" message"
|
|
||||||
else
|
|
||||||
svn commit >/dev/null
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Cancelled"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "===> Commited with \"upgpkg: $pkgbase $pkgver-$pkgrel\" message"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
archrelease $repo-$CARCH
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Cancelled"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "===> Tagged for $repo-$CARCH"
|
|
||||||
|
|
||||||
# vim:ft=sh:ts=4:sw=4:et:
|
# vim:ft=sh:ts=4:sw=4:et:
|
||||||
|
@@ -1,33 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# This script commits an existing package as an 'any'
|
|
||||||
# package. It is simply to help aid in the conversion
|
|
||||||
# to any-based packages
|
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
|
||||||
echo "Syntax: $(basename $0) <repo>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
repo=$1
|
|
||||||
|
|
||||||
source PKGBUILD
|
|
||||||
|
|
||||||
sed -i 's|^arch=.\+$|arch=(any)|' PKGBUILD
|
|
||||||
|
|
||||||
svn commit -m "upgpkg: $pkgname $pkgver-$pkgrel
|
|
||||||
Converted to arch=any" > /dev/null
|
|
||||||
|
|
||||||
archrelease $repo-any
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Cancelled"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "===> Tagged for $repo-any"
|
|
||||||
|
|
||||||
pushd ..
|
|
||||||
svn rm $repo-i686
|
|
||||||
svn rm $repo-x86_64
|
|
||||||
svn commit -m "removed $repo-i686 and $repo-x86_64 for $pkgname"
|
|
||||||
popd
|
|
||||||
|
|
||||||
echo "Don't forget to run \"/arch/db-update $repo\" on gerolde"
|
|
175
makechrootpkg
175
makechrootpkg
@@ -12,7 +12,7 @@ FORCE="n"
|
|||||||
RUN=""
|
RUN=""
|
||||||
MAKEPKG_ARGS="-sr"
|
MAKEPKG_ARGS="-sr"
|
||||||
REPACK=""
|
REPACK=""
|
||||||
LAYER="rw"
|
COPY="copy"
|
||||||
WORKDIR=$PWD
|
WORKDIR=$PWD
|
||||||
|
|
||||||
update_first="0"
|
update_first="0"
|
||||||
@@ -32,8 +32,8 @@ usage ()
|
|||||||
echo " will be passed to makepkg."
|
echo " will be passed to makepkg."
|
||||||
echo ""
|
echo ""
|
||||||
echo " The chroot dir consists of the following directories:"
|
echo " The chroot dir consists of the following directories:"
|
||||||
echo " <chrootdir>/{root, rw, union} but only 'root' is required"
|
echo " <chrootdir>/{root, copy} but only 'root' is required"
|
||||||
echo " by default. The rest will be created as needed"
|
echo " by default. The working copy will be created as needed"
|
||||||
echo ""
|
echo ""
|
||||||
echo "The chroot 'root' directory must be created via the following"
|
echo "The chroot 'root' directory must be created via the following"
|
||||||
echo "command:"
|
echo "command:"
|
||||||
@@ -44,14 +44,14 @@ usage ()
|
|||||||
echo "Flags:"
|
echo "Flags:"
|
||||||
echo "-h This help"
|
echo "-h This help"
|
||||||
echo "-c Clean the chroot before building"
|
echo "-c Clean the chroot before building"
|
||||||
echo "-u Update the rw layer of the chroot before building"
|
echo "-u Update the working copy of the chroot before building"
|
||||||
echo " This is useful for rebuilds without dirtying the pristine"
|
echo " This is useful for rebuilds without dirtying the pristine"
|
||||||
echo " chroot"
|
echo " chroot"
|
||||||
echo "-d Add the package to a local db at /repo after building"
|
echo "-d Add the package to a local db at /repo after building"
|
||||||
echo "-r <dir> The chroot shell to use"
|
echo "-r <dir> The chroot dir to use"
|
||||||
echo "-I <pkg> Install a package into the rw layer of the chroot"
|
echo "-I <pkg> Install a package into the working copy of the chroot"
|
||||||
echo "-l <layer> The directory to use as the rw layer of the union"
|
echo "-l <copy> The directory to use as the working copy of the chroot"
|
||||||
echo " Useful for maintain multiple layers. Default: rw"
|
echo " Useful for maintain multiple copies Default: copy"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,13 +63,14 @@ while getopts 'hcudr:I:l:' arg; do
|
|||||||
d) add_to_db=1 ;;
|
d) add_to_db=1 ;;
|
||||||
r) chrootdir="$OPTARG" ;;
|
r) chrootdir="$OPTARG" ;;
|
||||||
I) install_pkg="$OPTARG" ;;
|
I) install_pkg="$OPTARG" ;;
|
||||||
l) LAYER="$OPTARG" ;;
|
l) COPY="$OPTARG" ;;
|
||||||
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
|
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#Get rid of trailing / in chrootdir
|
#Get rid of trailing / in chrootdir
|
||||||
[ "$chrootdir" != "/" ] && chrootdir=$(echo $chrootdir | sed 's#/$##')
|
[ "$chrootdir" != "/" ] && chrootdir=$(echo $chrootdir | sed 's#/$##')
|
||||||
|
copydir="$chrootdir/$COPY"
|
||||||
|
|
||||||
# Pass all arguments after -- right to makepkg
|
# Pass all arguments after -- right to makepkg
|
||||||
MAKEPKG_ARGS="$MAKEPKG_ARGS ${*:$OPTIND}"
|
MAKEPKG_ARGS="$MAKEPKG_ARGS ${*:$OPTIND}"
|
||||||
@@ -104,81 +105,57 @@ if [ ! -d "$chrootdir/root" ]; then
|
|||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -d "$chrootdir/$LAYER" -a "$clean_first" -eq "1" ] && rm -rf "$chrootdir/$LAYER/"
|
umask 000
|
||||||
[ -d "$chrootdir/$LAYER" ] || mkdir "$chrootdir/$LAYER"
|
if [ ! -d "$copydir" -o "$clean_first" -eq "1" ]; then
|
||||||
[ -d "$chrootdir/union" ] || mkdir "$chrootdir/union"
|
echo "creating clean working copy"
|
||||||
|
mkdir -p "$copydir"
|
||||||
cleanup ()
|
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
||||||
{
|
|
||||||
echo "cleaning up unioned mounts"
|
|
||||||
umount "$chrootdir/union/pkgdest" 2>/dev/null
|
|
||||||
umount "$chrootdir/union/srcdest" 2>/dev/null
|
|
||||||
umount "$chrootdir/union"
|
|
||||||
}
|
|
||||||
|
|
||||||
uniondir="$chrootdir/union"
|
|
||||||
echo "building union chroot"
|
|
||||||
grep -Fq aufs /proc/filesystems
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
modprobe -q aufs
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "ERROR: No aufs available. Abandon ship!" && exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
mount -t aufs none -o "dirs=$chrootdir/$LAYER=rw:$chrootdir/root=ro" "$uniondir"
|
|
||||||
trap 'cleanup' 0 1 2 15
|
|
||||||
|
|
||||||
if [ -n "$install_pkg" ]; then
|
if [ -n "$install_pkg" ]; then
|
||||||
pkgname="$(basename "$install_pkg")"
|
pkgname="$(basename "$install_pkg")"
|
||||||
echo "installing '$pkgname' in chroot"
|
cp "$install_pkg" "$copydir/$pkgname"
|
||||||
cp "$install_pkg" "$uniondir/$pkgname"
|
mkarchroot -r "pacman -U /$pkgname" "$copydir"
|
||||||
mkarchroot -r "pacman -U /$pkgname" "$uniondir"
|
|
||||||
ret=$?
|
ret=$?
|
||||||
rm "$uniondir/$pkgname"
|
rm "$copydir/$pkgname"
|
||||||
#exit early, we've done all we need to
|
#exit early, we've done all we need to
|
||||||
exit $ret
|
exit $ret
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $update_first -eq 1 ]; then
|
if [ $update_first -eq 1 ]; then
|
||||||
echo "updating chroot"
|
mkarchroot -r "pacman -Syu --noconfirm" "$copydir"
|
||||||
mkarchroot -r "pacman -Syu --noconfirm" "$uniondir"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "moving build files to chroot"
|
[ -d "$copydir/build" ] || mkdir "$copydir/build"
|
||||||
[ -d "$uniondir/build" ] || mkdir "$uniondir/build"
|
|
||||||
|
|
||||||
if [ "$REPACK" != "1" ]; then
|
if [ "$REPACK" != "1" ]; then
|
||||||
#Remove anything in there UNLESS -R (repack) was passed to makepkg
|
#Remove anything in there UNLESS -R (repack) was passed to makepkg
|
||||||
rm -rf "$uniondir/build/"*
|
rm -rf "$copydir/build/"*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source $uniondir/etc/makepkg.conf
|
# Get SRC/PKGDEST from makepkg.conf
|
||||||
|
SRCDEST=$(grep '^SRCDEST=' /etc/makepkg.conf | cut -d= -f2)
|
||||||
|
PKGDEST=$(grep '^PKGDEST=' /etc/makepkg.conf | cut -d= -f2)
|
||||||
|
|
||||||
[ -d "$uniondir/pkgdest" ] || mkdir "$uniondir/pkgdest"
|
[ -d "$copydir/pkgdest" ] || mkdir "$copydir/pkgdest"
|
||||||
if ! grep "PKGDEST=/pkgdest" "$uniondir/etc/makepkg.conf" >/dev/null 2>&1; then
|
if ! grep "PKGDEST=/pkgdest" "$copydir/etc/makepkg.conf" >/dev/null 2>&1; then
|
||||||
echo "Setting PKGDEST in makepkg.conf"
|
echo "PKGDEST=/pkgdest" >> "$copydir/etc/makepkg.conf"
|
||||||
echo "PKGDEST=/pkgdest" >> "$uniondir/etc/makepkg.conf"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -d "$uniondir/srcdest" ] || mkdir "$uniondir/srcdest"
|
[ -d "$copydir/srcdest" ] || mkdir "$copydir/srcdest"
|
||||||
if ! grep "SRCDEST=/srcdest" "$uniondir/etc/makepkg.conf" >/dev/null 2>&1; then
|
if ! grep "SRCDEST=/srcdest" "$copydir/etc/makepkg.conf" >/dev/null 2>&1; then
|
||||||
echo "Setting SRCDEST in makepkg.conf"
|
echo "SRCDEST=/srcdest" >> "$copydir/etc/makepkg.conf"
|
||||||
echo "SRCDEST=/srcdest" >> "$uniondir/etc/makepkg.conf"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R nobody "$uniondir/build"
|
|
||||||
chown -R nobody "$uniondir/srcdest"
|
|
||||||
chown -R nobody "$uniondir/pkgdest"
|
|
||||||
|
|
||||||
# Copy PKGBUILD and sources
|
# Copy PKGBUILD and sources
|
||||||
source PKGBUILD
|
source PKGBUILD
|
||||||
cp PKGBUILD "$uniondir/build/"
|
cp PKGBUILD "$copydir/build/"
|
||||||
for f in ${source[@]}; do
|
for f in ${source[@]}; do
|
||||||
basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g')
|
basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g')
|
||||||
if [ -f "$basef" ]; then
|
if [ -f "$basef" ]; then
|
||||||
cp "$basef" "$uniondir/srcdest/"
|
cp "$basef" "$copydir/srcdest/"
|
||||||
elif [ -f "$SRCDEST/$basef" ]; then
|
elif [ -f "$SRCDEST/$basef" ]; then
|
||||||
cp "$SRCDEST/$basef" "$uniondir/srcdest/"
|
cp "$SRCDEST/$basef" "$copydir/srcdest/"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -186,30 +163,32 @@ install_files=$(grep "install=" PKGBUILD)
|
|||||||
for pkg in ${pkgname[@]}; do
|
for pkg in ${pkgname[@]}; do
|
||||||
install_files+=' '
|
install_files+=' '
|
||||||
install_files+=$(echo $install_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/")
|
install_files+=$(echo $install_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/")
|
||||||
|
install_files=$(eval echo $install_files |tr '[:blank:]' '\n'|sort |uniq)
|
||||||
done
|
done
|
||||||
|
|
||||||
install_files=$(eval echo $install_files |tr '[:blank:]' '\n'|sort |uniq)
|
|
||||||
|
|
||||||
for f in $install_files;do
|
for f in $install_files;do
|
||||||
install="${f#"install="}"
|
install="${f#"install="}"
|
||||||
if [ "$install" != "" -a -f "$install" ]; then
|
if [ "$install" != "" -a -f "$install" ]; then
|
||||||
cp "$install" "$uniondir/build/"
|
cp "$install" "$copydir/build/"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -f "ChangeLog" ]; then
|
if [ -f "ChangeLog" ]; then
|
||||||
cp ChangeLog "$uniondir/build/"
|
cp ChangeLog "$copydir/build/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep "^nobody" "$uniondir/etc/sudoers" >/dev/null 2>&1; then
|
chown -R nobody "$copydir/build"
|
||||||
echo "allowing 'nobody' sudo rights in the chroot"
|
chown -R nobody "$copydir/srcdest"
|
||||||
touch "$uniondir/etc/sudoers"
|
chown -R nobody "$copydir/pkgdest"
|
||||||
echo "nobody ALL=(ALL) NOPASSWD: ALL" >> "$uniondir/etc/sudoers"
|
|
||||||
chmod 440 "$uniondir/etc/sudoers"
|
if ! grep "^nobody" "$copydir/etc/sudoers" >/dev/null 2>&1; then
|
||||||
|
touch "$copydir/etc/sudoers"
|
||||||
|
echo "nobody ALL=(ALL) NOPASSWD: ALL" >> "$copydir/etc/sudoers"
|
||||||
|
chmod 440 "$copydir/etc/sudoers"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#This is a little gross, but this way the script is recreated every time in the
|
#This is a little gross, but this way the script is recreated every time in the
|
||||||
#rw portion of the union
|
#working copy
|
||||||
(cat <<EOF
|
(cat <<EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export LANG=$LOCALE
|
export LANG=$LOCALE
|
||||||
@@ -220,55 +199,51 @@ sudo -u nobody makepkg $MAKEPKG_ARGS || touch BUILD_FAILED
|
|||||||
which namcap &>/dev/null && namcap /build/PKGBUILD /pkgdest/*${PKGEXT} > /pkgdest/namcap.log
|
which namcap &>/dev/null && namcap /build/PKGBUILD /pkgdest/*${PKGEXT} > /pkgdest/namcap.log
|
||||||
exit 0
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
) > "$uniondir/chrootbuild"
|
) > "$copydir/chrootbuild"
|
||||||
chmod +x "$uniondir/chrootbuild"
|
chmod +x "$copydir/chrootbuild"
|
||||||
|
|
||||||
if mkarchroot -r "/chrootbuild" "$uniondir"; then
|
if mkarchroot -r "/chrootbuild" "$copydir"; then
|
||||||
source ${WORKDIR}/PKGBUILD
|
for pkgfile in "${copydir}"/pkgdest/*${PKGEXT}; do
|
||||||
|
[ -e "$pkgfile" ] || continue
|
||||||
|
_pkgname=$(basename "$pkgfile")
|
||||||
|
if [ "$add_to_db" -eq "1" ]; then
|
||||||
|
[ -d "${copydir}/repo" ] || mkdir -p "${copydir}/repo"
|
||||||
|
pushd "${copydir}/repo" >/dev/null
|
||||||
|
cp "$pkgfile" .
|
||||||
|
repo-add repo.db.tar.gz "$_pkgname"
|
||||||
|
popd >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
for _pkgname in ${pkgname[@]}; do
|
if [ -d "$PKGDEST" ]; then
|
||||||
pkgfile="${chrootdir}"/union/pkgdest/${_pkgname}-*${PKGEXT}
|
mv "$pkgfile" "${PKGDEST}"
|
||||||
|
else
|
||||||
if [ -n "$add_to_db" -a -e "$pkgfile" ]; then
|
mv "$pkgfile" "${WORKDIR}"
|
||||||
[ -d "${chrootdir}/union/repo" ] || mkdir -p "${chrootdir}/union/repo"
|
fi
|
||||||
pushd "${chrootdir}/union/repo" >/dev/null
|
|
||||||
cp "$pkgfile" .
|
|
||||||
repo-add repo.db.tar.${DB_COMPRESSION} ${_pkgname}-${pkgver}-${pkgrel}-*${PKGEXT}
|
|
||||||
popd >/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e $pkgfile ]; then
|
|
||||||
if [ -n "$PKGDEST" ]; then
|
|
||||||
echo "Moving completed ${_pkgname} package file to ${PKGDEST}"
|
|
||||||
mv $pkgfile "${PKGDEST}"
|
|
||||||
else
|
|
||||||
echo "Moving completed ${_pkgname} package file to ${WORKDIR}"
|
|
||||||
mv $pkgfile "${WORKDIR}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for f in ${chrootdir}/union/srcdest/*; do
|
for f in "${copydir}"/srcdest/*; do
|
||||||
[ -e "$f" ] || continue
|
[ -e "$f" ] || continue
|
||||||
if [ -n "$SRCDEST" ]; then
|
if [ -d "$SRCDEST" ]; then
|
||||||
echo "Moving downloaded source file $(basename $f) to ${SRCDEST}"
|
|
||||||
mv "$f" "${SRCDEST}"
|
mv "$f" "${SRCDEST}"
|
||||||
else
|
else
|
||||||
echo "Moving downloaded source file $(basename $f) to ${WORKDIR}"
|
|
||||||
mv "$f" "${WORKDIR}"
|
mv "$f" "${WORKDIR}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for l in "${copydir}"/build/*-{build,package}.log; do
|
||||||
|
[ -f "$l" ] && mv "$l" "${WORKDIR}"
|
||||||
|
done
|
||||||
else
|
else
|
||||||
#just in case. We returned 1, make sure we fail
|
#just in case. We returned 1, make sure we fail
|
||||||
touch ${chrootdir}/union/build/BUILD_FAILED
|
touch "${copydir}/build/BUILD_FAILED"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e ${chrootdir}/union/build/BUILD_FAILED ]; then
|
if [ -e "${copydir}/build/BUILD_FAILED" ]; then
|
||||||
echo "Build failed, check $chrootdir/$LAYER/build"
|
echo "Build failed, check $copydir/build"
|
||||||
rm ${chrootdir}/union/build/BUILD_FAILED
|
rm "${copydir}/build/BUILD_FAILED"
|
||||||
else
|
else
|
||||||
rm -rf ${chrootdir}/union/build/*
|
rm -rf "${copydir}"/build/*
|
||||||
echo "Build complete"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# vim:ft=sh:ts=4:sw=4:et:
|
# vim:ft=sh:ts=4:sw=4:et:
|
||||||
|
39
mkarchroot
39
mkarchroot
@@ -13,6 +13,7 @@ RUN=""
|
|||||||
NOCOPY="n"
|
NOCOPY="n"
|
||||||
|
|
||||||
working_dir=""
|
working_dir=""
|
||||||
|
cache_dir=$(grep -m 1 '^CacheDir' /etc/pacman.conf | sed 's/CacheDir\s*=\s*//')
|
||||||
|
|
||||||
APPNAME=$(basename "${0}")
|
APPNAME=$(basename "${0}")
|
||||||
|
|
||||||
@@ -24,14 +25,15 @@ usage ()
|
|||||||
echo " -r <app> Run 'app' within the context of the chroot"
|
echo " -r <app> Run 'app' within the context of the chroot"
|
||||||
echo " -u Update the chroot via pacman"
|
echo " -u Update the chroot via pacman"
|
||||||
echo " -f Force overwrite of files in the working-dir"
|
echo " -f Force overwrite of files in the working-dir"
|
||||||
echo " -C <file> location of a pacman config file"
|
echo " -C <file> Location of a pacman config file"
|
||||||
echo " -M <file> location of a makepkg config file"
|
echo " -M <file> Location of a makepkg config file"
|
||||||
echo " -n do not copy config files into the chroot"
|
echo " -n Do not copy config files into the chroot"
|
||||||
|
echo " -c <dir> Set pacman cache. Default: ${cache_dir}"
|
||||||
echo " -h This message"
|
echo " -h This message"
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'r:ufhC:M:' arg; do
|
while getopts 'r:ufnhC:M:c:' arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
r) RUN="$OPTARG" ;;
|
r) RUN="$OPTARG" ;;
|
||||||
u) RUN="pacman -Syu" ;;
|
u) RUN="pacman -Syu" ;;
|
||||||
@@ -39,6 +41,7 @@ while getopts 'r:ufhC:M:' arg; do
|
|||||||
C) pac_conf="$OPTARG" ;;
|
C) pac_conf="$OPTARG" ;;
|
||||||
M) makepkg_conf="$OPTARG" ;;
|
M) makepkg_conf="$OPTARG" ;;
|
||||||
n) NOCOPY="y" ;;
|
n) NOCOPY="y" ;;
|
||||||
|
c) cache_dir="$OPTARG" ;;
|
||||||
h|?) usage 0 ;;
|
h|?) usage 0 ;;
|
||||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||||
esac
|
esac
|
||||||
@@ -68,45 +71,39 @@ shift 1
|
|||||||
|
|
||||||
chroot_mount ()
|
chroot_mount ()
|
||||||
{
|
{
|
||||||
echo "mounting sysfs : /sys"
|
|
||||||
[ -e "${working_dir}/sys" ] || mkdir "${working_dir}/sys"
|
[ -e "${working_dir}/sys" ] || mkdir "${working_dir}/sys"
|
||||||
mount -t sysfs sysfs "${working_dir}/sys"
|
mount -t sysfs sysfs "${working_dir}/sys"
|
||||||
|
|
||||||
echo "mounting procfs : /proc"
|
|
||||||
[ -e "${working_dir}/proc" ] || mkdir "${working_dir}/proc"
|
[ -e "${working_dir}/proc" ] || mkdir "${working_dir}/proc"
|
||||||
mount -t proc proc "${working_dir}/proc"
|
mount -t proc proc "${working_dir}/proc"
|
||||||
|
|
||||||
echo "binding device nodes : /dev"
|
|
||||||
[ -e "${working_dir}/dev" ] || mkdir "${working_dir}/dev"
|
[ -e "${working_dir}/dev" ] || mkdir "${working_dir}/dev"
|
||||||
mount -o bind /dev "${working_dir}/dev"
|
mount -o bind /dev "${working_dir}/dev"
|
||||||
|
|
||||||
echo "binding pacman cache : /var/cache/pacman"
|
[ -e "${working_dir}/var/cache/pacman/pkg" ] || mkdir -p "${working_dir}/var/cache/pacman/pkg"
|
||||||
[ -e "${working_dir}/var/cache/pacman" ] || mkdir -p "${working_dir}/var/cache/pacman"
|
[ -e "${cache_dir}" ] || mkdir -p "${cache_dir}"
|
||||||
mount -o bind /var/cache/pacman "${working_dir}/var/cache/pacman"
|
mount -o bind "${cache_dir}" "${working_dir}/var/cache/pacman/pkg"
|
||||||
|
|
||||||
trap 'chroot_umount' 0 1 2 15
|
trap 'chroot_umount' 0 1 2 15
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_hostconf ()
|
copy_hostconf ()
|
||||||
{
|
{
|
||||||
echo "copying mtab : /etc/mtab"
|
|
||||||
cp /etc/mtab "${working_dir}/etc/mtab"
|
cp /etc/mtab "${working_dir}/etc/mtab"
|
||||||
|
|
||||||
echo "copying resolv.conf : /etc/resolv.conf"
|
|
||||||
cp /etc/resolv.conf "${working_dir}/etc/resolv.conf"
|
cp /etc/resolv.conf "${working_dir}/etc/resolv.conf"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chroot_umount ()
|
chroot_umount ()
|
||||||
{
|
{
|
||||||
echo "cleaning up mounts"
|
|
||||||
umount "${working_dir}/proc"
|
umount "${working_dir}/proc"
|
||||||
umount "${working_dir}/sys"
|
umount "${working_dir}/sys"
|
||||||
umount "${working_dir}/dev"
|
umount "${working_dir}/dev"
|
||||||
umount "${working_dir}/var/cache/pacman"
|
umount "${working_dir}/var/cache/pacman/pkg"
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
umask 000
|
||||||
if [ "$RUN" != "" ]; then
|
if [ "$RUN" != "" ]; then
|
||||||
# run chroot {{{
|
# run chroot {{{
|
||||||
#Sanity check
|
#Sanity check
|
||||||
@@ -119,7 +116,6 @@ if [ "$RUN" != "" ]; then
|
|||||||
chroot_mount
|
chroot_mount
|
||||||
copy_hostconf
|
copy_hostconf
|
||||||
|
|
||||||
echo "starting chroot ($RUN)"
|
|
||||||
chroot "${working_dir}" ${RUN}
|
chroot "${working_dir}" ${RUN}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
@@ -143,12 +139,7 @@ else
|
|||||||
pacargs="$pacargs --config=${pac_conf}"
|
pacargs="$pacargs --config=${pac_conf}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -ne 0 ]; then
|
||||||
echo "no packages to install"
|
|
||||||
else
|
|
||||||
echo "installing packages:"
|
|
||||||
for i in $@; do echo -e "\t$i"; done
|
|
||||||
|
|
||||||
op="-Sy"
|
op="-Sy"
|
||||||
if [ "$FORCE" = "y" ]; then
|
if [ "$FORCE" = "y" ]; then
|
||||||
op="${op}f"
|
op="${op}f"
|
||||||
@@ -160,22 +151,18 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "${working_dir}/lib/modules" ]; then
|
if [ -d "${working_dir}/lib/modules" ]; then
|
||||||
echo "running ldconfig"
|
|
||||||
ldconfig -r "${working_dir}"
|
ldconfig -r "${working_dir}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$pac_conf" != "" -a "$NOCOPY" = "n" ]; then
|
if [ "$pac_conf" != "" -a "$NOCOPY" = "n" ]; then
|
||||||
echo "installing custom pacman.conf"
|
|
||||||
cp ${pac_conf} ${working_dir}/etc/pacman.conf
|
cp ${pac_conf} ${working_dir}/etc/pacman.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$makepkg_conf" != "" -a "$NOCOPY" = "n" ]; then
|
if [ "$makepkg_conf" != "" -a "$NOCOPY" = "n" ]; then
|
||||||
echo "installing custom makepkg.conf"
|
|
||||||
cp ${makepkg_conf} ${working_dir}/etc/makepkg.conf
|
cp ${makepkg_conf} ${working_dir}/etc/makepkg.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "${working_dir}/etc/locale.gen" ]; then
|
if [ -e "${working_dir}/etc/locale.gen" ]; then
|
||||||
echo "generating default locales from host system"
|
|
||||||
cp /etc/locale.gen "${working_dir}/etc/locale.gen"
|
cp /etc/locale.gen "${working_dir}/etc/locale.gen"
|
||||||
chroot "${working_dir}" locale-gen
|
chroot "${working_dir}" locale-gen
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user