From be2c4f5e6bf5ea5423ae9abd6bc1dcc3491bd3ca Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 20 Oct 2014 19:00:16 +0000
Subject: update81-82.sh: add warning if R8.2 pkgs are not found in repo

check /sbin and /usr/sbin if symlinks
---
 abs/core/update81-82.sh | 55 +++++++++++++++++++++++++++++++++----------------
 1 file changed, 37 insertions(+), 18 deletions(-)

diff --git a/abs/core/update81-82.sh b/abs/core/update81-82.sh
index 60c1a02..8967549 100644
--- a/abs/core/update81-82.sh
+++ b/abs/core/update81-82.sh
@@ -7,7 +7,7 @@
 echo ""
 echo "About to update the OS to LinHES 8.2"
 echo "This process will only work if currently running LinHES 8.1 or later"
-echo "*  Please respond with Y to all the yes/no questions"
+echo "*  Please respond with Y to ALL the yes/no questions"
 echo "*  Answer Y to remove sysvinit"
 echo "*  If prompted about libgl, select the gl that is appropiate for your system"
 echo ""
@@ -17,15 +17,31 @@ echo "Press Y to continue, any other key to stop"
 read a
 if [ x$a != "xY" ]
 then
-  echo " Y NOT selected, exiting"
-  exit 3
+    echo " Y NOT selected, exiting"
+    exit 3
 fi
 
 
+pacman -Ssyy LinHES-system | awk '{print $2}' | grep -q "8.2-"
+pr=$?
+if [ $pr != 0 ]
+then
+    echo ""
+    echo "WARNING! The current repos in /etc/pacman.conf do not look like they"
+    echo "         contain packages for LinHES 8.2."
+    echo "Press Y to continue (not recommended), any other key to stop"
+
+    read ans
+    if [ x$ans != "xY" ]
+    then
+        echo " Y NOT selected, exiting"
+        exit 3
+    fi
+fi
 
 
 
-echo "Downloading filesystem and glibc for later use, please wait"
+echo "Downloading filesystem and glibc for later use, please wait..."
 curl -o filesystem-itermediate.pkg.tar.xz http://linhes.org/repo/x86_64/filesystem-itermediate.pkg.tar.xz
 rc=$?
 if [ $rc != 0 ]
@@ -47,35 +63,39 @@ else
 fi
 
 
+pacman -S --noconfirm tdb
 
-
-pacman -Sy --noconfirm tdb
-echo "Removing select symlinks and files not in poweroff-scripts package "
+echo "Removing select symlinks and files not in poweroff-scripts package..."
 
 rm -f /usr/lib/libtalloc.so.1
 rm -f /usr/lib/libtalloc.so.2
 
-rm -f /usr/sbin/re*
-rm -f /usr/sbin/pow*
-rm -f /usr/sbin/hal*
-rm -f /sbin/re*
-rm -f /sbin/pow*
-rm -f /sbin/hal*
+if [ -L /usr/sbin ]
+then
+    rm -f /usr/sbin/reb*
+    rm -f /usr/sbin/pow*
+    rm -f /usr/sbin/hal*
+fi
 
+if [ -L /sbin ]
+then
+    rm -f /sbin/reb*
+    rm -f /sbin/pow*
+    rm -f /sbin/hal*
+fi
 
+
+echo "Updating packages..."
 pacman -Syu --ignore filesystem,bash,glibc
 pacman -R tcp_wrappers  --noconfirm
 pacman -S bash --noconfirm
 
 
-
-
-
 pacman -U ./glibc-2.18-11-x86_64.pkg.tar.xz ./filesystem-itermediate.pkg.tar.xz --noconfirm
 rc=$?
 if [ $rc != 0 ]
 then
-  echo "Filesystem update was unable to install"
+  echo "Filesystem-itermediate update was unable to install"
   echo "Please check /bin /usr/sbin /sbin "
   echo "for packages that need to be updated"
   exit 2
@@ -104,4 +124,3 @@ else
   echo "upgrade was a success"
   echo "please reboot"
 fi
-
-- 
cgit v0.12

