]> git.pld-linux.org Git - projects/cleanbuild.git/commitdiff
Add code to generate shell alias
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 22 Feb 2023 19:05:18 +0000 (21:05 +0200)
committerElan Ruusamäe <glen@pld-linux.org>
Wed, 22 Feb 2023 19:10:07 +0000 (21:10 +0200)
bin/cleanbuild-docker.sh

index 0078973b89f645f3845d75e2ea1b9441873eb1cc..baaeb607626d69615960ca89e342a1ae977e7ca3 100755 (executable)
@@ -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"
This page took 0.127207 seconds and 4 git commands to generate.