mirror of
https://github.com/sbopkg/sbopkg
synced 2025-02-10 20:47:56 +01:00
modify the 'check for update to sbopkg' code to show a different message if running from svn; also, if not running from svn, and it finds an updated package, offer to download the updated package; this is a precursor to having sbopkg update itself -- for now, it just downloads the updated package to OUTPUT.
This commit is contained in:
parent
395954a76e
commit
b3f8c90ba9
1 changed files with 51 additions and 2 deletions
|
@ -1683,6 +1683,10 @@ check_for_latest () {
|
||||||
ORIGSCR=http://www.sbopkg.org/version.php
|
ORIGSCR=http://www.sbopkg.org/version.php
|
||||||
CVRS=$SBOVER
|
CVRS=$SBOVER
|
||||||
NVRS=$(wget -T 10 -q -O - ${ORIGSCR})
|
NVRS=$(wget -T 10 -q -O - ${ORIGSCR})
|
||||||
|
SBOPKGUP=""
|
||||||
|
NEWPKG=http://www.sbopkg.org/pkg.php
|
||||||
|
NEWSBOPKG=$(wget -T 10 -q -O - ${NEWPKG})
|
||||||
|
NEWDLPKG=http://sbopkg.googlecode.com/files/$NEWSBOPKG
|
||||||
if [ -z "$CVRS" -o -z "$NVRS" ]; then
|
if [ -z "$CVRS" -o -z "$NVRS" ]; then
|
||||||
if [ -z "$NVRS" ]; then
|
if [ -z "$NVRS" ]; then
|
||||||
MSG="Cannot determine if there is an update \
|
MSG="Cannot determine if there is an update \
|
||||||
|
@ -1690,8 +1694,19 @@ since the remote version cannot be retrieved. \
|
||||||
Please try again later."
|
Please try again later."
|
||||||
fi
|
fi
|
||||||
elif [ "$CVRS" != "$NVRS" ]; then
|
elif [ "$CVRS" != "$NVRS" ]; then
|
||||||
MSG="Different versions reported. Please check http://\
|
if $(echo $CVRS | grep -q "svn_r"); then
|
||||||
www.sbopkg.org for an updated release."
|
MSG="You are running sbopkg from SVN and not using a regular \
|
||||||
|
package. Therefore, package versions cannot be compared."
|
||||||
|
else
|
||||||
|
SBOPKGUP=1
|
||||||
|
if [ "$DIAG" = 1 ]; then
|
||||||
|
MSG="Different versions reported. Press <Ok> to \
|
||||||
|
continue."
|
||||||
|
else
|
||||||
|
MSG="Different versions reported. Press (Y)es to \
|
||||||
|
download the update package or press (N)o to quit."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
elif [ "$CVRS" == "$NVRS" ]; then
|
elif [ "$CVRS" == "$NVRS" ]; then
|
||||||
MSG="It appears your version of sbopkg is up to date."
|
MSG="It appears your version of sbopkg is up to date."
|
||||||
fi
|
fi
|
||||||
|
@ -1699,6 +1714,28 @@ if [ "$DIAG" = 1 ]; then
|
||||||
dialog --title "Done" --msgbox "Checking http://www.sbopkg.org \
|
dialog --title "Done" --msgbox "Checking http://www.sbopkg.org \
|
||||||
for an update...\n\nYour version of sbopkg: $CVRS\n\nLatest version \
|
for an update...\n\nYour version of sbopkg: $CVRS\n\nLatest version \
|
||||||
of sbopkg found on sbopkg.org: $NVRS\n\n$MSG" 16 40
|
of sbopkg found on sbopkg.org: $NVRS\n\n$MSG" 16 40
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if [ "$SBOPKGUP" = 1 ]; then
|
||||||
|
NEWPKG=http://www.sbopkg.org/pkg.php
|
||||||
|
NEWSBOPKG=$(wget -T 10 -q -O - ${NEWPKG})
|
||||||
|
NEWDLPKG=http://sbopkg.googlecode.com/files/$NEWSBOPKG
|
||||||
|
dialog --title "Download new package?" --yesno "Would you like to
|
||||||
|
download the new sbopkg package:\n\n$NEWSBOPKG\n\nThe new sbopkg package
|
||||||
|
will saved to your OUTPUT directory: $OUTPUT" 13 50
|
||||||
|
W=$?
|
||||||
|
if [ $W = 0 ]; then
|
||||||
|
cd $OUTPUT
|
||||||
|
wget $WGETFLAGS $NEWDLPKG
|
||||||
|
cd $LOCALREPO/$SLACKVER
|
||||||
|
if [ "$DIAG" = 1 ]; then
|
||||||
|
read -n 1 -p "Press any key to continue."
|
||||||
|
fi
|
||||||
|
elif [ $W = 1 ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "Checking http://www.sbopkg.org for an update..."
|
echo "Checking http://www.sbopkg.org for an update..."
|
||||||
|
@ -1708,6 +1745,18 @@ else
|
||||||
echo "Latest version of sbopkg found on sbopkg.org: "$NVRS
|
echo "Latest version of sbopkg found on sbopkg.org: "$NVRS
|
||||||
echo
|
echo
|
||||||
echo $MSG
|
echo $MSG
|
||||||
|
if [ "$SBOPKGUP" = 1 ]; then
|
||||||
|
read ANS
|
||||||
|
case $ANS in
|
||||||
|
y* | Y* ) cd $OUTPUT && wget $WGETFLAGS $NEWDLPKG \
|
||||||
|
&& cd $CWD
|
||||||
|
;;
|
||||||
|
n* | N* ) cleanup; exit 0
|
||||||
|
;;
|
||||||
|
* ) echo "Unknown response."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue