diff options
| author | Leah Rowe <leah@libreboot.org> | 2025-05-18 12:07:10 +0100 | 
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2025-05-18 12:07:10 +0100 | 
| commit | 6b603b9fbf45f6f391f84ecc8ced7896722f6b02 (patch) | |
| tree | 42c96c8caf61b0ab5c8443401c28b1a8a4a82a93 /include | |
| parent | ac36ea7f950a88e56be82e046004c9780c9e0803 (diff) | |
init.sh: only set xbmk version on parent instance
On child instances, we need only read.
Apply the principle of least privilege.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/init.sh | 13 | 
1 files changed, 8 insertions, 5 deletions
| diff --git a/include/init.sh b/include/init.sh index 363f0b18..e94157f0 100644 --- a/include/init.sh +++ b/include/init.sh @@ -30,7 +30,7 @@ xbmk_init()  	id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)"  	[ "$(id -u)" != "0" ] || err "this command as root is not permitted" -	for init_cmd in set_version set_env lock git_init \ +	for init_cmd in get_version set_env lock set_version git_init \  	    mkdirs set_pyver child_exec; do  		xbmk_$init_cmd "$@" || break  	done @@ -50,7 +50,7 @@ xbmkpkg()  	    printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; :  } -xbmk_set_version() +xbmk_get_version()  {  	[ ! -f ".version" ] || read -r version < ".version" || :; :  	[ ! -f ".versiondate" ] || read -r versiondate < ".versiondate" || :; : @@ -68,9 +68,6 @@ xbmk_set_version()  	    --pretty='%ct' HEAD)" || versiondate="$versiondate_"  	chkvars version versiondate -	printf "%s\n" "$version" > ".version" || err "can't save version" -	printf "%s\n" "$versiondate" > ".versiondate" || err "can't save date" -  	relname="$projectname-$version"  } @@ -131,6 +128,12 @@ xbmk_lock()  	touch "$xbmklock" || err "cannot create '$xbmklock'"; :  } +xbmk_set_version() +{ +	printf "%s\n" "$version" > ".version" || err "can't save version" +	printf "%s\n" "$versiondate" > ".versiondate" || err "can't save date" +} +  xbmk_git_init()  {  	for gitarg in "--global user.name" "--global user.email"; do | 
