#!/bin/sh # # POSIX shell script to install a build oil into the proper directory. # Distributed with the source tarball. # TODO: # - copy bin/oil with the right permissions. # - make dummy man page that points to HTML docs? # - or just a cheat sheet for flags, usage, etc. # NOTE: install is part of coreutils and busybox. proc die { echo "FATAL install error: $ifsjoin(Argv)" !1 > !2 exit 1 } # NOTE: The configure step proc main { if ! source _build/detected-config.sh { die "Can't find _build/detected-config.h. Run './configure'" } # Now $PREFIX should be defined #local exec_filename=oil.ovm-dbg # Should this go in configure output? var exec_filename = 'oil.ovm' # Should this go in configure output? var dest = "$PREFIX/bin/$exec_filename" echo "Installing to $dest" if ! install _bin/$exec_filename $dest { die "Couldn't install oil binary" } cd $PREFIX/bin if ! ln -s -f $exec_filename osh { # -f to overwrite die "Couldn't create osh symlink" } } main @Argv (CommandList children: [ (FuncDef name: die body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ("FATAL install error: ") ($ VSub_At "$@"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:1 arg_word:{(2)} spids:[44])] ) (C {(exit)} {(1)}) ] spids: [34] ) spids: [30 33] ) (FuncDef name: main body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(.)} {(_build/detected-config.sh)})] negated: True ) terminator: ) ] action: [ (C {(die)} {(DQ ("Can't find _build/detected-config.h. Run './configure'"))}) ] spids: [-1 74] ) ] spids: [-1 84] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:exec_filename) op: Equal rhs: {(oil.ovm)} spids: [99] ) ] spids: [97] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:dest) op: Equal rhs: {($ VSub_Name "$PREFIX") (/bin/) ($ VSub_Name "$exec_filename")} spids: [109] ) ] spids: [107] ) (C {(echo)} {(DQ ("Installing to ") ($ VSub_Name "$dest"))}) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (C {(install)} {(_bin/) ($ VSub_Name "$exec_filename")} {($ VSub_Name "$dest")} ) ] negated: True ) terminator: ) ] action: [(C {(die)} {(DQ ("Couldn't install oil binary"))})] spids: [-1 136] ) ] spids: [-1 146] ) (C {(cd)} {($ VSub_Name "$PREFIX") (/bin)}) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(ln)} {(-s)} {(-f)} {($ VSub_Name "$exec_filename")} {(osh)})] negated: True ) terminator: ) ] action: [(C {(die)} {(DQ ("Couldn't create osh symlink"))})] spids: [-1 171] ) ] spids: [-1 184] ) ] spids: [62] ) spids: [58 61] ) (C {(main)} {(DQ ($ VSub_At "$@"))}) ] )