File: list_latest_deb

package info (click to toggle)
drbl 5.7.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,984 kB
  • sloc: sh: 43,522; perl: 8,820; xml: 867; makefile: 131
file content (24 lines) | stat: -rwxr-xr-x 674 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
# Author: Steven Shiau <steven _at_ clonezilla org>
# License: GPL
# Description: To get the latest version of deb in a local directory.

# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions


#
usage () {
  echo "Usage: `basename $0` [path]"
  echo "Example:"
  echo "`basename $0` /mirror/drbl-core/drbl-core/pool/drbl/unstable/drbl/"
}

TDIR=$1
[ -z "$TDIR" ] && echo "You must provide the PATH!" && usage && exit 1
latest_deb="$(LC_ALL=C ls -lv $TDIR/*.deb 2>/dev/null | tail -n 1 | awk -F" " '{print $NF}')"
if [ -n "$latest_deb" ]; then
  echo "$(basename $latest_deb)"
fi