diff --git a/create_arm_img_urpmi.sh b/create_arm_img_urpmi.sh index 5be0ee6..5d9141c 100644 --- a/create_arm_img_urpmi.sh +++ b/create_arm_img_urpmi.sh @@ -406,9 +406,10 @@ createimage() echo -e "${FDISK_SCRIPT}" | /sbin/fdisk ${DEVICE} # Activate loop device + info "device to detach ${DEVICE}" /sbin/losetup -d "${DEVICE}" 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 "$(/sbin/partx -v "${INSTALL_PATH}/${IMAGE}")" BOOTP="${DEVICE}p1" @@ -563,8 +564,8 @@ ERRORN=0 ERR_1=1 ERR_DEFAULT_CONFIG=2 ERR_NO_CONFIG_FILE=3 -ERR_4=4 -ERR_5=5 +ERR_NOT_ROOT=4 +ERR_DEPENDENCY_MISSING=5 ERR_NO_SPACE=6 ERR_7=7 ERR_8=8 @@ -578,6 +579,16 @@ ERR_9=9 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}")")" INSTALL_PATH="${SOURCE_PATH}/arm" FILES_PATH="${SOURCE_PATH}/files" @@ -618,7 +629,7 @@ while true; do shift 2 ;; --build-path) - INSTALL_PATH_P="${2}" + INSTALL_PATH_P=$(readlink -f "${2}") shift 2 ;; --chroot) @@ -676,9 +687,11 @@ while true; do ;; --nonfree) NONFREE_P=1 + shift ;; --tainted) TAINTED_P=1 + 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" exit ${ERR_DEFAULT_CONFIG} else - error( "Error: Can't continue without config file, exiting" ) + error "Error: Can't continue without config file, exiting" exit ${ERR_NO_CONFIG_FILE} fi fi @@ -711,7 +724,7 @@ if [ -e "${CONFIG_PATH}/mageia4arm.cfg" ]; then info "using ${CONFIG_PATH}/mageia4arm.cfg as config" source "${CONFIG_PATH}/mageia4arm.cfg" #NOTE1 : Here is sourced a file with variables. 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 if [ -z ${yn} ] || [ ${yn} = "Y" ] || [ ${yn} = "y" ]; then /usr/bin/cp --preserve=mode "${SOURCE_PATH}/mageia4arm.cfg.template" "${CONFIG_PATH}/mageia4arm.cfg" @@ -737,9 +750,13 @@ if ! [ -z "${BOOTFS_P}" ]; then fi if ! [ -z "${NONFREE_P}" ]; then NONFREE=${NONFREE_P} +else + NONFREE=0 fi if ! [ -z "${TAINTED_P}" ]; then TAINTED=${TAINTED_P} +else + TAINTED=0 fi info "Option: "${OPT}