Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

gmt_uninstall.sh 2.8 KB

You have to be logged in to leave a comment. Sign In
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (c) 1991-2021 by the GMT Team (https://www.generic-mapping-tools.org/team.html)
  4. # See LICENSE.TXT file for copying and redistribution conditions.
  5. #
  6. # This script removes the entire GMT installation. If the bin, share
  7. # include, and lib dirs become empty after removing the GMT files then
  8. # we also remove those parent directories since presumably under build dir.
  9. #
  10. # Run this script on the command line with:
  11. # $(gmt --show-sharedir)/tools/gmt_uninstall.sh
  12. #
  13. # It expects the GMT executable to be in the search path and that
  14. # you have permission to perform the changes in the bin directory.
  15. # check for bash
  16. [ -z "$BASH_VERSION" ] && return
  17. if ! [ -x "$(command -v gmt)" ]; then
  18. echo 'Error: gmt is not found in your search PATH.' >&2
  19. exit 1
  20. fi
  21. inc=$(gmt-config --includedir)
  22. share=$(gmt --show-sharedir)
  23. bin=$(gmt --show-bindir)
  24. lib=$(gmt --show-plugindir)
  25. cwd=$(pwd)
  26. gmt_modules=$(gmt --show-classic)
  27. compat_modules="minmax gmtstitch gmtdp grdreformat ps2raster originator"
  28. # 2. Remove include directory
  29. cd $inc
  30. cd ..
  31. here=$(pwd)
  32. printf "Remove: %s\n" $inc
  33. rm -rf $inc
  34. if find "$here" -mindepth 1 -print -quit | grep -q .; then
  35. # include not empty, leave as is
  36. printf "Ignore: %s\n" $here
  37. else
  38. printf "Remove: %s\n" $here
  39. rm -rf $here
  40. fi
  41. # 3. Remove share directory
  42. for dir in cpt custom doc localization man mgd77 mgg spotter tools themes x2sys; do
  43. printf "Remove: %s/%s\n" $share $dir
  44. rm -rf $share/$dir
  45. done
  46. rm -f $share/VERSION
  47. if find "$share" -mindepth 1 -print -quit | grep -q .; then
  48. # share not empty, leave as is
  49. printf "Ignore: %s\n" $share
  50. else
  51. printf "Remove: %s\n" $share
  52. rm -rf $share
  53. fi
  54. # 4. Remove executables [and any links to them]
  55. cd $bin
  56. for module in ${gmt_modules} ${compat_modules}; do
  57. if [ -h $module ]; then
  58. printf "Remove: Link %14s -> gmt\n" $module
  59. rm -f $module
  60. fi
  61. done
  62. # Remove main executable
  63. printf "Remove: gmt\n"
  64. rm -f gmt
  65. # Remove scripts
  66. printf "Remove: gmt scripts\n"
  67. rm -rf gmt-config gmt_shell_functions.sh gmtswitch isogmt gmt.dSYM
  68. if find "$bin" -mindepth 1 -print -quit | grep -q .; then
  69. # bin not empty, leave as is
  70. printf "Ignore: %s\n" $bin
  71. else
  72. printf "Remove: %s\n" $bin
  73. rm -rf $bin
  74. fi
  75. # 5. Lastly remove libs and plugin directory
  76. cd $lib
  77. cd ../..
  78. here=$(pwd)
  79. if [ -d gmt ]; then # plugin directory inside a gmt directory; delete gmt instead
  80. printf "Remove: %s\n" $here
  81. rm -rf gmt
  82. else # Just delete plugin directory
  83. printf "Remove: %s\n" $lib
  84. rm -rf $lib
  85. fi
  86. # Check for GMT libs here
  87. printf "Remove: libgmt.*\n"
  88. printf "Remove: libpostscriptlight.*\n"
  89. rm -rf libgmt.* libpostscriptlight.*
  90. if find "$here" -mindepth 1 -print -quit | grep -q .; then
  91. # lib dir not empty, leave as is
  92. printf "Ignore: %s\n" $here
  93. else
  94. printf "Remove: %s\n" $here
  95. rm -rf $here
  96. fi
  97. # Back to where we were
  98. cd $cwd
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...