1
0

Bug loop if --tainted or --nonfree as there is no shift.

This commit is contained in:
Jybz 2019-10-02 20:27:24 +00:00
parent e25243cb0c
commit 592ffa1602

View File

@ -406,9 +406,10 @@ createimage()
echo -e "${FDISK_SCRIPT}" | /sbin/fdisk ${DEVICE} echo -e "${FDISK_SCRIPT}" | /sbin/fdisk ${DEVICE}
# Activate loop device # Activate loop device
info "device to detach ${DEVICE}"
/sbin/losetup -d "${DEVICE}" /sbin/losetup -d "${DEVICE}"
DEVICE=$(/sbin/partx -va "${INSTALL_PATH}/${IMAGE}" | /bin/grep -m 1 -E -o '/dev/loop.?') DEVICE=$(/sbin/partx -va "${INSTALL_PATH}/${IMAGE}" | /bin/grep -m 1 -E -o '/dev/loop.?')
info "device ${DEVICE}" info "New attached device ${DEVICE}"
info "partitions list:" info "partitions list:"
info "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")" info "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")"
BOOTP="${DEVICE}p1" BOOTP="${DEVICE}p1"
@ -563,8 +564,8 @@ ERRORN=0
ERR_1=1 ERR_1=1
ERR_DEFAULT_CONFIG=2 ERR_DEFAULT_CONFIG=2
ERR_NO_CONFIG_FILE=3 ERR_NO_CONFIG_FILE=3
ERR_4=4 ERR_NOT_ROOT=4
ERR_5=5 ERR_DEPENDENCY_MISSING=5
ERR_NO_SPACE=6 ERR_NO_SPACE=6
ERR_7=7 ERR_7=7
ERR_8=8 ERR_8=8
@ -578,6 +579,16 @@ ERR_9=9
info ${0} info ${0}
#Check dependencies :
#if [ -e /usr/bin/qemu-arm-static ]; then
# error "qemu-user-static package is needed."
# exit ${ERR_DEPENDENCY_MISSING}
#fi
#if [ 0 -ne $(id -u) ]; then
# error "Script need to be run as root."
# exit ${ERR_NOT_ROOT}
#fi
SOURCE_PATH="$(/bin/dirname "$(readlink -f "${0}")")" SOURCE_PATH="$(/bin/dirname "$(readlink -f "${0}")")"
INSTALL_PATH="${SOURCE_PATH}/arm" INSTALL_PATH="${SOURCE_PATH}/arm"
FILES_PATH="${SOURCE_PATH}/files" FILES_PATH="${SOURCE_PATH}/files"
@ -618,7 +629,7 @@ while true; do
shift 2 shift 2
;; ;;
--build-path) --build-path)
INSTALL_PATH_P="${2}" INSTALL_PATH_P=$(readlink -f "${2}")
shift 2 shift 2
;; ;;
--chroot) --chroot)
@ -676,9 +687,11 @@ while true; do
;; ;;
--nonfree) --nonfree)
NONFREE_P=1 NONFREE_P=1
shift
;; ;;
--tainted) --tainted)
TAINTED_P=1 TAINTED_P=1
shift
;; ;;
--) --)
shift shift
@ -702,7 +715,7 @@ if ! [ -d "${CONFIG_PATH}" ]; then
warning "You need now to modify the config file (${CONFIG_PATH}/mageia4arm.cfg) and relaunch the script" warning "You need now to modify the config file (${CONFIG_PATH}/mageia4arm.cfg) and relaunch the script"
exit ${ERR_DEFAULT_CONFIG} exit ${ERR_DEFAULT_CONFIG}
else else
error( "Error: Can't continue without config file, exiting" ) error "Error: Can't continue without config file, exiting"
exit ${ERR_NO_CONFIG_FILE} exit ${ERR_NO_CONFIG_FILE}
fi fi
fi fi
@ -711,7 +724,7 @@ if [ -e "${CONFIG_PATH}/mageia4arm.cfg" ]; then
info "using ${CONFIG_PATH}/mageia4arm.cfg as config" info "using ${CONFIG_PATH}/mageia4arm.cfg as config"
source "${CONFIG_PATH}/mageia4arm.cfg" #NOTE1 : Here is sourced a file with variables. source "${CONFIG_PATH}/mageia4arm.cfg" #NOTE1 : Here is sourced a file with variables.
else else
warning "Config file does not exists, do you want i copy template ? [Y|n] " warning "Config file does not exists, do you want to copy template ? [Y|n] "
read yn read yn
if [ -z ${yn} ] || [ ${yn} = "Y" ] || [ ${yn} = "y" ]; then if [ -z ${yn} ] || [ ${yn} = "Y" ] || [ ${yn} = "y" ]; then
/usr/bin/cp --preserve=mode "${SOURCE_PATH}/mageia4arm.cfg.template" "${CONFIG_PATH}/mageia4arm.cfg" /usr/bin/cp --preserve=mode "${SOURCE_PATH}/mageia4arm.cfg.template" "${CONFIG_PATH}/mageia4arm.cfg"
@ -737,9 +750,13 @@ if ! [ -z "${BOOTFS_P}" ]; then
fi fi
if ! [ -z "${NONFREE_P}" ]; then if ! [ -z "${NONFREE_P}" ]; then
NONFREE=${NONFREE_P} NONFREE=${NONFREE_P}
else
NONFREE=0
fi fi
if ! [ -z "${TAINTED_P}" ]; then if ! [ -z "${TAINTED_P}" ]; then
TAINTED=${TAINTED_P} TAINTED=${TAINTED_P}
else
TAINTED=0
fi fi
info "Option: "${OPT} info "Option: "${OPT}