diff options
author | Daniel Tartavel <contact@librepc.com> | 2020-01-05 21:54:31 +0100 |
---|---|---|
committer | Daniel Tartavel <contact@librepc.com> | 2020-01-05 21:54:31 +0100 |
commit | c5531c36c3dbab601c44ed0171e7cedcafc0b9e9 (patch) | |
tree | 3f752b24f3b7216a1ed557905d5ef7b4d464b8f5 | |
parent | 895688d085f8991ccefdbe147c568f332fd508fa (diff) | |
download | mageia4arm-c5531c36c3dbab601c44ed0171e7cedcafc0b9e9.tar mageia4arm-c5531c36c3dbab601c44ed0171e7cedcafc0b9e9.tar.gz mageia4arm-c5531c36c3dbab601c44ed0171e7cedcafc0b9e9.tar.bz2 mageia4arm-c5531c36c3dbab601c44ed0171e7cedcafc0b9e9.tar.xz mageia4arm-c5531c36c3dbab601c44ed0171e7cedcafc0b9e9.zip |
reactivated test of root user
-rwxr-xr-x | create_arm_image.sh | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/create_arm_image.sh b/create_arm_image.sh index 039e5c8..2479390 100755 --- a/create_arm_image.sh +++ b/create_arm_image.sh @@ -53,7 +53,7 @@ function help() { echo -e "--bootfs filesystem of boot partition (ext4 or vfat) default: ext4" echo -e "--nonfree activate nonfree repos" echo -e "--tainted activate tainted repos" - + echo -e "\nBuild levels:" echo -e "--create-chroot Create the chroot directory" echo -e "--install-basesystem install base system" @@ -61,7 +61,7 @@ function help() { echo -e "--chroot chroot to arm directory and launch packages installation" echo -e "--create-image Create the image of Mageia ${MAGEIA_VERSION}" echo "--config Path to config files (rpi1 rpi2 rpi3 rpi3+ xu4)" - + echo -e "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)" } @@ -159,10 +159,10 @@ function enableextrarepos() function addurpmimedia() { title "Creating media ${MIRROR}" - + info "Removing old media" /sbin/urpmi.removemedia --urpmi-root "${BUILD_PATH}" -a - + info "Adding media" if [ ! -z "${MIRROR}" ] ; then /sbin/urpmi.addmedia --urpmi-root "${BUILD_PATH}" --distrib "${MIRROR}" @@ -170,7 +170,7 @@ function addurpmimedia() info "MIRROR variable not set, using mirrorlist." /sbin/urpmi.addmedia --urpmi-root "${BUILD_PATH}" --distrib --mirrorlist "http://mirrors.mageia.org/api/mageia.${MAGEIA_VERSION}.${ARM_VERSION}.list" fi - + err=${?} if [ ${err} -ne 0 ]; then error "line ${LINENO} error ${err} - can't add medias from ${MIRROR} : exiting" @@ -286,7 +286,7 @@ function preparechroot() info "No root password... One password will be set at the first login." echo -e "/bin/passwd -d root\n/bin/passwd -e root\n" >>"${BUILD_PATH}/second_stage_install.sh" fi - + if [ -n "${ID_USER}" ]; then #If user ID defined, it will be setted at the end of the chroot of the second_stage_install.sh script echo -e " /sbin/useradd ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh" if [ -n "${PASSWORD}" ]; then @@ -380,7 +380,7 @@ function createImageWrap() BOOTFS="ext4" fi formatpartitions ${BOOTFS} ext4 - + return 0 } @@ -403,9 +403,9 @@ function createimage() error "line ${LINENO} can't make image at ${INSTALL_PATH}/${IMAGE} : exiting" exit ${ERR_1} fi - + loopingImage - + bunrningBootloader if [ ${?} -ne 0 ]; then error "line ${LINENO} error in the process ${CONFIG_PATH}/specialFunctions.sh ." @@ -433,7 +433,7 @@ function createimage() function loopingImage() { title "Looping image ..." - + # Mettre en place et contrôler des périphériques boucle. # -f, --find trouver le premier périphérique inutilisé # --show afficher le nom du périphérique après configuration (avec -f) @@ -467,7 +467,7 @@ function formatpartitions() fi ROOT_UUID=$(blkid -s UUID -o value UUID "${ROOTP}") info "Root UUID: ${ROOT_UUID}" - + return 0 } @@ -496,10 +496,10 @@ function generateExtlinux() function copyingsystem() { generateExtlinux - + info "Remove second_stage_install.sh" /bin/rm -f "${BUILD_PATH}/second_stage_install.sh" - + if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then ARM_BOOT="${BUILD_PATH}/mnt/arm_boot" if ! [ -d "${ARM_BOOT}" ]; then @@ -514,7 +514,7 @@ function copyingsystem() info "copying Mageia image to root partition" /bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" fi - + copyingCustomSystem if [ ${?} -ne 0 ]; then error "line ${LINENO} error in the process ${CONFIG_PATH}/specialFunctions.sh ." @@ -531,7 +531,7 @@ function copyingsystem() function mountPartitions(){ info "mounting partitions, making mountpoint if necessary" - + if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then if ! [ -d "${BOOT}" ]; then /bin/mkdir "${BOOT}" @@ -546,7 +546,7 @@ function mountPartitions(){ exit ${ERR_1} fi fi - + if ! [ -d "${ROOT}" ]; then /bin/mkdir "${ROOT}" if [ ${?} -ne 0 ]; then @@ -565,20 +565,20 @@ function mountPartitions(){ function unmountingPartitions() { title "Unmounting partitions..." - + # Syncing devices before unmounting /usr/bin/sync - + if [ -z "${BOOTP}" ] && [ -z "${ROOTP}" ] ; then warning "Root partition and Boot partition not defined !" - + for LOOP in $(losetup -l -O NAME,BACK-FILE -n | grep "${IMAGE}" | cut -d ' ' -f 1 ) ; do IFS=$'\n' for PARTITION in $(mount -l | grep ${LOOP}); do MOUNTPOINT=$(echo "$PARTITION" | cut -d ' ' -f 3) PARTITION=$(echo "$PARTITION" | cut -d ' ' -f 1) info "unmount ${PARTITION} and remove ${MOUNTPOINT}" - /usr/bin/umount "${PARTITION}" + /usr/bin/umount "${PARTITION}" if [ ${?} -eq 0 ]; then /bin/rmdir "${MOUNTPOINT}" else @@ -589,14 +589,14 @@ function unmountingPartitions() done else if [ ! -z "${BOOTP}" ]; then - /usr/bin/umount "${BOOTP}" + /usr/bin/umount "${BOOTP}" if [ ${?} -eq 0 ]; then /bin/rmdir "${BOOT}" else error "line ${LINENO} error unmounting ${BOOT}..." fi fi - /usr/bin/umount "${ROOTP}" + /usr/bin/umount "${ROOTP}" if [ ${?} -eq 0 ]; then /bin/rmdir "${ROOT}" else @@ -624,7 +624,7 @@ function unloopingImage(){ # losetup -d "${LOOP}" kpartx -d "${INSTALL_PATH}/${IMAGE}" done - + return 0 } @@ -659,7 +659,7 @@ function mkfstab() function clean() { title "Cleaning" - + unmountingPartitions unloopingImage @@ -733,10 +733,10 @@ info ${0} # 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 +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="$(pwd)/build" @@ -865,7 +865,7 @@ if ! [ -d "${CONFIG_PATH}" ]; then exit ${ERR_DEFAULT_CONFIG} else error "Error: Can't continue without config file, exiting" - exit ${ERR_NO_CONFIG_FILE} + exit ${ERR_NO_CONFIG_FILE} fi fi @@ -978,7 +978,7 @@ case ${OPT} in installbasesystem #Generate the rootfs, rootfiles, ... enableextrarepos addurpmimedia - mkfstab + mkfstab preparechroot jumpchroot #Check before is useless (with $MIRROR |