AmazonLinux2ã§kontena-lensã使ããããã«ãã
AmazonLinux2ã§kontena-lensãèµ·åãããã¨ããã¨ããã以ä¸ã®ããã«ãªã£ã¦ãã¾ãèµ·åã§ãã¾ããã§ããã
% kontena-lens info: ð Setting Lens as protocol client for lens:// info: ð failed â
調ã¹ã¦ä½ã¨ã解決ãããã®ã®ããããªãã«å¤§å¤ã ã£ãã®ã§çµç·¯ã¨è§£æ±ºæ¹æ³ãã¡ã¢
(å°æ¥ã®kontena-lensãxdg-utilsã§ã¯ä¿®æ£ããã¦ããå¯è½æ§ãããã¾ã)
Â
 ç°å¢
- AmazonLinux2 ⦠Desktopç°å¢ã¯MATE(default)
- Lens kontena-lens-4.2.2-20210416.7.x86_64 â¦ å ¬å¼ãµã¤ãããLinux x64 RPMããã¦ã³ãã¼ããã¦å ¥ãã (v4.2.2)
- xdg-utils xdg-utils-1.1.0-0.17.20120809git.amzn2.noarch
調æ»
ãªã"failed"ãªã®ãï¼
ã¨ããããfailedã¨è¡¨ç¤ºãããé¨åãã©ããªã®ãã調ã¹ã¾ããããã¯Lensã®ã³ã¼ããå°ãæ¢ãã°ããè¦ä»ããã¾ãã
lens/index.ts at v4.2.2 · lensapp/lens · GitHub
ã¤ã¾ã setAsDefaultProtocolClient("lens")
ãfalseãè¿ãã¦ãã¾ãã
ããã¯electronã®é¢æ°ãªã®ã§ããã¡ãã調ã¹ãã°ãªãfalseãªã®ãããããã¾ãã
Returns Boolean - Whether the call succeeded.
å ·ä½çã«ä½ããã¦ããã®ãã¯ãããããã¾ããã§ããã
electronã®ã³ã¼ããèªãã§ãããã£ãããããã¾ããããä»åã¯straceã§èª¿ã¹ã¾ãã
% strace -o /tmp/z -s 4000 -f kontena-lens
ã®ããã«ãã¦kontena-lensèµ·åããçµäºã¾ã§ã®åããè¨é²ããä½ããã¦ããã®ããç解ãã¾ãã
ããã¨forkããå¾ã«xdg-settingsã«execveãã¦ãããã¨ããããã¾ããã
27174 execve("/usr/bin/xdg-settings", ["xdg-settings", "set", "default-url-scheme-handler", "lens", "Lens.desktop"], 0x728a8742180 /* 75 vars */) = 0
xdg-settingsã¯ãã¹ã¯ãããã¢ããªã±ã¼ã·ã§ã³ã®èµ·åè¨å®ããã¦ããã¦ããã®ã§ããããæåãã¦ãããã©ãããè¦ã¦ããã¨ãããã¨ã§ããã
å®éã«xdg-settings set default-url-scheme-handler lens Lens.desktop
ãã¦ã¿ãã¨3ã§çµäºããããããããæãä¸ãã¦ãããã¨ã«ãã¾ãã
xdg-settingsã調ã¹ã¦ãã
setãä½ãè¨ããã«çµäºãã¦ãã¾ããããã¨ããããgetã§èª¿ã¹ã¦ã¿ã¾ãã
% xdg-settings get default-url-scheme-handler
xdg-settings: unknown desktop environment
ãã®è¾ºãã§å«ãªæ°é ãæãã¾ãã決ãã¦ã¡ã¸ã£ã¼ã§ã¯ãªãMATEã¨ãããã¹ã¯ãããç°å¢ãxdg-settingsã対å¿ãã¦ããªãã®ã§ã¯â¦ï¼
幸ãxdg-settingsã¯shã¢ããªã±ã¼ã·ã§ã³ã§ããå®éã«èªãã§åãã追ãã¾ããè¡æ°ã¯1000è¡ãè¶ãããã®ã®ãã»ã¨ãã©ãé¢æ°å®ç¾©ã§ãããåºæ¬çã«ã¯detectDEã«ããDEã¨ããå¤æ°(Desktop Environment)ãè¨å®ããããã«å¿ãã¦å¦çãå¼ã³åºãã ãã§ãã
detectDE case "$DE" in kde|gnome*|xfce) dispatch_specific "$@" ;; generic) dispatch_generic "$@" ;; *) exit_failure_operation_impossible "unknown desktop environment" ;; esac
å®ã¯åå¨ãã¦ããç°å¢å¤æ°ããMATEã§ãããã¨ã¯å¤å®ããã¦ãã¦ãDEã«ã¯mateã¨ããå¤ãå ¥ã£ã¦ãã¾ãããã ãã®caseã§mateã«åè´ãããã®ããªããããexit_failure_operation_impossibleãå¼ã³åºããã¦ãã¾ã£ã¦ãããã¨ããããã¾ããã
調ã¹ã¦ã¿ãã¨ããMATEã¯åºæ¬çã«GNOME3ããã¼ã¹ã¨ãªã£ã¦ãããä¼¼ããããªå¦çããããã°ããããã§ããé常ã«ä¼¼ãissueãxdg-utilsã«ä¸ãã£ã¦ãã¾ããã
ããã«ã¯ããåèã«ãªãpatchããªã³ã¯ãã¦ããã¾ããã
AmazonLinux2ã®xdg-utilsã¯å¦ã«å¤ãããã®patchãå ¥ã£ã¦ãã¾ãããã¾ããã®patchã¯browserãè¨å®ãã¦ããã ãã§ãschemeã®è¨å®ã¯å ¥ã£ã¦ããªããããä¸è¨ãåèã«ãã¤ã¤patchã追å ããå¿ è¦ãããã¾ããã
çµæã¨ãã¦å¿ è¦ã¨ãªãpatchã¯ãã¡ãã§ãã
ããã¡ãã£ã¨ã ãç¶ã
ããã§getã¯ã§ããããã«ãªã£ããã®ã®ãå½åã®setã¯2ã§å¤±æããããã«ãªãã¾ãã
ããã¯RPMã§ã¯kontena-lens.desktopãã¤ã³ã¹ãã¼ã«ããããã®ã®ãå®éã«setãããã¨ãã¦ããã®ã¯Lens.desktopã¨ããåå¨ããªããã¡ã¤ã«ã ããã§ãã
ããã¯RPMå´ãç´ããªãã¨ä½ã¨ãâ¦ã¨ããã¨ããã§ãããrenameãããsymbolic linkãä½æãããªã©ããã°ããã§ãã
ä»åã¯(MATEã®ã¡ãã¥ã¼ã§Lensãéè¤ãããã¨ãè¦æã®ä¸ã§)以ä¸ã®ããã«symbolic linkã®ä½æãè¡ãã¾ããã
% sudo ln -s /usr/share/applications/{kontena-lens.desktop,Lens.desktop}
ãã㧠kontena-lens ãèµ·åã§ããããã«ãªãããã§ãããã§ããã
ã¾ã¨ã
AmazonLinux2 MATEã®ç°å¢ã§kontena-lens RPMãå ¥ããå ´åã«ã¯å¤§ãã以ä¸ã®2ã¤ãå¿ è¦ã§ããã
- xdg-settingsã¸ã®patché©ç¨
- Lens.desktopã®ç¨æ
ããã§k8sç°å¢ãå¿«é©ã«éç¨ãã¦ããã¾ãããã