GIF89a=( �' 7IAXKgNgYvYx\%wh&h}t�h%�s%x�}9�R��&�0%� (�.��5�SD��&�a)�x5��;ͣ*ȡ&ղ)ׯ7׵<ѻ4�3�H֧KͯT��Y�aq��q��F� !� ' !� NETSCAPE2.0 , =( ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g���E�������R���E����B�� ��ȸ��D���"�Ů� �H��L��D٫D�B�����D���T���H �G��A R�ڐ |�� ٭&��E8�S�kG�A�px�a��� R2XB��E8I���6X�:vT)�~��q�賥��"F~%x� � 4#Z�0O|-4Bs�X:= Q� Sal��yXJ`GȦ|s h��K3l7�B|�$'7Jީܪ0!��D�n=�P� ����0`�R�lj����v>���5 �.69�ϸd�����nlv�9��f{���Pbx �l5}�p� ��� �3a���I�O����!ܾ���i��9��#��)p�a ޽ �{�)vm��%D~ 6f��s}Œ�D�W E�`!� �&L8x� �ܝ{)x`X/>�}m��R�*|`D�=�_ ^�5 !_&'a�O�7�c��`DCx`�¥�9�Y�F���`?��"� �n@`�} lď��@4>�d S �v�xN��"@~d��=�g�s~G��� ���ud &p8Q�)ƫlXD����A~H�ySun�j���k*D�LH�] ��C"J��Xb~ʪwSt}6K,��q�S:9ت:���l�@�`�� �.۬�t9�S�[:��=`9N����{¿�A !R�:���6��x�0�_ �;������^���#����!����U���;0L1�����p% A��U̬ݵ��%�S��!���~`�G���� ���=4�np�3���������u�u�ٮ|%2�I��r�#0��J``8�@S@5� ���^`8E�]�.�S���7 � �0�j S�D� z���i�S�����!���l��w9*�D�I�nEX��� &A�Go�Qf��F��;���}�J����F5��Q|���X��T��y���]� o ��C=��:���PB@ D׽S�(>�C�x}`��xJЬ�۠��p+eE0`�}`A �/NE�� �9@��� H�7�!%B0`�l*��!8 2�%� �:�1�0E��ux%nP1�!�C)�P81l�ɸF#Ƭ{����B0>�� �b�`��O3��()yRpb��E.ZD8�H@% �Rx+%���c� ���f��b�d�`F�"8�XH"��-�|1�6iI, 2�$+](A*j� QT�o0.�U�`�R�}`�SN����yae�����b��o~ S)�y�@��3 �tT�0�&�+~L�f"�-|�~��>!�v��~�\Q1)}@�}h#aP72�"�$ !� " , =( &7IAXG]KgNgYvYxR"k\%w]'}h}t�h%�g+�s%r.m3ax3�x�}9��&��+�!7�0%� (�.�SD��&��;�"&ײ)׻4��6�K� �@pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E �� �������E �´��C���ǶR��D��"Ʒ�ʱH��M��GڬD�B����D��T����G���C�C� l&�~:'�tU�6ɹ#��)�'�.6�&��Ȼ K(8p0N�?!�2"��NIJX>R��OM '��2�*x�>#n� �@<[:�I�f ��T���Cdb��[�}E�5MBo��@�`@��tW-3 �x�B���jI�&E�9[T&$��ﯧ&"s��ȳ����dc�UUρ#���ldj?����`\}���u|3'�R]�6 �S#�!�FKL�*N E���`$�:e�YD�q�.�촁�s \-�jA 9�����-��M[�x(�s��x�|���p��}k�T�DpE@W� ��]k`1� ���Yb ��0l��*n0��"~zBd�~u�7�0Bl��0-�x~|U�U0 �h�*HS�|��e"#"?vp�i`e6^�+q��`m8 #V�� ��VS|`��"m"сSn|@:U���~`pb�G�ED����2F�I�? >�x� R� ��%~jx��<�a�9ij�2�D��&: Z`�]w���:�6��B�7eFJ|�ҧ�,���FǮcS�ʶ+B�,�ܺN���>PAD�HD��~���n��}�#�� Q��S���2�X�{�k�lQ�2�����w�|2� h9��G�,m���3��6-��E�L��I�³*K���q�`DwV�QXS��peS��� qܧTS����R�u �<�a�*At�lmE� � ��N[P1�ۦ��$��@`��Dpy�yXvCAy�B`}D� 0QwG#� �a[^�� $���Ǧ{L�"[��K�g�;�S~��GX.�goT.��ư��x���?1z��x~:�g�|�L� ��S`��0S]P�^p F<""�?!,�!N4&P� ����:T�@h�9%t��:�-~�I<`�9p I&.)^ 40D#p@�j4�ج:�01��rܼF2oW�#Z ;$Q q  �K��Nl#29 !F@�Bh�ᏬL!XF�LHKh�.�hE&J�G��<"WN!�����Y@� >R~19J"�2,/ &.GXB%�R�9B6�W]���W�I�$��9�RE8Y� ��"�A5�Q.axB�&ة�J�! �t)K%tS-�JF b�NMxL��)�R��"���6O!TH�H� 0 !� ) , =( &AXKgNgYvYxR"k\%wh&h}h%�g+�s%r.x3�x�}9��&��+�R,�!7�0%� (�.��5��&�a)��;�"&ף*Ȳ)ׯ7׻4�3��6�H֧KͻH�T��Y��q��h� ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E$����� � ����$E$��"��D� � ������R��C��� E ��H�M��G�D� �B��ϾD��a��`1r��Ӑ�� �o~�zU!L�C'�yW�UGt����ll�0���uG�)A�s[��x� �xO%��X2�  P�n:R/��aHae+�Dm?# ǣ6�8�J�x�Di�M���j���5oQ7�- <! *�l��R2r/a!l)d� A"�E���� &� ;��c �%����b��pe~C"B���H�eF2��`8qb�t_`ur`e� w�u3��Pv�h""�`�Íx�LĹ��3� �~ֺ�:���MDfJ� �۵�W�%�S�X �؁)�@��:E��w�u�Sxb8y\m�zS��Zb�E�L��w!y(>�"w�=�|��s�d �C�W)H�cC$�L �7r.�\{)@�`@ �X�$PD `aaG:���O�72E�amn]�"Rc�x�R� &dR8`g��i�xLR!�P &d����T���i�|�_ � Qi�#�`g:��:noM� :V �)p����W&a=�e�k� j���1߲s�x�W�jal|0��B0�, \j۴:6���C ��W��|��9���zĸV {�;��n��V�m�I��.��PN� ����C��+��By�ѾHŸ:��� 7�Y�FTk�SaoaY$D�S���29R�kt� ��f� ��:��Sp�3�I��DZ� �9���g��u�*3)O��[_hv ,���Et x�BH� �[��64M@�S�M7d�l�ܶ5-��U܍��z�R3Ԭ3~ ��P��5�g: ���kN�&0�j4���#{��3S�2�K�'ợl���2K{� {۶?~m𸧠�I�nE�='����^���_�=��~�#O���'���o..�Y�n��CSO��a��K��o,���b�����{�C�� "�{�K ��w��Ozdը�:$ ���v�] A#� ���a�z)Rx׿ƥ�d``�w-�y�f�K!����|��P��=�`�(f��'Pa ��BJa%��f�%`�}F����6>��`G"�}�=�!o`�^FP�ةQ�C���`(�}\�ݮ ��$<��n@dĠE#��U�I�!� #l��9`k���'Rr��Z�NB�MF �[�+9���-�wj���8�r� ,V�h"�|�S=�G_��"E� 0i*%̲��da0mVk�):;&6p>�jK ��# �D�:�c?:R Ӭf��I-�"�<�="��7�3S��c2RW ,�8(T"P0F¡Jh�" ; 403WebShell
403Webshell
Server IP : 173.249.157.85  /  Your IP : 18.117.101.130
Web Server : Apache
System : Linux server.frogzhost.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User : econtech ( 1005)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /sbin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /sbin/update-smart-drivedb
#! /bin/sh
#
# smartmontools drive database update script
#
# Home page of code is: http://www.smartmontools.org
#
# Copyright (C) 2010-18 Christian Franke
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# $Id: update-smart-drivedb.in 4879 2018-12-28 22:05:12Z chrfranke $
#

set -e

# Set by config.status
export PATH="/usr/local/bin:/usr/bin:/bin"
PACKAGE="smartmontools"
VERSION="7.0"
prefix="/usr"
exec_prefix="/usr"
sbindir="/usr/sbin"
datarootdir="${prefix}/share"
datadir="/usr/share"
drivedbdir="${datadir}/${PACKAGE}"

# Download tools
os_dltools="curl wget lynx svn"

# drivedb.h update branch
BRANCH="RELEASE_7_0_DRIVEDB"

# Default drivedb location
DRIVEDB="$drivedbdir/drivedb.h"

# GnuPG used to verify signature (disabled if empty)
GPG="gpg"

# Smartctl used for syntax check
SMARTCTL="$sbindir/smartctl"

# PATH information for help and error messages
#pathinfo='$PATH'
pathinfo="'$PATH'"

myname=$0

usage()
{
  pathinfo="
                   $pathinfo"
  cat <<EOF
smartmontools $VERSION drive database update script

Usage: $myname [OPTIONS] [DESTFILE]

  -s SMARTCTL     Use SMARTCTL for syntax check ('-s -' to disable)
                  [default: $SMARTCTL]
  -t TOOL         Use TOOL for download: $os_dltools
                  [default: first one found in $pathinfo]
  -u LOCATION     Use URL of LOCATION for download:
                    github (GitHub mirror of SVN repository)
                    sf (Sourceforge code browser)
                    svn (SVN repository) [default]
                    svni (SVN repository via HTTP instead of HTTPS)
                    trac (Trac code browser)
  --trunk         Download from SVN trunk (may require '--no-verify')
  --cacert FILE   Use CA certificates from FILE to verify the peer
  --capath DIR    Use CA certificate files from DIR to verify the peer
  --insecure      Don't abort download if certificate verification fails
  --no-verify     Don't verify signature
  --export-key    Print the OpenPGP/GPG public key block
  --dryrun        Print download commands only
  -v              Verbose output

Updates $DRIVEDB
or DESTFILE from branches/$BRANCH of smartmontools
SVN repository.
EOF
  exit 1
}

error()
{
  echo "$myname: $*" >&2
  exit 1
}

err_notfound()
{
  case $1 in
    */*) error "$1: not found $2" ;;
    *)   error "$1: not found in $pathinfo $2" ;;
  esac
}

warning()
{
  echo "$myname: (Warning) $*" >&2
}

selecturl()
{
  case $1 in
    github)  # https://github.com/smartmontools/smartmontools/raw/origin/$BRANCH/smartmontools/drivedb.h
             # https://github.com/smartmontools/smartmontools/raw/master/smartmontools/drivedb.h
          # redirected to:
          url='https://raw.githubusercontent.com/smartmontools/smartmontools/master/smartmontools/drivedb.h' ;;
    sf)   url='https://sourceforge.net/p/smartmontools/code/HEAD/tree/trunk/smartmontools/drivedb.h?format=raw' ;;
    svn)  url='https://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools/drivedb.h' ;;
    svni) url='http://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools/drivedb.h' ;;
    trac) url='https://www.smartmontools.org/export/HEAD/trunk/smartmontools/drivedb.h' ;;
    *) usage ;;
  esac
}

inpath()
{
  local d rc save
  rc=1
  save=$IFS
  IFS=':'
  for d in $PATH; do
    test -f "$d/$1" || continue
    test -x "$d/$1" || continue
    rc=0
    break
  done
  IFS=$save
  return $rc
}

vecho()
{
  test -n "$q" || echo "$*"
}

# vrun COMMAND ARGS...
vrun()
{
  if [ -n "$dryrun" ]; then
    echo "$*"
  elif [ -n "$q" ]; then
    "$@" 2>/dev/null
  else
    echo "$*"
    "$@"
  fi
}

# vrun2 OUTFILE COMMAND ARGS...
vrun2()
{
  local f err rc
  f=$1; shift
  rc=0
  if [ -n "$dryrun" ]; then
    echo "$* > $f"
  else
    vecho "$* > $f"
    err=`"$@" 2>&1 > $f` || rc=$?
    if [ -n "$err" ]; then
      vecho "$err" >&2
      test $rc != 0 || rc=42
    fi
  fi
  return $rc
}

# download URL FILE
download()
{
  local f u rc
  u=$1; f=$2
  rc=0

  case $tool in
    curl)
      vrun curl ${q:+-s} -f --max-redirs 0 \
        ${cacert:+--cacert "$cacert"} \
        ${capath:+--capath "$capath"} \
        ${insecure:+--insecure} \
        -o "$f" "$u" || rc=$?
      ;;

    wget)
      vrun wget $q --max-redirect=0 \
        ${cacert:+--ca-certificate="$cacert"} \
        ${capath:+--ca-directory="$capath"} \
        ${insecure:+--no-check-certificate} \
        -O "$f" "$u" || rc=$?
      ;;

    lynx)
      test -z "$cacert" || vrun export SSL_CERT_FILE="$cacert"
      test -z "$capath" || vrun export SSL_CERT_DIR="$capath"
      # Check also stderr as lynx does not return != 0 on HTTP error
      vrun2 "$f" lynx -stderr -noredir -source "$u" || rc=$?
      ;;

    svn)
      vrun svn $q export \
        --non-interactive --no-auth-cache \
        ${cacert:+--config-option "servers:global:ssl-trust-default-ca=no"} \
        ${cacert:+--config-option "servers:global:ssl-authority-files=$cacert"} \
        ${insecure:+--trust-server-cert} \
        "$u" "$f" || rc=$?
      ;;

    fetch) # FreeBSD
      vrun fetch $q --no-redirect \
        ${cacert:+--ca-cert "$cacert"} \
        ${capath:+--ca-path "$capath"} \
        ${insecure:+--no-verify-hostname} \
        -o "$f" "$u" || rc=$?
      ;;

    ftp) # OpenBSD
      vrun ftp \
        ${cacert:+-S cafile="$cacert"} \
        ${capath:+-S capath="$capath"} \
        ${insecure:+-S dont} \
        -o "$f" "$u" || rc=$?
      ;;

    *) error "$tool: unknown (internal error)" ;;
  esac
  return $rc
}

# check_file FILE FIRST_CHAR MIN_SIZE MAX_SIZE
check_file()
{
  local firstchar f maxsize minsize size
  test -z "$dryrun" || return 0
  f=$1; firstchar=$2; minsize=$3; maxsize=$4

  # Check first chars
  case `dd if="$f" bs=1 count=1 2>/dev/null` in
    $firstchar) ;;
    \<) echo "HTML error message"; return 1 ;;
    *)   echo "unknown file contents"; return 1 ;;
  esac

  # Check file size
  size=`wc -c < "$f"`
  if test "$size" -lt $minsize; then
    echo "too small file size $size bytes"
    return 1
  fi
  if test "$size" -gt $maxsize; then
    echo "too large file size $size bytes"
    return 1
  fi
  return 0
}

# unexpand_svn_id < INFILE > OUTFILE
unexpand_svn_id()
{
  sed 's,\$''Id'': drivedb\.h [0-9][0-9]* 2[-0-9]* [012][:0-9]*Z [a-z][a-z0-9]* \$,$''Id''$,'
}

# Smartmontools Signing Key (through 2020)
# <smartmontools-database@listi.jpberlin.de>
# Key ID 721042C5
public_key="\
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBFwmhpUBEADRoOZaXq13MrqyAmbGe6FlHi6P9ujsT/SJGhTiAoN3W1X56Dbm
KP21nO9ZAjdXnvA2OmzppfCUX7v5Q3/TG3vN3WwfyQIO/dgSaTrGa1E8odbHEGc7
rhzYA8ekAn3TmxhOrEUTcRIogumW0zlQewHOlTe0OYsxat6/N8l3Cqn28HwZUpRH
MrJW3RgefFihQGEhXlnfzo+Tltl14IriURbwBZIDeZOk2AWLGweI0+zqTgYSbF5A
tI5rXO1QDeoyBYZhSX3MtnncwPdCnxoRasizU5w3KoZWYyKAc5bxJBJgUUp9HDOu
ATgNqekc8j28x/cUAWerXe183SBYQp0QkzMPbmE9TCGW3GjtW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83zFFoNA/kQKVz8kIDqgRcxC+zY2VJ4eTKHyQDvXygVk8wnKTBae3gX+CIZ
qJHPXiiygHlbl31Mi3G1Iaxu57dP6ocV0vX1dytKSwd4Rbviwwb4L76o/tVT9t3G
wFM15uK1SqtnAaiaktEdMi3XI4d01H3VUVz/iR0XQbf13RZoEM6CJWmsQ/qvYlwk
bKOdlahjoHrFlkhADSBaO9N1OZp3OYDjziIujMdt2IPKnmM=
=0uFV
-----END PGP PUBLIC KEY BLOCK-----
"

# gpg_verify FILE.asc FILE
gpg_verify()
{
  local gnupgtmp opts out rc
  opts="--quiet ${q:+--no-secmem-warnin} --batch --no-tty"

  # Create temp home dir
  gnupgtmp="$tmpdir/.gnupg.$$.tmp"
  rm -f -r "$gnupgtmp"
  mkdir "$gnupgtmp" || exit 1
  chmod 0700 "$gnupgtmp"

  # Import public key
  "$GPG" $opts --homedir="$gnupgtmp" --import <<EOF
$public_key
EOF
  test $? = 0 || exit 1

  # Verify
  rc=0
  out=`"$GPG" $opts --homedir="$gnupgtmp" --verify "$1" "$2" </dev/null 2>&1` || rc=1
  vecho "$out"

  rm -f -r "$gnupgtmp"
  return $rc
}

# mv_all PREFIX OLD NEW
mv_all()
{
  mv "${1}${2}"         "${1}${3}"
  mv "${1}${2}.raw"     "${1}${3}.raw"
  mv "${1}${2}.raw.asc" "${1}${3}.raw.asc"
}

# Parse options
smtctl=$SMARTCTL
tool=
url=
q="-q"
dryrun=
trunk=
cacert=
capath=
insecure=
no_verify=

while true; do case $1 in
  -s)
    shift; test -n "$1" || usage
    smtctl=$1 ;;

  -t)
    shift
    case $1 in *\ *) usage ;; esac
    case " $os_dltools " in *\ $1\ *) ;; *) usage ;; esac
    tool=$1 ;;

  -u)
    shift; selecturl "$1" ;;

  -v)
    q= ;;

  --dryrun)
    dryrun=t ;;

  --trunk)
    trunk=trunk ;;

  --cacert)
    shift; test -n "$1" || usage
    cacert=$1 ;;

  --capath)
    shift; test -n "$1" || usage
    capath=$1 ;;

  --insecure)
    insecure=t ;;

  --no-verify)
    no_verify=t ;;

  --export-key)
    cat <<EOF
$public_key
EOF
    exit 0 ;;

  -*)
    usage ;;

  *)
    break ;;
esac; shift; done

case $# in
  0) DEST=$DRIVEDB ;;
  1) DEST=$1 ;;
  *) usage ;;
esac

if [ -z "$tool" ]; then
  # Find download tool in PATH
  for t in $os_dltools; do
    if inpath "$t"; then
      tool=$t
      break
    fi
  done
  test -n "$tool" || error "found none of '$os_dltools' in $pathinfo"
fi

test -n "$url" || selecturl "svn"

# Check option compatibility
case "$tool:$url" in
  svn:http*://svn.code.sf.net*) ;;
  svn:*) error "'-t svn' requires '-u svn' or '-u svni'" ;;
esac
case "$tool:${capath:+set}" in
  svn:set) warning "'--capath' is ignored if '-t svn' is used" ;;
esac
case "${insecure:-f}:$url" in
  t:http:*) insecure= ;;
  ?:https:*) ;;
  *) error "'-u svni' requires '--insecure'" ;;
esac
case "$tool:$insecure" in
  lynx:t) warning "'--insecure' is ignored if '-t lynx' is used" ;;
esac

# Check for smartctl
if [ "$smtctl" != "-" ]; then
  "$smtctl" -V >/dev/null 2>&1 \
  || err_notfound "$smtctl" "('-s -' to ignore)"
fi

# Check for GnuPG
if [ -z "$no_verify" ]; then
  test -n "$GPG" \
  || error "GnuPG is not available ('--no-verify' to ignore)"
  "$GPG" --version >/dev/null 2>&1 \
  || err_notfound "$GPG" "('--no-verify' to ignore)"
fi

# Use destination directory as temp directory for gpg
tmpdir=`dirname "$DEST"`

# Adjust URLs
src=`echo "$url" | sed -e "s,/trunk/,/branches/$BRANCH/," \
                       -e "s,/master/,/origin/$BRANCH/,"`
src_asc=`echo "$src" | sed "s,/drivedb\.h,/drivedb.h.raw.asc,"`
test -z "$trunk" || src=$url

# Download
test -n "$dryrun" || rm -f "$DEST.new" "$DEST.new.raw" "$DEST.new.raw.asc"

vecho "Download ${trunk:-branches/$BRANCH}/drivedb.h with $tool"
rc=0
download "$src" "$DEST.new" || rc=$?
if [ $rc != 0 ]; then
  rm -f "$DEST.new"
  error "${trunk:-$BRANCH}/drivedb.h: download failed ($tool: exit $rc)"
fi
if ! errmsg=`check_file "$DEST.new" '/' 10000 1000000`; then
  mv "$DEST.new" "$DEST.error"
  error "$DEST.error: $errmsg"
fi

vecho "Download branches/$BRANCH/drivedb.h.raw.asc with $tool"
rc=0
download "$src_asc" "$DEST.new.raw.asc" || rc=$?
if [ $rc != 0 ]; then
  rm -f "$DEST.new" "$DEST.new.raw.asc"
  error "$BRANCH/drivedb.h.raw.asc: download failed ($tool: exit $rc)"
fi
if ! errmsg=`check_file "$DEST.new.raw.asc" '-' 200 2000`; then
  rm -f "$DEST.new"
  mv "$DEST.new.raw.asc" "$DEST.error.raw.asc"
  error "$DEST.error.raw.asc: $errmsg"
fi

test -z "$dryrun" || exit 0

# Create raw file with unexpanded SVN Id
# (This assumes newlines are LF and not CR/LF)
unexpand_svn_id < "$DEST.new" > "$DEST.new.raw"

# Adjust timestamps and permissions
touch "$DEST.new" "$DEST.new.raw" "$DEST.new.raw.asc"
chmod 0644 "$DEST.new" "$DEST.new.raw" "$DEST.new.raw.asc"

if [ -z "$no_verify" ]; then
  # Verify raw file
  if ! gpg_verify "$DEST.new.raw.asc" "$DEST.new.raw"; then
    mv_all "$DEST" ".new" ".error"
    test -n "$trunk" || error "$DEST.error.raw: *** BAD signature ***"
    error "$DEST.error.raw: signature from branch no longer valid ('--no-verify' to ignore)"
  fi
fi

if [ "$smtctl" != "-" ]; then
  # Check syntax
  if ! "$smtctl" -B "$DEST.new" -P showall >/dev/null; then
    mv_all "$DEST" ".new" ".error"
    error "$DEST.error: rejected by $smtctl, probably no longer compatible"
  fi
  vecho "$smtctl: syntax OK"
fi

# Keep old file if identical, ignore missing Id keyword expansion in new file
rm -f "$DEST.lastcheck"
if [ -f "$DEST" ]; then
  if [ -f "$DEST.raw" ] && [ -f "$DEST.raw.asc" ]; then
    if    cmp "$DEST.raw"     "$DEST.new.raw"     >/dev/null 2>&1 \
       && cmp "$DEST.raw.asc" "$DEST.new.raw.asc" >/dev/null 2>&1 \
       && {   cmp "$DEST"     "$DEST.new" >/dev/null 2>&1 \
           || cmp "$DEST.raw" "$DEST.new" >/dev/null 2>&1; }
    then
      rm -f "$DEST.new" "$DEST.new.raw" "$DEST.new.raw.asc"
      touch "$DEST.lastcheck"
      echo "$DEST is already up to date"
      exit 0
    fi
    mv_all "$DEST" "" ".old"
  else
    mv "$DEST" "$DEST.old"
  fi
fi

mv_all "$DEST" ".new" ""

echo "$DEST updated from ${trunk:-branches/$BRANCH}${no_verify:+ (NOT VERIFIED)}"

Youez - 2016 - github.com/yon3zu
LinuXploit