Skip to content

Commit

Permalink
selinux_build_module_simple.sh: fix quoting
Browse files Browse the repository at this point in the history
If module_name or module_dir had a space, this script would fail.

Also avoid existence test for the tmp dir and use mkdir -p instead.
  • Loading branch information
kenyon committed Aug 21, 2023
1 parent 37e1761 commit 13272f0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions files/selinux_build_module_simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ module_dir="$2"

set -e

cd $module_dir
test -d tmp || mkdir tmp
cd "$module_dir"
mkdir -p tmp

checkmodule -M -m -o "tmp/${module_name}.mod" "${module_name}.te"

checkmodule -M -m -o tmp/${module_name}.mod ${module_name}.te
package_args="-o ${module_name}.pp -m tmp/${module_name}.mod"
if [ -s "${module_name}.fc" ]; then
package_args="${package_args} --fc ${module_name}.fc"
semodule_package -o "${module_name}.pp" -m "tmp/${module_name}.mod" --fc "${module_name}.fc"
else
semodule_package -o "${module_name}.pp" -m "tmp/${module_name}.mod"
fi

semodule_package ${package_args}

0 comments on commit 13272f0

Please sign in to comment.