summaryrefslogtreecommitdiffstats
path: root/helper/fileutil.inc
diff options
context:
space:
mode:
authorSimon Rettberg2013-03-19 19:41:43 +0100
committerSimon Rettberg2013-03-19 19:41:43 +0100
commitf0a83930511654544f8c821768722cd2f2592e1c (patch)
treee348e074f13bbc22519fb8607e35767af98845f2 /helper/fileutil.inc
parentMerge branch 'master' of ssh://openslx/openslx-ng/tm-scripts (diff)
downloadtm-scripts-f0a83930511654544f8c821768722cd2f2592e1c.tar.gz
tm-scripts-f0a83930511654544f8c821768722cd2f2592e1c.tar.xz
tm-scripts-f0a83930511654544f8c821768722cd2f2592e1c.zip
Tweak modules to work with openSUSE 12.1
Diffstat (limited to 'helper/fileutil.inc')
-rw-r--r--helper/fileutil.inc10
1 files changed, 5 insertions, 5 deletions
diff --git a/helper/fileutil.inc b/helper/fileutil.inc
index 19c9dd93..dbcbf8e9 100644
--- a/helper/fileutil.inc
+++ b/helper/fileutil.inc
@@ -21,7 +21,7 @@ tarcopy () {
return
fi
local SHORT=$FROM
- [ ${#SHORT} -gt 23 ] && SHORT=$(echo "$SHORT" | cut -c-18)...$(echo "$SHORT" | cut -c$[${#SHORT} - 4]-)
+ [ ${#SHORT} -gt 30 ] && SHORT=$(echo "$SHORT" | sed ':a;N;$!ba;s/\n/ /g' | cut -c-25)...$(echo "$SHORT" | cut -c$[${#SHORT} - 4]-)
[ -z "$TO" ] && perror "tarcopy called with empty destination."
[ ! -d "$TO" ] && { mkdir -p "$TO" || perror "could not create destination "$TO" for tar-copy."; }
tar -cp $FROM | tar -xp -C "$TO"
@@ -36,16 +36,16 @@ list_packet_files() {
for PACKAGE in $REQUIRED_PACKAGES; do
local FILES=""
if [ "$PACKET_MANAGER" = "apt" ]; then
- FILES="$(dpkg -L "$PACKAGE" | grep -v share/doc | grep -v share/man; echo ":###:${PIPESTATUS[0]}")"
+ FILES="$(dpkg -L "$PACKAGE" | grep -v -E 'share/(man|doc)|/var/run|/var/log'; echo ":###:${PIPESTATUS[0]}")"
elif [ "$PACKET_MANAGER" = "zypper" ]; then
- FILES="$(rpm -ql "$PACKAGE" | grep -v share/doc | grep -v share/man; echo ":###:${PIPESTATUS[0]}")"
+ FILES="$(rpm -ql "$PACKAGE" | grep -v -E 'share/(doc|man)|/var/run|/var/log' | grep -v share/man; echo ":###:${PIPESTATUS[0]}")"
fi
# ugly hack to get our return value
#local LPRET=$(echo "$FILES" | tail -1 | sed 's/^.*:###:\([0-9]*\)$/\1/g')
#FILES=$(echo "$FILES" | sed 's/^\(.*\):###:[0-9]*$/\1/g')
local LPRET=$(echo "$FILES" | awk -F ':###:' '{printf $2}')
FILES=$(echo "$FILES" | awk -F ':###:' '{print $1}')
- [ "x$LPRET" != "x0" ] && pwarning "dpkg/rpm exited with code '$LPRET' for packet ${PACKAGE}."
+ [ "x$LPRET" != "x0" ] && pwarning "dpkg/rpm exited with code '$LPRET' for packet ${PACKAGE}." && return 1
[ -z "$FILES" ] && pwarning "list_packet_files empty for packet ${PACKAGE}."
for FILE in $FILES; do
[ ! -d "$FILE" ] && echo "$FILE"
@@ -60,7 +60,7 @@ install_dependencies() {
if [ "$PACKET_MANAGER" = "apt" ]; then
apt-get install -y $REQUIRED_DEPENDENCIES || perror "Could not apt-get install $REQUIRED_DEPENDENCIES"
elif [ "$PACKET_MANAGER" = "zypper" ]; then
- zypper install -n $REQUIRED_DEPENDENCIES || perror "Could not zypper install $REQUIRED_DEPENDENCIES"
+ zypper --no-refresh install -y -n $REQUIRED_DEPENDENCIES || perror "Could not zypper install $REQUIRED_DEPENDENCIES"
fi
}
#