Downloading XCB Utils
First, create a list of files to be downloaded:
cat > xcb-utils-list << "EOF"
xcb-util-0.4.1.tar.xz
xcb-util-image-0.4.1.tar.xz
xcb-util-keysyms-0.4.1.tar.xz
xcb-util-renderutil-0.3.10.tar.xz
xcb-util-wm-0.4.2.tar.xz
xcb-util-cursor-0.1.5.tar.xz
xcb-util-errors-1.0.1.tar.xz
EOF
To download the needed files using Wget-1.25.0, use the following commands:
mkdir xcb-utils &&
cd xcb-utils &&
grep -v '^#' ../xcb-utils-list | wget -i- -c \
-B https://xcb.freedesktop.org/dist/
Installation of XCB Utils
Note
When installing multiple packages in a script, the installation
needs to be done as the root user. There are three general
options that can be used to do this:
-
Run the entire script as the root user (not recommended).
-
Use the sudo
command from the sudo package.
-
Use su -c "command
arguments" (quotes required) which will ask
for the root password for every iteration of the loop.
One way to handle this situation is to create a short
bash function that
automatically selects the appropriate method. Once the command is
set in the environment, it does not need to be set again.
as_root()
{
if [ $EUID = 0 ]; then $*
elif [ -x /usr/bin/sudo ]; then sudo $*
else su -c \\"$*\\"
fi
}
export -f as_root
First, start a subshell that will exit on error:
bash -e
Install all of the packages by running the following commands:
for package in $(grep -v '^#' ../xcb-utils-list)
do
packagedir=${package%.tar.?z*}
tar -xf $package
pushd $packagedir
./configure $XORG_CONFIG
make
as_root make install
popd
rm -rf $packagedir
done
Finally, exit the shell that was started earlier:
exit