2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # T2 SDE: scripts/Update-Pkg
4 # Copyright (C) 2004 - 2023 The T2 SDE Project
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2.
11 # --- T2-COPYRIGHT-NOTE-END ---
13 # Extract packagename and version number from the script arguments.
17 # The script also supports the package name and version separated by a '-',
18 # '_' or '.'. In this case they have to be separated from each other.
19 if [ -z "$ver" ]; then
22 if [ "$ver" == "$pkg" ]; then
26 if [ "$ver" == "$pkg" ]; then
30 [ "$ver" == "$pkg" ] && unset ver
33 # Check if both package name and version have been extracted from the
34 # commandline arguments. If not the script was called with invalid
35 # arguments, show the usage.
36 if [ -z "$pkg" -o -z "$ver" ]; then
37 echo "Usage: $0 pkg ver, pkg-ver, pkg_ver or pkg.ver"
39 echo "Updating a package to a new versions."
41 echo " pkg Packagename to be updated"
42 echo " ver New version number for the package"
43 echo " ver=refresh makes it just add checksums"
45 echo "For detailed information on how to update packages"
46 echo "to new versions, please have a look at the online"
47 echo "T2 documentaion."
51 # Make sure any diff files from previous runs are removed.
54 # Only package names in lowercase are supported. As an additional
55 # service any package names supplied in capitols will be converted
57 pkg
=`echo "$pkg" | tr A-Z a-z`
59 # Of course we can only update packages we know about.
60 if [ -d package
/*/$pkg ]; then
61 if [ "$ver" != "refresh" ]; then
62 # The package exists so now update the package descriptor
63 # for the given package to the new version. Luckily we have
64 # a script for that too :-)
65 scripts
/Create-PkgUpdPatch
"$pkg" "$ver" |
tee $$.
diff
70 # Step 2: Use the modified package descriptor to download
71 # the package. Again, nothing more that calling an existing
73 scripts
/Download
$pkg ||
exit 1
75 # Third and final step is updating the checksum for the
77 scripts
/Create-CkSumPatch
"$pkg" |
patch -p0
79 # Oeps, the given package name does not exist.
80 echo "ERROR: package $pkg doesn't exist"
81 # As an extra service for the user a list possibilities is
82 # presented with packages closely matching the given package
84 pkg
=`echo "$pkg" | tr '\-_.' '***'`
85 echo `echo package/*/*$pkg*/ | tr ' ' '\n' | grep -v '*' | cut -d'/' -f3`