Removed some mirror build specific instructions.

This commit is contained in:
Anton Hvornum 2018-05-06 23:02:48 +02:00 committed by GitHub
parent 0629ed7a94
commit a584d33c2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 32 deletions

View File

@ -2,69 +2,67 @@
work_dir=$1 work_dir=$1
arch=$2 arch=$2
offline_mirror_path="/tmp/aur_offline"
# A func to download, build ... # A func to download, build ...
build_aur () { build_aur () {
old_dir=`pwd` old_dir=`pwd`
package=$1
# Prep with a build-user: # Prep with a build-user:
useradd -m -G wheel builder useradd -m -G wheel builder
sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /etc/sudoers sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /etc/sudoers
cd /tmp cd /tmp
rm -rf $1 $1.tar.gz rm -rf ${package} ${package}.tar.gz
wget "https://aur.archlinux.org/cgit/aur.git/snapshot/$1.tar.gz" wget "https://aur.archlinux.org/cgit/aur.git/snapshot/${package}.tar.gz"
tar xvzf "$1.tar.gz" tar xvzf "${package}.tar.gz"
cd $1 cd ${package}
build_dir=$(pwd) build_dir=$(pwd)
chown -R builder.builder /tmp/$1 chown -R builder.builder /tmp/${package}
echo " => Buiilding $1" echo " => Buiilding ${package}"
su - builder -c "(cd ${build_dir}; makepkg -s --noconfirm)" >/dev/null 2>&1 su - builder -c "(cd ${build_dir}; makepkg -s --noconfirm)" >/dev/null 2>&1
if [[ -n $3 ]]; then
echo " => Adding $1 to local AUR mirror" echo " => Adding ${package} to local AUR mirror"
mkdir -p $3 mkdir -p ${offline_mirror_path}
sh -c "cp *.xz $3/$1.pkg.tar.xz" sh -c "cp *.xz ${offline_mirror_path}/"
sh -c "repo-add $3/aur_offline.db.tar.gz $3/*.xz" sh -c "repo-add ${offline_mirror_path}/aur_offline.db.tar.gz ${offline_mirror_path}/*.xz"
if [[ -z $(cat ${old_dir}/packages.both | grep $1) ]]; then if [[ -z $(cat ${old_dir}/packages.both | grep ${package}) ]]; then
echo " => Adding $1 to packages.both (from AUR)" # TODO: save a copy of ${old_dir}/packages.both ONCE, if it doesn't excist already.
echo "$1" >> ${old_dir}/packages.both # This in order to revert our AUR changes which will affect a re-build.
fi echo " => Adding ${package} to packages.both (from AUR)"
echo "${package}" >> ${old_dir}/packages.both
fi fi
sh -c "mv *.xz ${old_dir}/$2/$1.pkg.tar.xz" ## Long term storage inside the ISO? (if we want to install to disk, we need to pass this along)
# sh -c "mv *.xz ${old_dir}/$2/$1.pkg.tar.xz"
cd ${old_dir} cd ${old_dir}
userdel builder userdel builder
rm -rf /home/builder rm -rf /home/builder
rm -rf /tmp/$1 rm -rf /tmp/${package}
rm /tmp/$1.tar.gz rm /tmp/${package}.tar.gz
} }
echo "Starting to sync upstream changes to mirror." echo "Starting to sync upstream changes to offline mirror."
mkdir -p ${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/x86_64
rm -rf /tmp/sync /tmp/local rm -rf /tmp/sync /tmp/local
echo " => Retrieving packages"
pacman --noconfirm --dbpath /tmp/ -Syu -w --cachedir ${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/${arch} base base-devel syslinux efitools haveged intel-ucode memtest86+ mkinitcpio-nfs-utils nbd zsh git python python-systemd nano sudo iptables dhclient dnsmasq openssh sshfs openssl openvpn gcc openvpn powerdns postgresql sqlite go c-ares http-parser libuv nodejs-less mariadb memcached bzip2 glib2 libev lua51 ragel zlib >/dev/null 2>&1
echo " => Retrieving ISO specific packages"
pacman --noconfirm --dbpath /tmp/ -Syu -w --cachedir ${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/${arch} $(cat ${work_dir}/../packages.both)
echo " => Building AUR (Adding packages to packages.both as we go along)" echo " => Building AUR (Adding packages to packages.both as we go along)"
build_aur "gogs-git" "${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/${arch}" build_aur "lighttpd2-git"
build_aur "lighttpd2-git" "${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/${arch}" "/tmp/aur_offline"
if [[ -z $(cat ${work_dir}/pacman.conf | grep '\[aur_offline\]') ]]; then if [[ -z $(cat ${work_dir}/pacman.conf | grep '\[aur_offline\]') ]]; then
echo "Adding offline mirror to build bubble" echo " => Adding offline mirror to the chroot environment"
echo "[aur_offline]" >> ${work_dir}/pacman.conf echo "[aur_offline]" >> ${work_dir}/pacman.conf
echo "Server = file:///tmp/aur_offline" >> ${work_dir}/pacman.conf echo "Server = file:///tmp/aur_offline" >> ${work_dir}/pacman.conf
echo "SigLevel = Optional TrustAll" >> ${work_dir}/pacman.conf echo "SigLevel = Optional TrustAll" >> ${work_dir}/pacman.conf
fi fi
echo " => Adding packages to offline database" ## Long term storage, if we want to be able to index our newly build files
sh -c "repo-add --new ${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/${arch}/arch_offline.db.tar.gz ${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/${arch}/*.pkg.tar.xz" >/dev/null 2>&1 ## while installing down to disk later, we need to index the AUR packages.
#echo " => Adding packages to offline database"
#sh -c "repo-add --new ${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/${arch}/arch_offline.db.tar.gz ${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/${arch}/*.pkg.tar.xz" >/dev/null 2>&1
pacman --config ${work_dir}/pacman.conf -Sy pacman --config ${work_dir}/pacman.conf -Sy
pacman -Sy pacman -Sy