tree: codestyle fix

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2023-11-04 15:29:09 +01:00
parent eef719f531
commit 8d387227d9
3 changed files with 11 additions and 11 deletions

View File

@ -117,7 +117,7 @@ function arcMenu() {
dialog --backtitle "$(backtitle)" --title "Model" --aspect 18 \
--infobox "Reading models" 3 20
echo -n "" >"${TMP_PATH}/modellist"
while read M; do
while read -r M; do
Y="$(readModelKey "${M}" "disks")"
echo "${M} ${Y}" >>"${TMP_PATH}/modellist"
done < <(find "${MODEL_CONFIG_PATH}" -maxdepth 1 -name \*.yml | sed 's/.*\///; s/\.yml//')
@ -125,7 +125,7 @@ function arcMenu() {
while true; do
echo -n "" >"${TMP_PATH}/menu"
FLGNEX=0
while read M Y; do
while read -r M Y; do
PLATFORM=$(readModelKey "${M}" "platform")
DT="$(readModelKey "${M}" "dt")"
BETA="$(readModelKey "${M}" "beta")"
@ -1269,8 +1269,8 @@ function backupMenu() {
rz -be -B 536870912
for F in $(ls -A); do
USER_FILE="${F}"
[ "${F##*.}" = "zip" -a $(unzip -l "${TMP_PATH}/${USER_FILE}" | grep -c "\.img$") -eq 1 ] && IFTOOL="zip"
[ "${F##*.}" = "gz" -a "${F#*.}" = "img.gz" ] && IFTOOL="gzip"
[[ "${F##*.}" = "zip" && $(unzip -l "${TMP_PATH}/${USER_FILE}" | grep -c "\.img$") -eq 1 ]] && IFTOOL="zip"
[[ "${F##*.}" = "gz" && "${F#*.}" = "img.gz" ]] && IFTOOL="gzip"
break
done
popd
@ -2356,13 +2356,13 @@ function resetPassword() {
[ -z "${USER}" ] && return
while true; do
dialog --backtitle "$(backtitle)" --colors --title "Reset DSM Password" \
--inputbox "$(printf "Type a new password for user '%s'")" "${USER}" 0 70 "${CMDLINE[${NAME}]}" \
--inputbox "Type a new Password for User ${USER}" 0 70 "${CMDLINE[${NAME}]}" \
2>${TMP_PATH}/resp
[ $? -ne 0 ] && break 2
VALUE="$(<"${TMP_PATH}/resp")"
[ -n "${VALUE}" ] && break
dialog --backtitle "$(backtitle)" --colors --title "Reset DSM Password" \
--msgbox "Invalid password" 0 0
--msgbox "Invalid Password" 0 0
done
NEWPASSWD="$(python -c "import crypt,getpass;pw=\"${VALUE}\";print(crypt.crypt(pw))")"
(

View File

@ -204,7 +204,7 @@ function getBus() {
# 1 - ethN
function getIP() {
IP=""
if [ -n "${1}" -a -d "/sys/class/net/${1}" ]; then
if [[ -n "${1}" && -d "/sys/class/net/${1}" ]]; then
IP=$(ip route show dev ${1} 2>/dev/null | sed -n 's/.* via .* src \(.*\) metric .*/\1/p')
[ -z "${IP}" ] && IP=$(ip addr show ${1} | grep -E "inet .* eth" | awk '{print $2}' | cut -f1 -d'/' | head -1)
else
@ -220,7 +220,7 @@ function getIP() {
function findAndMountDSMRoot() {
[ $(mount | grep -i "${DSMROOT_PATH}" | wc -l) -gt 0 ] && return 0
dsmrootdisk="$(blkid | grep -i linux_raid_member | grep -E "/dev/.*1:" | head -1 | awk -F ":" '{print $1}')"
[ -z "${dsmrootdisk}" ] && return -1
[ -z "${dsmrootdisk}" ] && return 1
[ ! -d "${DSMROOT_PATH}" ] && mkdir -p "${DSMROOT_PATH}"
[ $(mount | grep -i "${DSMROOT_PATH}" | wc -l) -eq 0 ] && mount -t ext4 "${dsmrootdisk}" "${DSMROOT_PATH}"
if [ $(mount | grep -i "${DSMROOT_PATH}" | wc -l) -eq 0 ]; then
@ -387,7 +387,7 @@ function livepatch() {
# Rebooting
# (based on pocopico's TCRP code)
function rebootTo() {
[ "${1}" != "junior" -a "${1}" != "config" ] && exit 1
[[ "${1}" != "junior" && "${1}" != "config" ]] && exit 1
# echo "Rebooting to ${1} mode"
GRUBPATH="$(dirname $(find ${BOOTLOADER_PATH}/ -name grub.cfg | head -1))"
ENVFILE="${GRUBPATH}/grubenv"

View File

@ -248,7 +248,7 @@ function resizeImg() {
CHANGE_SIZE="${2}"
OUTPUT_FILE="${3:-${INPUT_FILE}}"
[ -z "${INPUT_FILE}" -o ! -f "${INPUT_FILE}" ] && exit 1
[[ -z "${INPUT_FILE}" || ! -f "${INPUT_FILE}" ]] && exit 1
[ -z "${CHANGE_SIZE}" ] && exit 1
INPUT_FILE="$(readlink -f "${INPUT_FILE}")"
@ -256,7 +256,7 @@ function resizeImg() {
SIZE=$(($(du -m "${INPUT_FILE}" | awk '{print $1}')$(echo "${CHANGE_SIZE}" | sed 's/M//g; s/b//g')))
[ -z "${SIZE}" -o "${SIZE}" -lt 0 ] && exit 1
[[ -z "${SIZE}" || "${SIZE}" -lt 0 ]] && exit 1
if [ ! "${INPUT_FILE}" = "${OUTPUT_FILE}" ]; then
sudo cp -f "${INPUT_FILE}" "${OUTPUT_FILE}"