File: rpm-version

package info (click to toggle)
apptainer 1.4.5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,780 kB
  • sloc: sh: 3,329; ansic: 1,706; awk: 414; python: 103; makefile: 54
file content (14 lines) | stat: -rwxr-xr-x 369 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash
# translate given version to rpm equivalent

if [ $# != 1 ]; then
    echo "Usage: rpm-version versionstring" >&2
    exit 2
fi

# Transform version numbers so that rpm accepts them:
#
# 3.4.2-rc.1            ->  3.4.2~rc.1
# 3.4.2                 ->  3.4.2
# 3.4.2+522-gee98ef356  ->  3.4.2+522.gee98ef356
echo "$1" | sed -e 's,\(^[^+]\+\)-,\1~,; s,-,.,g'