diff options
author | Elan Ruusamäe | 2023-02-22 19:05:18 (GMT) |
---|---|---|
committer | Elan Ruusamäe | 2023-02-22 19:10:07 (GMT) |
commit | e39bba153313883649838acbaa3b1b4ad68d64e9 (patch) | |
tree | 3aff86e6b0b44a7d08e7af9b5fc86fafe99e7c35 | |
parent | bbed53cf5148464a236b441138b47a4cc8bc8216 (diff) | |
download | cleanbuild-e39bba153313883649838acbaa3b1b4ad68d64e9.zip cleanbuild-e39bba153313883649838acbaa3b1b4ad68d64e9.tar.gz |
Add code to generate shell alias
-rwxr-xr-x | bin/cleanbuild-docker.sh | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/bin/cleanbuild-docker.sh b/bin/cleanbuild-docker.sh index 0078973..baaeb60 100755 --- a/bin/cleanbuild-docker.sh +++ b/bin/cleanbuild-docker.sh @@ -113,6 +113,19 @@ enter_container() { docker exec --user=root -it $name bash } +generate_shell_code() { + local shell="$1" + + case "$shell" in + bash|ksh|zsh) + echo "alias cleanbuild=$dir/cleanbuild" + ;; + *) + die "Unsupported shell: $shell" + ;; + esac +} + package_prepare() { notice "Fetch sources and install dependencies" if [ -d $topdir/packages/$PACKAGE_NAME ]; then @@ -189,7 +202,7 @@ package_build() { parse_options() { local t - t=$(getopt -o 'x' --long 'network,exec,no-tmpfs,notmpfs,tmpfs:,keep-container:,with:,without:' -n "$PROGRAM" -- "$@") + t=$(getopt -o 'x' --long 'network,exec,no-tmpfs,notmpfs,tmpfs:,shellcode:,keep-container:,with:,without:' -n "$PROGRAM" -- "$@") [ $? != 0 ] && exit $? eval set -- "$t" @@ -207,6 +220,11 @@ parse_options() { --no-tmpfs|--notmpfs) TMPFS=false ;; + --shellcode) + shift + generate_shell_code "$1" + exit 0 + ;; --tmpfs) shift TMPFS="$1" |