summaryrefslogtreecommitdiffstats
path: root/remote/tools
diff options
context:
space:
mode:
authorSimon Rettberg2013-02-21 22:24:35 +0100
committerSimon Rettberg2013-02-21 22:24:35 +0100
commit9804c991491e7f2ea9da3b4c9210595a3d336dfd (patch)
treea060a1f8bc2b7bb953b4182181caceb1f928f0c7 /remote/tools
parentMerge branch 'master' of ssh://openslx/openslx-ng/tm-scripts (diff)
downloadtm-scripts-9804c991491e7f2ea9da3b4c9210595a3d336dfd.tar.gz
tm-scripts-9804c991491e7f2ea9da3b4c9210595a3d336dfd.tar.xz
tm-scripts-9804c991491e7f2ea9da3b4c9210595a3d336dfd.zip
1. New logging/output system - use functions provided by helper/logging.inc
2. Update modules to use new logging system - already updated policykit and systemd as an example 3. Stop all processing if a critical error occurs (use perror to notify user) 4. Some minor tweaks and fixes to setup_tools (added more error checking, but still incomplete)
Diffstat (limited to 'remote/tools')
-rw-r--r--remote/tools/policykit/policykit.build54
-rw-r--r--remote/tools/systemd/systemd.build32
2 files changed, 43 insertions, 43 deletions
diff --git a/remote/tools/policykit/policykit.build b/remote/tools/policykit/policykit.build
index db216f22..871025a1 100644
--- a/remote/tools/policykit/policykit.build
+++ b/remote/tools/policykit/policykit.build
@@ -2,13 +2,8 @@
fetch_source () {
- if [ ! -e .fetched_source ]; then
- [ ! -d src ] && mkdir src
- wget $URL
- tar xfz $VERSION.tar.gz -C src/
- rm $VERSION.tar.gz
- touch .fetched_source
- fi
+ [ ! -e .fetched_source ] && download_untar "$URL" "src/"
+ touch .fetched_source
}
install_dependencies() {
@@ -21,32 +16,41 @@ build () {
if [ ! -e .built ]; then
cd src/$VERSION
- [ ! -d ${TOOL_DIR}/systemd/build ] && echo "[$TOOL] systemd build directory not found Build it first. Exiting." && exit 1
-
- export LIBSYSTEMD_LOGIN_LIBS="-L${TOOL_DIR}/systemd/build/usr/lib/"
- export LIBSYSTEMD_LOGIN_CFLAGS="-I${TOOL_DIR}/systemd/build/usr/include -I${TOOL_DIR}/systemd/build/usr/include/systemd -lsystemd-login -lsystemd-daemon"
- ./configure --enable-libsystemd-login=yes --with-systemdsystemunitdir=/etc/systemd/system -prefix="/" --datarootdir="/usr/share"
-
- make
- [ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR
- DESTDIR=$BUILDDIR make install
+ [ ! -d "${TOOL_DIR}/systemd/build" ] && perror "systemd build directory not found. Build it first."
+ pinfo "configuring..."
+ LIBSYSTEMD_LOGIN_LIBS="-L${TOOL_DIR}/systemd/build/usr/lib/" \
+ LIBSYSTEMD_LOGIN_CFLAGS="-I${TOOL_DIR}/systemd/build/usr/include -I${TOOL_DIR}/systemd/build/usr/include/systemd -lsystemd-login -lsystemd-daemon" \
+ ./configure --enable-libsystemd-login=yes --with-systemdsystemunitdir=/etc/systemd/system -prefix="/" --datarootdir="/usr/share" --enable-man-pages=no --enable-gtk-doc-html=no --enable-examples=no --enable-static=no
+ pinfo "calling make..."
+ make || perror "make failed."
+ [ ! -d "$BUILDDIR" ] && mkdir -p "$BUILDDIR"
+ pinfo "installing to $BUILDDIR..."
+ DESTDIR="$BUILDDIR" make install || perror "make install failed..."
COPYLIST="list_dpkg_output"
- [ -e $COPYLIST ] && rm $COPYLIST
+ [ -e "$COPYLIST" ] && rm "$COPYLIST"
+ touch "$COPYLIST"
+ pinfo "determining required packages..."
if [ ! -z ${REQUIRED_PACKAGES} ]
then
- for PACKAGE in ${REQUIRED_PACKAGES}
+ for PACKAGE in ${REQUIRED_PACKAGES}
do
for FILE in $(dpkg -L ${PACKAGE} | grep -v share/doc | grep -v share/man)
do
- [ ! -d $FILE ] && echo $FILE >> $COPYLIST
+ [ ! -d $FILE ] && echo $FILE >> "$COPYLIST"
done
done
# prepare target dir & copy there
- [ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR
- tar -cpv $(cat $COPYLIST|sort -u) | tar -xpv -C $BUILDDIR
+ if [ -s "$COPYLIST" ]; then
+ pinfo "using tar to copy all dependencies to $BUILDDIR"
+ tar -cpv $(cat $COPYLIST|sort -u) | tar -xpv -C $BUILDDIR
+ local RET=$?
+ [ $RET -ne 0 ] && perror "copy failed."
+ else
+ pinfo "no dependencies found!"
+ fi
fi
cd -
@@ -58,11 +62,7 @@ build () {
post_copy() {
#Add Polkit User/Group/Shadow to Stage3.2
- local RET=$(add_user polkitd)
- if ! [[ $RET ~= [0-9]+ ]]
- then
- echo "USERADD FAILED: $RET" 1>&2
- exit 1
- fi
+ pinfo "Adding polkitd user to target system..."
+ add_user "polkitd"
}
diff --git a/remote/tools/systemd/systemd.build b/remote/tools/systemd/systemd.build
index c5a9a86c..7d9588c0 100644
--- a/remote/tools/systemd/systemd.build
+++ b/remote/tools/systemd/systemd.build
@@ -1,13 +1,8 @@
#tool/distro specific functions for fetching, building and installing dependencies
fetch_source () {
- if [ ! -e .fetched_source ]; then
- [ ! -d src ] && mkdir src
- wget $URL
- tar xJf $VERSION.tar.xz -C src/
- rm $VERSION.tar.xz
- touch .fetched_source
- fi
+ [ ! -e .fetched_source ] && download_untar "$URL" "src/"
+ touch .fetched_source
}
install_dependencies() {
@@ -20,6 +15,7 @@ install_dependencies() {
# apt-get update --force-yes
#fi
# install libkmod from source
+ # TODO: Use download_untar
local libkmodversion=kmod-12
if [ ! -d $libkmodversion ]; then
wget http://www.kernel.org/pub/linux/utils/kernel/kmod/${libkmodversion}.tar.gz
@@ -32,24 +28,27 @@ install_dependencies() {
cd -
fi
- apt-get install -y $DEPS &>/dev/null
+ apt-get install -y $DEPS
}
build () {
if [ ! -e .built ]; then
- cd src/$VERSION
- ./configure --disable-manpages --enable-split-usr --sysconfdir="/etc"
- make -j5
- [ ! -d $TOOL_DIR/$TOOL/build ] && mkdir -p $TOOL_DIR/$TOOL/build
- DESTDIR=$TOOL_DIR/$TOOL/build make install
+ cd "src/$VERSION/"
+ pinfo "calling configure"
+ ./configure --disable-manpages --enable-split-usr --sysconfdir="/etc" --enable-gtk-doc-html=no || perror "configure failed."
+ pinfo "calling make"
+ make -j5 || perror "make failed."
+ mkdir -p $TOOL_DIR/$TOOL/build
+ pinfo "calling make install"
+ DESTDIR=$TOOL_DIR/$TOOL/build make install || perror "make install failed."
cd -
- touch .built
+ touch .built
fi
}
post_copy() {
# copy static data files
- cp -r $TOOL_DIR/$TOOL/data/* $INIT_DIR
+ cp -r $TOOL_DIR/$TOOL/data/* $INIT_DIR || perror "copying data files failed."
# dont clear systemd log at startup
sed -i.bak "s/TTYVTDisallocate=yes/TTYVTDisallocate=no/g" $INIT_DIR/usr/lib/systemd/system/getty@.service
@@ -61,5 +60,6 @@ post_copy() {
fi
# add nfs to modules-load list
- echo "nfs" > $INIT_DIR/etc/modules-load.d/nfs.conf
+ echo "nfs" > "$INIT_DIR/etc/modules-load.d/nfs.conf"
}
+