From b6cf5ec58c344e22e664424a848dba2d737ebfc9 Mon Sep 17 00:00:00 2001 From: Didier Spaier Date: Sat, 6 Jan 2018 17:15:01 -0600 Subject: core-functions.sh: Warn (first time) if -current mirror is selected Require confirmation the first time a -current mirror is selected. --- files/core-functions.sh | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/files/core-functions.sh b/files/core-functions.sh index 4da06a5..f71259d 100644 --- a/files/core-functions.sh +++ b/files/core-functions.sh @@ -253,16 +253,34 @@ Before you install|upgrade|reinstall anything you need to run:\n\n\ Please edit that file and uncomment ONE mirror. Slackpkg\n\ only works with ONE mirror selected.\n" cleanup - else - COUNT=$(echo $SOURCE | wc -w | tr -d " ") - if [ "$COUNT" != "1" ]; then - echo -e "\n\ -Slackpkg only works with ONE mirror selected. Please edit your\n\ -${CONF}/mirrors and comment all but one line - two or more\n\ -mirrors uncommented is not valid syntax.\n" + fi + if echo $SOURCE|grep -q " "; then + echo " +Slackpkg only works with ONE mirror selected. Please edit your +${CONF}/mirrors and comment all but one line - two or more +mirrors uncommented is not valid syntax. +" + cleanup + fi + MIRROR_VERSION=$(echo $SOURCE|sed "s/.*-//;s/.$//") + if [ "$MIRROR_VERSION" = "current" ] && [ ! -f ${ROOT}/${WORKDIR}/current ]; then + echo -n " +You have selected a mirror for Slackware -current in ${CONF}/mirrors, +but Slackware version $SLACKWARE_VERSION appears to be installed. + +Slackware -current is the development (i.e. unstable) tree. + +Is this really what you want? + +To confirm your choice, press Y, else press N. Then, press Enter: " + read current + if [ "$current" = "Y" ] || [ "$current" = "y" ]; then + touch ${ROOT}/${WORKDIR}/current + else cleanup fi fi + [ ! "$MIRROR_VERSION" = "current" ] && rm -f ${ROOT}/${WORKDIR}/current # It will check if the mirror selected are ftp.slackware.com # if set to "ftp.slackware.com" tell the user to choose another -- cgit v1.2.3