Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quick and simple shell script for updating lib32-qt4 in Arch Linux.
#!/bin/bash
# Based on the directions here: https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot
# This will take a while to build, with most of the time spent on QT4. There is some redundancy with creating
# multiple clean chroots, but I think this approach is easier and more reliable for most systems.
# Specify a build directory. Defaults to /tmp:
BUILDDIR="/tmp"
# Install devtools if it's not already installed:
if [ -n "$(pacman -Qi devtools)" ]
then echo "devtools installed. Continuing"
else echo "devtools not installed. Installing..."; sudo pacman -S devtools
fi
# Install git if it's not already installed:
if [ -n "$(pacman -Qi git)" ]
then echo "git installed. Continuing"
else echo "git not installed. Installing..."; sudo pacman -S git
fi
# Build the packages in /tmp by default:
echo "Moving to $BUILDDIR"
cd $BUILDDIR
# Build lib32-libmng:
echo "Building lib32-libmng (dependency)..."
if [ ! -d "lib32-libmng" ]; then
# No lib32-libmng directory, so we clone the repo
git clone https://aur.archlinux.org/lib32-libmng.git
cd lib32-libmng
else
# lib32-libmng dir exists, so cd and make sure the repo is up to date
cd lib32-libmng
git pull
fi
# Build the package in a clean chroot, then record the full package name:
multilib-build -c
LIBMNG_PKGNAME=$(ls -lAh | egrep 'pkg\.tar\.xz$' | sed -r 's/.*(lib32-.*)/\1/')
cd $BUILDDIR
## Build lib32-openssl-1.0:
#echo "Building lib32-openssl-1.0 (dependency)..."
#if [ ! -d "lib32-openssl-1.0" ]; then
# # No lib32-openssl-1.0 directory, so we clone the repo
# git clone https://aur.archlinux.org/lib32-openssl-1.0.git
# cd lib32-openssl-1.0
#else
# # lib32-openssl-1.0 dir exists, so cd and make sure the repo is up to date
# cd lib32-openssl-1.0
# git pull
#fi
## Build the package in a clean chroot, then record the full package name:
#multilib-build -c
#OPENSSL_PKGNAME=$(ls -lAh | egrep 'pkg\.tar\.xz$' | sed -r 's/.*(lib32-.*)/\1/')
#cd $BUILDDIR
# Finally, build lib32-qt4:
echo "Building lib32-qt4 (main package)..."
if [ ! -d "lib32-qt4" ]; then
git clone https://aur.archlinux.org/lib32-qt4.git
cd lib32-qt4
else
cd lib32-qt4
git pull
fi
# Build in a clean chroot, but use the clean packages we just built.
# This line is recommended by the maintainer of the lib32-qt4 package:
multilib-build -c -- -I $BUILDDIR/lib32-libmng/$LIBMNG_PKGNAME #-I $BUILDDIR/lib32-openssl-1.0/$OPENSSL_PKGNAME
QT4_PKGNAME=$(ls -lAh | egrep 'pkg\.tar\.xz$' | sed -r 's/.*(lib32-.*)/\1/')
# Install it:
echo "Installing lib32-qt4"
sudo pacman -U $QT4_PKGNAME
echo "Successfully installed $QT4_PKGNAME."
@JohnRobson

This comment has been minimized.

Copy link

commented Jun 4, 2017

THANK YOU, works perfectly.

  • I recommend not using BUILDDIR="/tmp" because most machines use tmp on Memory. I used BUILDDIR="/var/cache/tmp"

  • I unmounted "/var/lib/archbuild/multilib-x86_64/root" to continue running the script, maybe you should add "unmount" command. Check below:

$ multilib-build -c -- -I $BUILDDIR/lib32-libmng/$LIBMNG_PKGNAME #-I $BUILDDIR/lib32-openssl-1.0/$OPENSSL_PKGNAME
==> Creating chroot for [multilib] (x86_64)...
-> Deleting chroot copy 'root'...
rm: cannot remove '/var/lib/archbuild/multilib-x86_64/root': Device or resource busy
rm: cannot remove '/var/lib/archbuild/multilib-x86_64/root': Device or resource busy
==> ERROR: Working directory '/var/lib/archbuild/multilib-x86_64/root' already exists
==> ERROR: Aborting...

$ sudo \rm -rf /var/lib/archbuild/multilib-x86_64/root
rm: cannot remove '/var/lib/archbuild/multilib-x86_64/root': Device or resource busy

$ sudo umount /var/lib/archbuild/multilib-x86_64/root
$ sudo \rm -rf /var/lib/archbuild/multilib-x86_64/root

