summaryrefslogtreecommitdiff
path: root/manualPorts/lastVersion.sh
blob: ca7ca38ae0c7604ecf224b17b74ee81922938dd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash

set -e

if [ $# -eq 0 ]
then
  (
    for s in "$(dirname "$0")"/*
    do
      [ -d "${s}" ] && basename "${s}"
    done
    echo '#kernel'
  ) | parallel -j0 -n1 "$0"
  exit 0
fi

if [ $# -gt 1 ]
then
  for s in "$@"
  do
    echo "${s}"
  done | parallel -j0 -n1 "$0"
  exit 0
fi

if [ "$1" == "#kernel" ]
then
  latestKernelVersion="$(makekernel -s)"
  currentKernelVersion="$(\
    uname -r)"

  [ "${currentKernelVersion}" == "${latestKernelVersion}" ] || \
    [ "${currentKernelVersion}" == "${latestKernelVersion}.0" ] || \
    echo "Kernel: ${latestKernelVersion} (installiert: ${currentKernelVersion})"
  exit 0
fi

base="$(dirname $0)"

if [ -x ${base}/$1/lastVersion.sh ]
then
  newestVersion="$(${base}/$1/lastVersion.sh)"
  if [ -z "${newestVersion}" ]
  then
    echo "${base}/$1/lastVersion.sh"' gibt keine Version zurück!'
  fi
fi
lastVersion=$(
  grep "\(^\|\s\)version=" /usr/{src/ports/manualPorts,ports/*}/$1/Pkgfile \
  | cut -d = -f 2 \
  | grep -vxF svn \
  | sort -V \
  | tail -n1
)
myVersion=$(
  grep "\(^\|\s\)version=" /usr/src/ports/manualPorts/$1/Pkgfile \
  | cut -d = -f 2 \
  | sort -V \
  | tail -n1
)

if [ -n "${newestVersion}" ] && \
  [ ! "${newestVersion}" == "${myVersion}" ]
then
  echo "$1: ${newestVersion} upstream verfügbar, bei mir ${myVersion}"
fi
if [ ! "${lastVersion}" == "${myVersion}" ] \
&& [ ! "${lastVersion}" == 'git' ]
then
  echo "$1 gibt es neuer in den offiziellen Quellen!"
  echo /usr/ports/*/$1 | tr " " "\n" | grep -v "/deepthought/"
fi