@@ -82,6 +82,8 @@ def install(self):
82
82
83
83
self .applyChangesInFiles (self .app_custom_changes [NAME_STR ])
84
84
85
+ self .replace_favicon ()
86
+
85
87
self .chown (jettyDestinationPath , Config .jetty_user , Config .jetty_group , recursive = True )
86
88
self .run ([paths .cmd_chown , '-h' , '{}:{}' .format (Config .jetty_user , Config .jetty_group ), self .jetty_home ])
87
89
@@ -98,6 +100,23 @@ def install(self):
98
100
self .chown (self .jetty_bin_sh_fn , Config .jetty_user , Config .jetty_group , recursive = True )
99
101
self .run ([paths .cmd_chmod , '-R' , '755' , self .jetty_bin_sh_fn ])
100
102
103
+ def replace_favicon (self ):
104
+ # icon directory
105
+ icon_subdir = 'org/eclipse/jetty'
106
+ favicon_fn = 'favicon.ico'
107
+ icon_dir = os .path .join (self .jetty_user_home_lib , icon_subdir )
108
+ self .createDirs (icon_dir )
109
+
110
+ # extract favicon
111
+ base .extract_file (base .current_app .jans_zip , f'jans-linux-setup/jans_setup/static/{ favicon_fn } ' , os .path .join (icon_dir , favicon_fn ), ren = True )
112
+
113
+ _ , jetty_dist = self .get_jetty_info ()
114
+ jetty_server_fn = f'{ jetty_dist } /{ self .jetty_dist_string } -{ self .jetty_exact_version_string } /lib/jetty-server-{ self .jetty_exact_version_string } .jar'
115
+
116
+ # replace favicon
117
+ self .run ([Config .cmd_jar , '-uf' , jetty_server_fn , os .path .join (icon_subdir , favicon_fn )], cwd = self .jetty_user_home_lib )
118
+
119
+
101
120
def get_jetty_info (self ):
102
121
# first try latest versions
103
122
self .jetty_dist_string = 'jetty-home'
@@ -109,13 +128,15 @@ def get_jetty_info(self):
109
128
jetty_archive = max (jetty_archive_list )
110
129
111
130
jetty_archive_fn = os .path .basename (jetty_archive )
112
- jetty_regex = re .search ('{}-(\d*\.\d*)' .format (self .jetty_dist_string ), jetty_archive_fn )
131
+ jetty_regex = re .search (f'{ self .jetty_dist_string } -(\d*\.\d*)' , jetty_archive_fn )
132
+ jetty_exact_version_regex = re .search (f'{ self .jetty_dist_string } -(\d*\.\d*.\d*)' , jetty_archive_fn )
113
133
if not jetty_regex :
114
134
self .logIt ("Can't determine Jetty version" , True , True )
115
135
116
136
jetty_dist = '/opt/jetty-' + jetty_regex .groups ()[0 ]
117
137
Config .templateRenderingDict ['jetty_dist' ] = jetty_dist
118
138
self .jetty_version_string = jetty_regex .groups ()[0 ]
139
+ self .jetty_exact_version_string = jetty_exact_version_regex .groups ()[0 ]
119
140
120
141
return jetty_archive , jetty_dist
121
142
0 commit comments