s!/etc/slackware-release!/etc/slackware-version! (reported by bubulak)
[util-vserver.git] / util-vserver / scripts / vyum-worker
index 18f6540..922afb3 100755 (executable)
@@ -26,13 +26,39 @@ test -e "$UTIL_VSERVER_VARS" || {
 . "$UTIL_VSERVER_VARS"
 . "$_LIB_FUNCTIONS"
 
-vserver="$1"
+vserver=$1
 shift
 
 pkgInit "$vserver" rpm yum
 rpmFake.init "$vserver"
 
-rpmFake.exec ${_YUM:-yum} \
-    -c "$YUMETCDIR/yum.conf" \
+test -z "$_YUM" || {
+    warning $"The environment variable \$_YUM is not supported anymore; please use \$YUM instead of"
+    ${YUM:=$_YUM}
+}
+
+yum=${YUM:-yum}
+conf=yum.conf
+case $(yum --version) in
+    (2.[01234]*)
+       python -c 'import yum,sys; sys.exit(not hasattr(yum.config.yumconf, "getRootedPath"))' &>/dev/null || {
+           warning "\
+You are using a version of yum which is insecure and broken in chroot
+related operations; either apply the patches shipped in the 'contrib/'
+directory of util-vserver, or ask the author of yum to apply them
+(preferred).
+
+In the meantime, 'vyum' will continue with dirty hacks which might not
+work when the vserver is running and local DOS attacks are possible.
+
+Execution will continue in 5 seconds..."
+           sleep 5
+           conf=yum-hack.conf
+       }
+       ;;
+esac
+
+rpmFake.exec $yum \
+    -c "$YUMETCDIR/${YUM_CONF:-$conf}" \
     --installroot="$VDIR" \
     "$@"