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