@JohnRobson

This comment has been minimized.

Copy link

commented Jun 5, 2017

`#!/bin/bash

lib32-qt4 & qtwebkit

Based on the directions here: https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot

This will take a while to build, with most of the time spent on QT4. There is some redundancy with creating

multiple clean chroots, but I think this approach is easier and more reliable for most systems.

Specify a build directory. Defaults to /tmp:

BUILDDIR="/tmp"

Install devtools if it's not already installed:

if [ -n "$(pacman -Qi devtools)" ]
then echo "devtools installed. Continuing"
else echo "devtools not installed. Installing..."; sudo pacman -S devtools
fi

Install git if it's not already installed:

if [ -n "$(pacman -Qi git)" ]
then echo "git installed. Continuing"
else echo "git not installed. Installing..."; sudo pacman -S git
fi

Build the packages in /tmp by default:

echo "Moving to $BUILDDIR"
cd $BUILDDIR

Build lib32-libmng:

echo "Building lib32-libmng (dependency)..."
if [ ! -d "lib32-libmng" ]; then

No lib32-libmng directory, so we clone the repo

git clone https://aur.archlinux.org/lib32-libmng.git
cd lib32-libmng
else

lib32-libmng dir exists, so cd and make sure the repo is up to date

cd lib32-libmng
git pull
fi

Build the package in a clean chroot, then record the full package name:

multilib-build -c
LIBMNG_PKGNAME=$(ls -lAh | egrep 'pkg.tar.xz$' | sed -r 's/.(lib32-.)/\1/')
cd $BUILDDIR

Build lib32-openssl-1.0:

#echo "Building lib32-openssl-1.0 (dependency)..."
#if [ ! -d "lib32-openssl-1.0" ]; then

# No lib32-openssl-1.0 directory, so we clone the repo

git clone https://aur.archlinux.org/lib32-openssl-1.0.git

cd lib32-openssl-1.0

#else

# lib32-openssl-1.0 dir exists, so cd and make sure the repo is up to date

cd lib32-openssl-1.0

git pull

#fi

Build the package in a clean chroot, then record the full package name:

#multilib-build -c
#OPENSSL_PKGNAME=$(ls -lAh | egrep 'pkg.tar.xz$' | sed -r 's/.(lib32-.)/\1/')
#cd $BUILDDIR

Finally, build lib32-qt4:

echo "Building lib32-qt4 (main package)..."
if [ ! -d "lib32-qt4" ]; then
git clone https://aur.archlinux.org/lib32-qt4.git
cd lib32-qt4
else
cd lib32-qt4
git pull
fi

Build in a clean chroot, but use the clean packages we just built.

This line is recommended by the maintainer of the lib32-qt4 package:

sudo umount /var/lib/archbuild/multilib-x86_64/root
#sudo \rm -rf /var/lib/archbuild/multilib-x86_64/root

multilib-build -c -- -I $BUILDDIR/lib32-libmng/$LIBMNG_PKGNAME #-I $BUILDDIR/lib32-openssl-1.0/$OPENSSL_PKGNAME
PKGNAME=$(ls -lAh | egrep 'pkg.tar.xz$' | sed -r 's/.(lib32-.)/\1/')

Install it:

echo "Installing lib32-qt4"
sudo pacman -U $PKGNAME
sudo \rm -rf /var/lib/archbuild/*

echo "Successfully installed $PKGNAME."

Finally, build qtwebkit:

echo "Building qtwebkit (main package)..."
if [ ! -d "qtwebkit" ]; then
#git clone https://aur.archlinux.org/qtwebkit.git
#cd qtwebkit
git clone https://github.com/WoefulDerelict/PKGBUILDs.git
cd PKGBUILDs/qtwebkit
else
#cd qtwebkit
cd PKGBUILDs/qtwebkit
git pull
fi

Build in a clean chroot, but use the clean packages we just built.

This line is recommended by the maintainer of the qtwebkit package:

#multilib-build -c -- -I $BUILDDIR/lib32-libmng/$LIBMNG_PKGNAME
extra-x86_64-build -c makechrootpkg -c -r $CHROOT

PKGNAME=$(ls -lAh | egrep 'pkg.tar.xz$' | sed -r 's/.(lib32-.)/\1/')

Install it:

echo "Installing qtwebkit"
sudo pacman -U $PKGNAME
sudo \rm -rf /var/lib/archbuild/*

echo "Successfully installed $PKGNAME."
`

@benoliver999

