Commit c745c1ce02b0885dd0931f7ddd093cde097ce4c8
1 parent
40dfc60f
Add package type information to system properties
Showing
4 changed files
with
35 additions
and
1 deletions
... | ... | @@ -13,6 +13,9 @@ |
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | + | |
17 | +import org.apache.tools.ant.filters.ReplaceTokens | |
18 | + | |
16 | 19 | buildscript { |
17 | 20 | ext { |
18 | 21 | osPackageVersion = "3.8.0" |
... | ... | @@ -56,6 +59,7 @@ ospackage { |
56 | 59 | |
57 | 60 | // Copy the config files |
58 | 61 | from("target/conf") { |
62 | + exclude "${pkgName}.conf" | |
59 | 63 | fileType CONFIG | NOREPLACE |
60 | 64 | fileMode 0754 |
61 | 65 | into "conf" |
... | ... | @@ -99,6 +103,14 @@ buildRpm { |
99 | 103 | into "/usr/lib/systemd/system" |
100 | 104 | } |
101 | 105 | |
106 | + from("target/conf") { | |
107 | + include "${pkgName}.conf" | |
108 | + filter(ReplaceTokens, tokens: ['pkg.platform': 'rpm']) | |
109 | + fileType CONFIG | NOREPLACE | |
110 | + fileMode 0754 | |
111 | + into "conf" | |
112 | + } | |
113 | + | |
102 | 114 | directory(pkgLogFolder, 0755) |
103 | 115 | link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml") |
104 | 116 | link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") |
... | ... | @@ -126,6 +138,14 @@ buildDeb { |
126 | 138 | user pkgName |
127 | 139 | permissionGroup pkgName |
128 | 140 | |
141 | + from("target/conf") { | |
142 | + include "${pkgName}.conf" | |
143 | + filter(ReplaceTokens, tokens: ['pkg.platform': 'deb']) | |
144 | + fileType CONFIG | NOREPLACE | |
145 | + fileMode 0754 | |
146 | + into "conf" | |
147 | + } | |
148 | + | |
129 | 149 | directory(pkgLogFolder, 0755) |
130 | 150 | link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/bin/${pkgName}.jar") |
131 | 151 | link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml") | ... | ... |
... | ... | @@ -14,6 +14,6 @@ |
14 | 14 | # limitations under the License. |
15 | 15 | # |
16 | 16 | |
17 | -export JAVA_OPTS="$JAVA_OPTS" | |
17 | +export JAVA_OPTS="$JAVA_OPTS -Dplatform=@pkg.platform@" | |
18 | 18 | export LOG_FILENAME=${pkg.name}.out |
19 | 19 | export LOADER_PATH=${pkg.installFolder}/conf,${pkg.installFolder}/extensions | ... | ... |
... | ... | @@ -72,4 +72,17 @@ public class AdminController extends BaseController { |
72 | 72 | throw handleException(e); |
73 | 73 | } |
74 | 74 | } |
75 | + | |
76 | + @PreAuthorize("hasAuthority('SYS_ADMIN')") | |
77 | + @RequestMapping(value = "/updates", method = RequestMethod.GET) | |
78 | + @ResponseBody | |
79 | + public String checkUpdates() throws ThingsboardException { | |
80 | + try { | |
81 | + return "<div>New update Thingsboard version 1.2 is available.<br/>" + | |
82 | + "<a href='https://github.com/thingsboard/thingsboard/releases/download/v1.1/thingsboard-1.1.deb'>Download package</a></div>"; | |
83 | + } catch (Exception e) { | |
84 | + throw handleException(e); | |
85 | + } | |
86 | + } | |
87 | + | |
75 | 88 | } | ... | ... |
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | <logmode>rotate</logmode> |
8 | 8 | <env name="LOADER_PATH" value="%BASE%\conf,%BASE%\extensions" /> |
9 | 9 | <executable>java</executable> |
10 | + <startargument>-Dplatform=windows</startargument> | |
10 | 11 | <startargument>-jar</startargument> |
11 | 12 | <startargument>%BASE%\lib\${pkg.name}.jar</startargument> |
12 | 13 | </service> | ... | ... |