interplane.Get Omega
Read in your language

hop

Hop: a small native macOS launcher. Clipboard history, find, on-device dictation and your coding agent behind one key.

Brought by drakestapleton

branch main Branches Tags History

hop / Linux / install.om

949 lines · 19599 bytes Raw Blame History
1om2
2note Linux per-user installer. git is a read-only source-verification oracle, never a runtime dependency of installed Hop.
3note SOURCE_HEAD is written by the build driver from git, not typed. All checks precede filesystem publication.
4note /usr/bin/env is a desktop-launch adapter: GLib mischecks literal percent signs in executable paths before field-code expansion. No shell is used.
5note Existing versions and dated launcher/desktop backups are retained; no service, timer or system directory is changed.
6text hi_git "/usr/bin/git"
7text hi_homekey "HOME="
8text hi_datakey "XDG_DATA_HOME="
9text hi_storekey "HOP_GIT_STORE="
10text hi_storesuffix "/git/hop.git"
11text hi_datasuffix "/.local/share"
12text hi_libsuffix "/.local/lib/hop"
13text hi_binsuffix "/.local/bin"
14text hi_appsuffix "/applications"
15text hi_hop "/hop"
16text hi_core "/hopcore"
17text hi_license "/LICENSE"
18text hi_licdest "/LICENSE"
19text hi_stamp "/SOURCE_HEAD"
20text hi_buildhop "/build/linux/hop"
21text hi_buildcore "/build/linux/hopcore"
22text hi_buildstamp "/build/linux/SOURCE_HEAD"
23text hi_buildrecord "/build/linux/BUILD_RECORD"
24text hi_recorddest "/BUILD_RECORD"
25text hi_compilerhead "/build/linux-toolchain/source-commit"
26text hi_compiler "/build/linux-toolchain/seed/out/omc"
27text hi_sum "/usr/bin/sha256sum"
28text hi_magic "HOPBUILD1"
29text hi_desktop "/hop.desktop"
30text hi_tempdesktop "/.hop.desktop."
31text hi_backdesktop "/hop.desktop.backup."
32text hi_templink "/.hop."
33text hi_backlink "/hop.backup."
34text hi_dash "-"
35text hi_slash "/"
36text hi_main "refs/heads/main"
37text hi_C "-C"
38text hi_gitdir "--git-dir"
39text hi_revparse "rev-parse"
40text hi_HEAD "HEAD"
41text hi_status "status"
42text hi_porcelain "--porcelain=v1"
43text hi_untracked "--untracked-files=normal"
44text hi_managed "X-Hop-Managed=true\n"
45text hi_deskhead "[Desktop Entry]\nType=Application\nName=Hop\nComment=Find apps and files, ask, and work with your agent\nTerminal=false\nCategories=Utility;\nX-Hop-Managed=true\nExec=/usr/bin/env \""
46text hi_desktail "\"\n"
47text hi_usage "Usage: linux-install SOURCE_ROOT\n"
48text hi_bad "Hop installation stopped; no existing version was deleted.\n"
49text hi_badsource "Hop installs only a clean checkout of the current published main. Land and rebuild the change first.\n"
50text hi_badbuild "Hop's build does not identify the current source. Rebuild from the published main first.\n"
51text hi_badcollision "A launcher or desktop entry named Hop belongs to something else. It was left alone.\n"
52text hi_badpath "Hop needs absolute HOME and data paths without control characters or an equals sign.\n"
53text hi_done "Installed Hop. Open Hop from your application menu. Previous versions and dated backups were kept.\n"
54global hi_home uchar 4096
55global hi_hn ulong 1
56global hi_data uchar 4096
57global hi_dn ulong 1
58global hi_root uchar 4096
59global hi_rn ulong 1
60global hi_store uchar 4096
61global hi_sn ulong 1
62global hi_lib uchar 4096
63global hi_ln ulong 1
64global hi_bin uchar 4096
65global hi_bn ulong 1
66global hi_apps uchar 4096
67global hi_an ulong 1
68global hi_ver uchar 4096
69global hi_vn ulong 1
70global hi_path uchar 4096
71global hi_pn ulong 1
72global hi_other uchar 4096
73global hi_on ulong 1
74global hi_env uchar 4096
75global hi_packet uchar 65536
76global hi_pk ulong 2
77global hi_pipe uchar 8
78global hi_statusbuf uchar 4
79global hi_output uchar *
80global hi_outn ulong 1
81global hi_head uchar *
82global hi_hd ulong 1
83global hi_buf uchar *
84global hi_bytes uchar 65536
85global hi_id uchar 80
86global hi_idn ulong 1
87global hi_desktxt uchar *
88global hi_dekn ulong 1
89global hi_oldlink uchar 4096
90global hi_oldn ulong 1
91global hi_deskold ulong 1
92global hi_record uchar *
93global hi_recsize ulong 1
94global hi_fields ulong 6
95global hi_sizes ulong 6
96global hi_hashinput ulong 1
97
98fn hi_die msg view uchar * to void
99k = write 2 msg 0 len msg
100exit 1
101end
102fn hi_fail to void
103hi_die hi_bad
104end
105fn hi_envget key view uchar * to ulong
106for i ulong ulong envcnt bound 9223372036854775807
107n = envread i hi_env 0 len hi_env
108if ge n long len key
109ok = true
110for j ulong len key bound 4096
111if ne get key j get hi_env j
112ok = false
113end
114end
115if ok
116ret hi_envcopy len key ulong n
117end
118end
119end
120put hi_pn 0 0
121ret 0
122end
123fn hi_envcopy start ulong total ulong to ulong
124count = sub total start
125for j ulong count bound 4096
126put hi_path j get hi_env add start j
127end
128put hi_pn 0 count
129ret count
130end
131fn hi_checkpath a view uchar * to void
132if eq len a 0
133hi_die hi_badpath
134end
135if ne get a 0 47
136hi_die hi_badpath
137end
138for i ulong len a bound 4096
139c = get a i
140if or lt c 32 eq c 61
141hi_die hi_badpath
142end
143end
144end
145fn hi_setpath base view uchar * tail view uchar * to void
146if gt add len base len tail 4095
147hi_die hi_badpath
148end
149for i ulong len base bound 4096
150put hi_path i get base i
151end
152for i ulong len tail bound 4096
153put hi_path add len base i get tail i
154end
155put hi_pn 0 add len base len tail
156end
157fn hi_arg a view uchar * to void
158p = get hi_pk 0
159if gt add add p 2 len a len hi_packet
160hi_fail
161end
162put hi_packet p uchar and len a 255
163put hi_packet add p 1 uchar shr len a 8
164p = add p 2
165for i ulong len a bound 65536
166put hi_packet add p i get a i
167end
168put hi_pk 0 add p len a
169put hi_pk 1 add get hi_pk 1 1
170end
171fn hi_argpath to void
172b = new uchar 4096 0
173for i ulong get hi_pn 0 bound 4096
174put b i get hi_path i
175end
176hi_arg part b 0 get hi_pn 0
177end
178fn hi_reset to void
179put hi_pk 0 2
180put hi_pk 1 0
181put hi_hashinput 0 0
182hi_arg hi_git
183end
184fn hi_run to void
185put hi_packet 0 uchar and get hi_pk 1 255
186put hi_packet 1 uchar shr get hi_pk 1 8
187k = pipefds hi_pipe 0 8 0
188if ne k 0
189hi_fail
190end
191readfd = int or uint get hi_pipe 0 shl uint get hi_pipe 1 8
192readfd = or readfd int shl uint get hi_pipe 2 16
193readfd = or readfd int shl uint get hi_pipe 3 24
194writefd = int or uint get hi_pipe 4 shl uint get hi_pipe 5 8
195writefd = or writefd int shl uint get hi_pipe 6 16
196writefd = or writefd int shl uint get hi_pipe 7 24
197pid = fork
198if eq pid 0
199if ne get hi_hashinput 0 0
200fd = fopen hi_path 0 get hi_pn 0 0 0
201if lt fd 0
202exit 126
203end
204k = dupfd int fd 0 0
205if lt k 0
206exit 126
207end
208end
209k = dupfd writefd 1 0
210if lt k 0
211exit 126
212end
213k = execprog hi_packet 0 get hi_pk 0
214exit 127
215end
216if lt pid 0
217hi_fail
218end
219k = fclose writefd
220used = ulong 0
221while true bound 9223372036854775807
222r = enlarge hi_output add used 4096
223if lt r 0
224hi_fail
225end
226k = read readfd hi_output used 4096
227if eq k -4
228continue
229end
230if lt k 0
231hi_fail
232end
233if eq k 0
234break
235end
236used = add used ulong k
237end
238k = fclose readfd
239k = waitpid int pid hi_statusbuf 0 4 0
240if ne k pid
241hi_fail
242end
243if or ne get hi_statusbuf 0 0 ne get hi_statusbuf 1 0
244hi_die hi_badsource
245end
246put hi_outn 0 used
247end
248fn hi_rootarg to void
249b = new uchar 4096 0
250for i ulong get hi_rn 0 bound 4096
251put b i get hi_root i
252end
253hi_arg part b 0 get hi_rn 0
254end
255fn hi_sourcecheck to void
256hi_reset
257hi_arg hi_C
258hi_rootarg
259hi_arg hi_revparse
260hi_arg hi_HEAD
261hi_run
262n = get hi_outn 0
263if eq n 0
264hi_die hi_badsource
265end
266r = enlarge hi_head n
267if lt r 0
268hi_fail
269end
270for i ulong n bound 9223372036854775807
271put hi_head i get hi_output i
272end
273put hi_hd 0 n
274hi_reset
275hi_arg hi_gitdir
276b = new uchar 4096 0
277for i ulong get hi_sn 0 bound 4096
278put b i get hi_store i
279end
280hi_arg part b 0 get hi_sn 0
281hi_arg hi_revparse
282hi_arg hi_main
283hi_run
284if ne get hi_outn 0 n
285hi_die hi_badsource
286end
287for i ulong n bound 9223372036854775807
288if ne get hi_head i get hi_output i
289hi_die hi_badsource
290end
291end
292hi_reset
293hi_arg hi_C
294hi_rootarg
295hi_arg hi_status
296hi_arg hi_porcelain
297hi_arg hi_untracked
298hi_run
299if ne get hi_outn 0 0
300hi_die hi_badsource
301end
302end
303fn hi_srcpath tail view uchar * to void
304b = new uchar 4096 0
305for i ulong get hi_rn 0 bound 4096
306put b i get hi_root i
307end
308hi_setpath part b 0 get hi_rn 0 tail
309end
310fn hi_fileload to ulong
311fd = fopen hi_path 0 get hi_pn 0 0 0
312if lt fd 0
313ret 0
314end
315used = ulong 0
316while true bound 9223372036854775807
317r = enlarge hi_buf add used 4096
318if lt r 0
319hi_fail
320end
321k = read int fd hi_buf used 4096
322if eq k -4
323continue
324end
325if lt k 0
326hi_fail
327end
328if eq k 0
329break
330end
331used = add used ulong k
332end
333k = fclose int fd
334ret used
335end
336fn hi_buildcheck to void
337hi_srcpath hi_buildstamp
338n = hi_fileload
339if ne n get hi_hd 0
340hi_die hi_badbuild
341end
342for i ulong n bound 9223372036854775807
343if ne get hi_buf i get hi_head i
344hi_die hi_badbuild
345end
346end
347hi_srcpath hi_buildhop
348if ne faccess hi_path 0 get hi_pn 0 1 0
349hi_die hi_badbuild
350end
351hi_srcpath hi_buildcore
352if ne faccess hi_path 0 get hi_pn 0 1 0
353hi_die hi_badbuild
354end
355hi_srcpath hi_buildrecord
356n = hi_fileload
357if eq get hi_recsize 0 0
358if eq n 0
359hi_die hi_badbuild
360end
361r = enlarge hi_record n
362if lt r 0
363hi_fail
364end
365for i ulong n
366put hi_record i get hi_buf i
367end
368put hi_recsize 0 n
369hi_parseproof
370else
371if ne n get hi_recsize 0
372hi_die hi_badbuild
373end
374for i ulong n
375if ne get hi_buf i get hi_record i
376hi_die hi_badbuild
377end
378end
379end
380if ne add get hi_sizes 1 1 get hi_hd 0
381hi_die hi_badbuild
382end
383for i ulong get hi_sizes 1
384if ne get hi_record add get hi_fields 1 i get hi_head i
385hi_die hi_badbuild
386end
387end
388hi_srcpath hi_compilerhead
389n = hi_fileload
390if ne n add get hi_sizes 2 1
391hi_die hi_badbuild
392end
393for i ulong get hi_sizes 2
394if ne get hi_buf i get hi_record add get hi_fields 2 i
395hi_die hi_badbuild
396end
397end
398if ne get hi_buf sub n 1 10
399hi_die hi_badbuild
400end
401hi_srcpath hi_compiler
402hi_hashcheck 3
403hi_srcpath hi_buildhop
404hi_hashcheck 4
405hi_srcpath hi_buildcore
406hi_hashcheck 5
407end
408fn hi_parseproof to void
409slot = ulong 0
410start = ulong 0
411for i ulong get hi_recsize 0
412if eq get hi_record i 10
413if ge slot 6
414hi_die hi_badbuild
415end
416put hi_fields slot start
417put hi_sizes slot sub i start
418slot = add slot 1
419start = add i 1
420end
421end
422if or ne slot 6 ne start get hi_recsize 0
423hi_die hi_badbuild
424end
425if ne get hi_sizes 0 len hi_magic
426hi_die hi_badbuild
427end
428for i ulong len hi_magic
429if ne get hi_record i get hi_magic i
430hi_die hi_badbuild
431end
432end
433for f ulong 5
434idx = add f 1
435n = get hi_sizes idx
436if le idx 2
437if and ne n 40 ne n 64
438hi_die hi_badbuild
439end
440else
441if ne n 64
442hi_die hi_badbuild
443end
444end
445for i ulong n
446c = get hi_record add get hi_fields idx i
447if not or and ge c 48 le c 57 and ge c 97 le c 102
448hi_die hi_badbuild
449end
450end
451end
452end
453fn hi_hashcheck slot ulong to void
454put hi_pk 0 2
455put hi_pk 1 0
456put hi_hashinput 0 1
457hi_arg hi_sum
458hi_run
459put hi_hashinput 0 0
460if lt get hi_outn 0 66
461hi_die hi_badbuild
462end
463for i ulong 64
464if ne get hi_output i get hi_record add get hi_fields slot i
465hi_die hi_badbuild
466end
467end
468if ne get hi_output 64 32
469hi_die hi_badbuild
470end
471end
472fn hi_suffix base view uchar * tail view uchar * to void
473hi_setpath base tail
474p = get hi_pn 0
475if gt add p get hi_idn 0 4095
476hi_die hi_badpath
477end
478for i ulong get hi_idn 0 bound 80
479put hi_path add p i get hi_id i
480end
481put hi_pn 0 add p get hi_idn 0
482end
483fn hi_idnum n ulong to void
484b = new uchar 32 0
485v = n
486count = ulong 0
487while true bound 32
488put b count uchar add rem v 10 48
489count = add count 1
490v = div v 10
491if eq v 0
492break
493end
494end
495p = get hi_idn 0
496for i ulong count bound 32
497put hi_id add p i get b sub sub count i 1
498end
499put hi_idn 0 add p count
500end
501fn hi_dir path view uchar * to void
502for i ulong len path bound 4096
503if and gt i 0 eq get path i 47
504k = makedir path 0 i 493
505if and ne k 0 ne k -17
506hi_fail
507end
508end
509end
510k = makedir path 0 len path 493
511if and ne k 0 ne k -17
512hi_fail
513end
514end
515fn hi_linkcheck to void
516b = new uchar 4096 0
517for i ulong get hi_bn 0 bound 4096
518put b i get hi_bin i
519end
520hi_setpath part b 0 get hi_bn 0 hi_hop
521n = readlnk hi_path 0 get hi_pn 0 hi_oldlink 0 len hi_oldlink
522if eq n -2
523put hi_oldn 0 0
524ret
525end
526if le n 0
527hi_die hi_badcollision
528end
529if ge n long len hi_oldlink
530hi_die hi_badcollision
531end
532if le n long add get hi_ln 0 5
533hi_die hi_badcollision
534end
535for i ulong get hi_ln 0 bound 4096
536if ne get hi_oldlink i get hi_lib i
537hi_die hi_badcollision
538end
539end
540if ne get hi_oldlink get hi_ln 0 47
541hi_die hi_badcollision
542end
543for i ulong len hi_hop bound 16
544if ne get hi_oldlink add sub ulong n len hi_hop i get hi_hop i
545hi_die hi_badcollision
546end
547end
548if not hi_versionname add get hi_ln 0 1 sub ulong n len hi_hop
549hi_die hi_badcollision
550end
551put hi_oldn 0 ulong n
552end
553fn hi_versionname start ulong last ulong to bool
554if ge start last
555ret false
556end
557dash = false
558for i ulong sub last start bound 4096
559c = get hi_oldlink add start i
560if eq c 45
561if or or dash eq i 0 eq add i 1 sub last start
562ret false
563end
564dash = true
565else
566if or lt c 48 gt c 57
567ret false
568end
569end
570end
571ret dash
572end
573fn hi_deskcheck to void
574b = new uchar 4096 0
575for i ulong get hi_an 0 bound 4096
576put b i get hi_apps i
577end
578hi_setpath part b 0 get hi_an 0 hi_desktop
579fd = fopen hi_path 0 get hi_pn 0 131072 0
580if eq fd -2
581put hi_deskold 0 0
582ret
583end
584if lt fd 0
585hi_die hi_badcollision
586end
587k = fclose int fd
588n = hi_fileload
589found = false
590for i ulong n bound 9223372036854775807
591if le add i len hi_managed n
592start = eq i 0
593if gt i 0
594start = eq get hi_buf sub i 1 10
595end
596if start
597if hi_marker i
598found = true
599end
600end
601end
602end
603if not found
604hi_die hi_badcollision
605end
606put hi_deskold 0 1
607end
608fn hi_marker offset ulong to bool
609for j ulong len hi_managed bound 64
610if ne get hi_buf add offset j get hi_managed j
611ret false
612end
613end
614ret true
615end
616fn hi_copyfile mode int to void
617src = fopen hi_path 0 get hi_pn 0 0 0
618if lt src 0
619hi_fail
620end
621outfd = fopen hi_other 0 get hi_on 0 193 mode
622if lt outfd 0
623hi_fail
624end
625while true bound 9223372036854775807
626n = read int src hi_bytes 0 len hi_bytes
627if eq n -4
628continue
629end
630if lt n 0
631hi_fail
632end
633if eq n 0
634break
635end
636p = ulong 0
637while lt p ulong n bound 65536
638k = write int outfd hi_bytes p sub ulong n p
639if eq k -4
640continue
641end
642if le k 0
643hi_fail
644end
645p = add p ulong k
646end
647end
648k = fsync int outfd
649if ne k 0
650hi_fail
651end
652k = fclose int outfd
653if ne k 0
654hi_fail
655end
656k = fclose int src
657end
658fn hi_saveother to void
659n = get hi_pn 0
660for i ulong n bound 4096
661put hi_other i get hi_path i
662end
663put hi_on 0 n
664end
665fn hi_verpath tail view uchar * to void
666b = new uchar 4096 0
667for i ulong get hi_vn 0 bound 4096
668put b i get hi_ver i
669end
670hi_setpath part b 0 get hi_vn 0 tail
671end
672fn hi_copyitem source view uchar * dest view uchar * mode int to void
673hi_verpath dest
674hi_saveother
675hi_srcpath source
676hi_copyfile mode
677end
678fn hi_pair a view uchar * b view uchar * to void
679put hi_pk 0 2
680put hi_pk 1 0
681hi_arg a
682hi_arg b
683put hi_packet 0 2
684put hi_packet 1 0
685if gt get hi_pk 0 4096
686hi_die hi_badpath
687end
688end
689fn hi_symlink a view uchar * b view uchar * to void
690hi_pair a b
691k = symlnk hi_packet 0 get hi_pk 0
692if ne k 0
693hi_fail
694end
695end
696fn hi_rename a view uchar * b view uchar * to void
697hi_pair a b
698k = renames hi_packet 0 get hi_pk 0 0
699if ne k 0
700hi_fail
701end
702end
703fn hi_desktopbyte c uchar to void
704p = get hi_dekn 0
705r = enlarge hi_desktxt add p 1
706if lt r 0
707hi_fail
708end
709put hi_desktxt p c
710put hi_dekn 0 add p 1
711end
712fn hi_desktext a view uchar * to void
713for i ulong len a bound 4096
714hi_desktopbyte get a i
715end
716end
717fn hi_deskexec to void
718b = new uchar 4096 0
719hi_verpath hi_hop
720for i ulong get hi_pn 0 bound 4096
721put b i get hi_path i
722end
723for i ulong get hi_pn 0 bound 4096
724c = get b i
725if eq c 37
726hi_desktopbyte 37
727end
728if eq c 92
729hi_desktopbyte 92
730hi_desktopbyte 92
731hi_desktopbyte 92
732else
733if or or eq c 34 eq c 36 eq c 96
734hi_desktopbyte 92
735hi_desktopbyte 92
736end
737end
738hi_desktopbyte c
739end
740end
741fn hi_publishlink to void
742bin = new uchar 4096 0
743for i ulong get hi_bn 0 bound 4096
744put bin i get hi_bin i
745end
746old = new uchar 4096 0
747for i ulong get hi_oldn 0 bound 4096
748put old i get hi_oldlink i
749end
750b = new uchar 4096 0
751if gt get hi_oldn 0 0
752hi_suffix part bin 0 get hi_bn 0 hi_backlink
753for i ulong get hi_pn 0 bound 4096
754put b i get hi_path i
755end
756hi_symlink part old 0 get hi_oldn 0 part b 0 get hi_pn 0
757end
758hi_suffix part bin 0 get hi_bn 0 hi_templink
759hi_saveother
760hi_verpath hi_hop
761src = new uchar 4096 0
762for i ulong get hi_pn 0 bound 4096
763put src i get hi_path i
764end
765sn = get hi_pn 0
766dst = new uchar 4096 0
767for i ulong get hi_on 0 bound 4096
768put dst i get hi_other i
769end
770dn = get hi_on 0
771hi_symlink part src 0 sn part dst 0 dn
772hi_setpath part bin 0 get hi_bn 0 hi_hop
773for i ulong get hi_pn 0 bound 4096
774put src i get hi_path i
775end
776hi_rename part dst 0 dn part src 0 get hi_pn 0
777end
778fn hi_publishdesktop to void
779apps = new uchar 4096 0
780for i ulong get hi_an 0 bound 4096
781put apps i get hi_apps i
782end
783if ne get hi_deskold 0 0
784hi_suffix part apps 0 get hi_an 0 hi_backdesktop
785hi_saveother
786hi_setpath part apps 0 get hi_an 0 hi_desktop
787hi_copyfile 420
788end
789hi_suffix part apps 0 get hi_an 0 hi_tempdesktop
790hi_saveother
791note Building the Exec field uses hi_path as scratch; restore the temporary output path after generating it.
792hi_desktext hi_deskhead
793hi_deskexec
794hi_desktext hi_desktail
795for i ulong get hi_on 0 bound 4096
796put hi_path i get hi_other i
797end
798put hi_pn 0 get hi_on 0
799fd = fopen hi_path 0 get hi_pn 0 193 420
800if lt fd 0
801hi_fail
802end
803p = ulong 0
804while lt p get hi_dekn 0 bound 9223372036854775807
805k = write int fd hi_desktxt p sub get hi_dekn 0 p
806if le k 0
807hi_fail
808end
809p = add p ulong k
810end
811k = fsync int fd
812if ne k 0
813hi_fail
814end
815k = fclose int fd
816source = new uchar 4096 0
817sn = get hi_on 0
818for i ulong sn bound 4096
819put source i get hi_other i
820end
821hi_setpath part apps 0 get hi_an 0 hi_desktop
822last = new uchar 4096 0
823for i ulong get hi_pn 0 bound 4096
824put last i get hi_path i
825end
826hi_rename part source 0 sn part last 0 get hi_pn 0
827end
828fn hi_config to void
829b = new uchar 4096 0
830n = hi_envget hi_homekey
831if eq n 0
832hi_die hi_badpath
833end
834for i ulong n bound 4096
835put hi_home i get hi_path i
836end
837put hi_hn 0 n
838n = hi_envget hi_datakey
839if eq n 0
840for i ulong get hi_hn 0 bound 4096
841put b i get hi_home i
842end
843hi_setpath part b 0 get hi_hn 0 hi_datasuffix
844n = get hi_pn 0
845end
846for i ulong n bound 4096
847put hi_data i get hi_path i
848end
849put hi_dn 0 n
850n = hi_envget hi_storekey
851if eq n 0
852for i ulong get hi_hn 0 bound 4096
853put b i get hi_home i
854end
855hi_setpath part b 0 get hi_hn 0 hi_storesuffix
856n = get hi_pn 0
857end
858for i ulong n bound 4096
859put hi_store i get hi_path i
860end
861put hi_sn 0 n
862end
863fn hi_paths to void
864b = new uchar 4096 0
865for i ulong get hi_hn 0 bound 4096
866put b i get hi_home i
867end
868hi_checkpath part b 0 get hi_hn 0
869hi_setpath part b 0 get hi_hn 0 hi_libsuffix
870for i ulong get hi_pn 0 bound 4096
871put hi_lib i get hi_path i
872end
873put hi_ln 0 get hi_pn 0
874hi_setpath part b 0 get hi_hn 0 hi_binsuffix
875for i ulong get hi_pn 0 bound 4096
876put hi_bin i get hi_path i
877end
878put hi_bn 0 get hi_pn 0
879for i ulong get hi_dn 0 bound 4096
880put b i get hi_data i
881end
882hi_checkpath part b 0 get hi_dn 0
883hi_setpath part b 0 get hi_dn 0 hi_appsuffix
884for i ulong get hi_pn 0 bound 4096
885put hi_apps i get hi_path i
886end
887put hi_an 0 get hi_pn 0
888hi_idnum ulong realns
889put hi_id get hi_idn 0 45
890put hi_idn 0 add get hi_idn 0 1
891hi_idnum ulong getpid
892for i ulong get hi_ln 0 bound 4096
893put b i get hi_lib i
894end
895hi_suffix part b 0 get hi_ln 0 hi_slash
896for i ulong get hi_pn 0 bound 4096
897put hi_ver i get hi_path i
898end
899put hi_vn 0 get hi_pn 0
900end
901fn hi_makedirs to void
902b = new uchar 4096 0
903for i ulong get hi_vn 0 bound 4096
904put b i get hi_ver i
905end
906hi_dir part b 0 get hi_vn 0
907for i ulong get hi_bn 0 bound 4096
908put b i get hi_bin i
909end
910hi_dir part b 0 get hi_bn 0
911for i ulong get hi_an 0 bound 4096
912put b i get hi_apps i
913end
914hi_dir part b 0 get hi_an 0
915end
916fn main to int
917if ne argcnt 2
918k = write 2 hi_usage 0 len hi_usage
919ret 2
920end
921n = argread 1 hi_root 0 len hi_root
922if le n 0
923hi_die hi_badpath
924end
925put hi_rn 0 ulong n
926hi_config
927hi_paths
928hi_sourcecheck
929hi_buildcheck
930hi_linkcheck
931hi_deskcheck
932hi_makedirs
933hi_copyitem hi_buildhop hi_hop 493
934hi_copyitem hi_buildcore hi_core 493
935hi_copyitem hi_license hi_licdest 420
936hi_copyitem hi_buildstamp hi_stamp 420
937hi_copyitem hi_buildrecord hi_recorddest 420
938hi_sourcecheck
939hi_buildcheck
940note Verify the staged bytes, not merely the source paths, before publishing either launcher.
941hi_verpath hi_hop
942hi_hashcheck 4
943hi_verpath hi_core
944hi_hashcheck 5
945hi_publishlink
946hi_publishdesktop
947k = write 1 hi_done 0 len hi_done
948ret 0
949end