Update luna.sh

This commit is contained in:
Arszilla
2022-08-29 15:57:23 +03:00
parent c1e2847fb4
commit 33b82ddae0

View File

@@ -65,6 +65,7 @@ githubraw="https://raw.githubusercontent.com"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root or have super user permissions"
echo "Use: sudo $0 ${1:-2.0} ${2:-kali}"
exit 1
fi
@@ -72,6 +73,7 @@ fi
# Pass version number
if [[ $# -eq 0 ]]; then
echo "Please pass version number, e.g. $0 2.0, and (if you want) a hostname, default is kali"
exit 0
fi
@@ -80,6 +82,7 @@ fi
if [ ! -e "bsp" ]; then
echo "Error: missing bsp directory structure"
echo "Please clone the full repository ${kaligit}/build-scripts/kali-arm"
exit 255
fi
@@ -96,10 +99,12 @@ work_dir="${basedir}/kali-${architecture}"
# Check directory build
if [ -e "${basedir}" ]; then
echo "${basedir} directory exists, will not continue"
exit 1
elif [[ ${repo_dir} =~ [[:space:]] ]]; then
echo "The directory "\"${repo_dir}"\" contains whitespace. Not supported."
exit 1
else
@@ -188,10 +193,13 @@ if [ -e /usr/lib/${lib_arch}/libeatmydata.so ]; then
[ -n "\${LD_PRELOAD}" ] && LD_PRELOAD="\$LD_PRELOAD:"
LD_PRELOAD="\$LD_PRELOAD\$so"
fi
for so in /usr/lib/${lib_arch}/libeatmydata.so; do
[ -n "\$LD_PRELOAD" ] && LD_PRELOAD="\$LD_PRELOAD:"
LD_PRELOAD="\$LD_PRELOAD\$so"
done
export LD_PRELOAD
exec "\$0-eatmydata" --force-unsafe-io "\$@"
EOF
@@ -492,10 +500,11 @@ losetup -d ${loopdevice}
# Limite use cpu function
limit_cpu() {
# Random name group
rand=$(
tr -cd 'A-Za-z0-9' </dev/urandom | head -c4
echo
) # Randowm name group
)
cgcreate -g cpu:/cpulimit-${rand} # Name of group cpulimit
cgset -r cpu.shares=800 cpulimit-${rand} # Max 1024
@@ -525,8 +534,13 @@ limit_cpu() {
if [ $compress = xz ]; then
if [ $(arch) == 'x86_64' ]; then
echo "Compressing ${imagename}.img"
[ $(nproc) -lt 3 ] || cpu_cores=3 # cpu_cores = Number of cores to use
limit_cpu pixz -p ${cpu_cores:-2} ${repo_dir}/${imagename}.img # -p Nº cpu cores use
# cpu_cores = Number of cores to use
[ $(nproc) -lt 3 ] || cpu_cores=3
# -p Nº cpu cores use
limit_cpu pixz -p ${cpu_cores:-2} ${repo_dir}/${imagename}.img
chmod 644 ${repo_dir}/${imagename}.img.xz
fi