| 1 | #!/bin/bash |
| 2 | # Author: Steven Shiau <steven _at_ clonezilla org> |
| 3 | # License: GPL |
| 4 | # Description: To get the latest version of deb in a local directory. |
| 5 | |
| 6 | # Load DRBL setting and functions |
| 7 | DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}" |
| 8 | |
| 9 | . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions |
| 10 | |
| 11 | |
| 12 | # |
| 13 | usage () { |
| 14 | echo "Usage: `basename $0` [path]" |
| 15 | echo "Example:" |
| 16 | echo "`basename $0` /mirror/drbl-core/drbl-core/pool/drbl/unstable/drbl/" |
| 17 | } |
| 18 | |
| 19 | TDIR=$1 |
| 20 | [ -z "$TDIR" ] && echo "You must provide the PATH!" && usage && exit 1 |
| 21 | latest_deb="$(LC_ALL=C ls -lv $TDIR/*.deb 2>/dev/null | tail -n 1 | awk -F" " '{print $NF}')" |
| 22 | if [ -n "$latest_deb" ]; then |
| 23 | echo "$(basename $latest_deb)" |
| 24 | fi |