[projects/cleanbuild] Add code to generate shell alias

glen glen at pld-linux.org
Wed Feb 22 20:10:32 CET 2023


commit e39bba153313883649838acbaa3b1b4ad68d64e9
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Wed Feb 22 21:05:18 2023 +0200

    Add code to generate shell alias

 bin/cleanbuild-docker.sh | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
---
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"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/cleanbuild.git/commitdiff/9a6e749e7554674a0dd8a1cf794618d4376d2ade



More information about the pld-cvs-commit mailing list