This comment has been minimized.

Copy link

commented Jun 13, 2017

Great script, massive timesaver for a process that has quickly become a pain in the arse! I can't even remember why I need the package, which is a pretty sad situation...

Anyway one note, I had to add the PGP key for libmng, currently it's 8048643BA2C840F4F92A195FF54984BFA16C640F so:

gpg --recv-keys 8048643BA2C840F4F92A195FF54984BFA16C640F

Don't take my word for it, be sure to check the PKGBUILD, it's listed under validpgpkeys=()

@lockheed

This comment has been minimized.

Copy link

commented Jun 29, 2017

Doesn't work for me. It stops on:

:: Running post-transaction hooks...
(1/2) Updating the info directory file...
(2/2) Rebuilding certificate stores...
Initializing machine ID from random generator.
Generating locales...
en_US.UTF-8... done
de_DE.UTF-8... done
Generation complete.
==> Building in chroot for [multilib] (x86_64)...
==> Creating clean working copy [juha]...done
cp: -r not specified; omitting directory '/tmp/lib32-libmng/'
error: no targets specified (use -h for help)
rm: missing operand
Try 'rm --help' for more information.
==> Making package: lib32-qt4 4.8.7-13 (Thu Jun 29 09:46:51 CEST 2017)
==> Retrieving sources...
-> Found qt-everywhere-opensource-src-4.8.7.tar.gz
-> Found improve-cups-support.patch
-> Found moc-boost-workaround.patch
-> Found kubuntu_14_systemtrayicon.diff
-> Found kde4-settings.patch
-> Found glib-honor-ExcludeSocketNotifiers-flag.diff
-> Found disable-sslv3.patch
-> Found l-qclipboard_fix_recursive.patch
-> Found l-qclipboard_delay.patch
-> Found qt4-gcc6.patch
-> Found qt4-glibc-2.25.patch
-> Found qt4-icu59.patch
-> Found qt4-openssl-1.1.patch
==> Validating source files with sha512sums...
qt-everywhere-opensource-src-4.8.7.tar.gz ... Passed
improve-cups-support.patch ... Passed
moc-boost-workaround.patch ... Passed
kubuntu_14_systemtrayicon.diff ... Passed
kde4-settings.patch ... Passed
glib-honor-ExcludeSocketNotifiers-flag.diff ... Passed
disable-sslv3.patch ... Passed
l-qclipboard_fix_recursive.patch ... Passed
l-qclipboard_delay.patch ... Passed
qt4-gcc6.patch ... Passed
qt4-glibc-2.25.patch ... Passed
qt4-icu59.patch ... Passed
qt4-openssl-1.1.patch ... Passed
==> Making package: lib32-qt4 4.8.7-13 (Thu Jun 29 09:46:52 CEST 2017)
==> Checking runtime dependencies...
==> Installing missing dependencies...
:: There are 3 providers available for lib32-libgl:
:: Repository multilib

  1. lib32-libglvnd 2) lib32-nvidia-304xx-utils 3) lib32-nvidia-340xx-utils

Enter a number (default=1):
error: target not found: lib32-libmng
==> ERROR: 'pacman' failed to install missing dependencies.
==> ERROR: Build failed, check /var/lib/archbuild/multilib-x86_64/juha/build
Installing lib32-qt4
error: no targets specified (use -h for help)
Successfully installed .

@mk0lev

This comment has been minimized.

Copy link

commented Jul 7, 2017

@lockheed It is because the current PGP key for lib32-libmng is 8048643BA2C840F4F92A195FF54984BFA16C640F. So, just follow benoliver999's instructions, which are right above your comment.

@lockheed

This comment has been minimized.

Copy link

commented Jul 7, 2017

@mk0lev, I have tried it before posting, but it does not work:

$ gpg --recv-keys 8048643BA2C840F4F92A195FF54984BFA16C640F
gpg: keyserver receive failed: Connection refused

@atasoglou

This comment has been minimized.

Copy link

commented Dec 15, 2017

I get this error:

make[1]: *** [Makefile:14643: .obj/release-shared/qlocale_icu.o] Error 1
make[1]: Leaving directory '/build/lib32-qt4/src/qt-everywhere-opensource-src-4.8.7/src/corelib'
make: *** [Makefile:206: sub-corelib-make_default-ordered] Error 2
==> ERROR: A failure occurred in build().
Aborting...
==> ERROR: Build failed, check /var/lib/archbuild/multilib-x86_64/tanasaki/build
Installing lib32-qt4
error: no targets specified (use -h for help)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.