reactivated test of root user
This commit is contained in:
parent
895688d085
commit
c5531c36c3
@ -53,7 +53,7 @@ function help() {
|
|||||||
echo -e "--bootfs filesystem of boot partition (ext4 or vfat) default: ext4"
|
echo -e "--bootfs filesystem of boot partition (ext4 or vfat) default: ext4"
|
||||||
echo -e "--nonfree activate nonfree repos"
|
echo -e "--nonfree activate nonfree repos"
|
||||||
echo -e "--tainted activate tainted repos"
|
echo -e "--tainted activate tainted repos"
|
||||||
|
|
||||||
echo -e "\nBuild levels:"
|
echo -e "\nBuild levels:"
|
||||||
echo -e "--create-chroot Create the chroot directory"
|
echo -e "--create-chroot Create the chroot directory"
|
||||||
echo -e "--install-basesystem install base system"
|
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 "--chroot chroot to arm directory and launch packages installation"
|
||||||
echo -e "--create-image Create the image of Mageia ${MAGEIA_VERSION}"
|
echo -e "--create-image Create the image of Mageia ${MAGEIA_VERSION}"
|
||||||
echo "--config Path to config files (rpi1 rpi2 rpi3 rpi3+ xu4)"
|
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)"
|
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()
|
function addurpmimedia()
|
||||||
{
|
{
|
||||||
title "Creating media ${MIRROR}"
|
title "Creating media ${MIRROR}"
|
||||||
|
|
||||||
info "Removing old media"
|
info "Removing old media"
|
||||||
/sbin/urpmi.removemedia --urpmi-root "${BUILD_PATH}" -a
|
/sbin/urpmi.removemedia --urpmi-root "${BUILD_PATH}" -a
|
||||||
|
|
||||||
info "Adding media"
|
info "Adding media"
|
||||||
if [ ! -z "${MIRROR}" ] ; then
|
if [ ! -z "${MIRROR}" ] ; then
|
||||||
/sbin/urpmi.addmedia --urpmi-root "${BUILD_PATH}" --distrib "${MIRROR}"
|
/sbin/urpmi.addmedia --urpmi-root "${BUILD_PATH}" --distrib "${MIRROR}"
|
||||||
@ -170,7 +170,7 @@ function addurpmimedia()
|
|||||||
info "MIRROR variable not set, using mirrorlist."
|
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"
|
/sbin/urpmi.addmedia --urpmi-root "${BUILD_PATH}" --distrib --mirrorlist "http://mirrors.mageia.org/api/mageia.${MAGEIA_VERSION}.${ARM_VERSION}.list"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
err=${?}
|
err=${?}
|
||||||
if [ ${err} -ne 0 ]; then
|
if [ ${err} -ne 0 ]; then
|
||||||
error "line ${LINENO} error ${err} - can't add medias from ${MIRROR} : exiting"
|
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."
|
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"
|
echo -e "/bin/passwd -d root\n/bin/passwd -e root\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
||||||
fi
|
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
|
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"
|
echo -e " /sbin/useradd ${ID_USER}\n" >>"${BUILD_PATH}/second_stage_install.sh"
|
||||||
if [ -n "${PASSWORD}" ]; then
|
if [ -n "${PASSWORD}" ]; then
|
||||||
@ -380,7 +380,7 @@ function createImageWrap()
|
|||||||
BOOTFS="ext4"
|
BOOTFS="ext4"
|
||||||
fi
|
fi
|
||||||
formatpartitions ${BOOTFS} ext4
|
formatpartitions ${BOOTFS} ext4
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,9 +403,9 @@ function createimage()
|
|||||||
error "line ${LINENO} can't make image at ${INSTALL_PATH}/${IMAGE} : exiting"
|
error "line ${LINENO} can't make image at ${INSTALL_PATH}/${IMAGE} : exiting"
|
||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
loopingImage
|
loopingImage
|
||||||
|
|
||||||
bunrningBootloader
|
bunrningBootloader
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error in the process ${CONFIG_PATH}/specialFunctions.sh ."
|
error "line ${LINENO} error in the process ${CONFIG_PATH}/specialFunctions.sh ."
|
||||||
@ -433,7 +433,7 @@ function createimage()
|
|||||||
function loopingImage()
|
function loopingImage()
|
||||||
{
|
{
|
||||||
title "Looping image ..."
|
title "Looping image ..."
|
||||||
|
|
||||||
# Mettre en place et contrôler des périphériques boucle.
|
# Mettre en place et contrôler des périphériques boucle.
|
||||||
# -f, --find trouver le premier périphérique inutilisé
|
# -f, --find trouver le premier périphérique inutilisé
|
||||||
# --show afficher le nom du périphérique après configuration (avec -f)
|
# --show afficher le nom du périphérique après configuration (avec -f)
|
||||||
@ -467,7 +467,7 @@ function formatpartitions()
|
|||||||
fi
|
fi
|
||||||
ROOT_UUID=$(blkid -s UUID -o value UUID "${ROOTP}")
|
ROOT_UUID=$(blkid -s UUID -o value UUID "${ROOTP}")
|
||||||
info "Root UUID: ${ROOT_UUID}"
|
info "Root UUID: ${ROOT_UUID}"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,10 +496,10 @@ function generateExtlinux()
|
|||||||
function copyingsystem()
|
function copyingsystem()
|
||||||
{
|
{
|
||||||
generateExtlinux
|
generateExtlinux
|
||||||
|
|
||||||
info "Remove second_stage_install.sh"
|
info "Remove second_stage_install.sh"
|
||||||
/bin/rm -f "${BUILD_PATH}/second_stage_install.sh"
|
/bin/rm -f "${BUILD_PATH}/second_stage_install.sh"
|
||||||
|
|
||||||
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||||
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
|
ARM_BOOT="${BUILD_PATH}/mnt/arm_boot"
|
||||||
if ! [ -d "${ARM_BOOT}" ]; then
|
if ! [ -d "${ARM_BOOT}" ]; then
|
||||||
@ -514,7 +514,7 @@ function copyingsystem()
|
|||||||
info "copying Mageia image to root partition"
|
info "copying Mageia image to root partition"
|
||||||
/bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
/bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
copyingCustomSystem
|
copyingCustomSystem
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
error "line ${LINENO} error in the process ${CONFIG_PATH}/specialFunctions.sh ."
|
error "line ${LINENO} error in the process ${CONFIG_PATH}/specialFunctions.sh ."
|
||||||
@ -531,7 +531,7 @@ function copyingsystem()
|
|||||||
|
|
||||||
function mountPartitions(){
|
function mountPartitions(){
|
||||||
info "mounting partitions, making mountpoint if necessary"
|
info "mounting partitions, making mountpoint if necessary"
|
||||||
|
|
||||||
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then
|
||||||
if ! [ -d "${BOOT}" ]; then
|
if ! [ -d "${BOOT}" ]; then
|
||||||
/bin/mkdir "${BOOT}"
|
/bin/mkdir "${BOOT}"
|
||||||
@ -546,7 +546,7 @@ function mountPartitions(){
|
|||||||
exit ${ERR_1}
|
exit ${ERR_1}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -d "${ROOT}" ]; then
|
if ! [ -d "${ROOT}" ]; then
|
||||||
/bin/mkdir "${ROOT}"
|
/bin/mkdir "${ROOT}"
|
||||||
if [ ${?} -ne 0 ]; then
|
if [ ${?} -ne 0 ]; then
|
||||||
@ -565,20 +565,20 @@ function mountPartitions(){
|
|||||||
function unmountingPartitions()
|
function unmountingPartitions()
|
||||||
{
|
{
|
||||||
title "Unmounting partitions..."
|
title "Unmounting partitions..."
|
||||||
|
|
||||||
# Syncing devices before unmounting
|
# Syncing devices before unmounting
|
||||||
/usr/bin/sync
|
/usr/bin/sync
|
||||||
|
|
||||||
if [ -z "${BOOTP}" ] && [ -z "${ROOTP}" ] ; then
|
if [ -z "${BOOTP}" ] && [ -z "${ROOTP}" ] ; then
|
||||||
warning "Root partition and Boot partition not defined !"
|
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
|
for LOOP in $(losetup -l -O NAME,BACK-FILE -n | grep "${IMAGE}" | cut -d ' ' -f 1 ) ; do
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for PARTITION in $(mount -l | grep ${LOOP}); do
|
for PARTITION in $(mount -l | grep ${LOOP}); do
|
||||||
MOUNTPOINT=$(echo "$PARTITION" | cut -d ' ' -f 3)
|
MOUNTPOINT=$(echo "$PARTITION" | cut -d ' ' -f 3)
|
||||||
PARTITION=$(echo "$PARTITION" | cut -d ' ' -f 1)
|
PARTITION=$(echo "$PARTITION" | cut -d ' ' -f 1)
|
||||||
info "unmount ${PARTITION} and remove ${MOUNTPOINT}"
|
info "unmount ${PARTITION} and remove ${MOUNTPOINT}"
|
||||||
/usr/bin/umount "${PARTITION}"
|
/usr/bin/umount "${PARTITION}"
|
||||||
if [ ${?} -eq 0 ]; then
|
if [ ${?} -eq 0 ]; then
|
||||||
/bin/rmdir "${MOUNTPOINT}"
|
/bin/rmdir "${MOUNTPOINT}"
|
||||||
else
|
else
|
||||||
@ -589,14 +589,14 @@ function unmountingPartitions()
|
|||||||
done
|
done
|
||||||
else
|
else
|
||||||
if [ ! -z "${BOOTP}" ]; then
|
if [ ! -z "${BOOTP}" ]; then
|
||||||
/usr/bin/umount "${BOOTP}"
|
/usr/bin/umount "${BOOTP}"
|
||||||
if [ ${?} -eq 0 ]; then
|
if [ ${?} -eq 0 ]; then
|
||||||
/bin/rmdir "${BOOT}"
|
/bin/rmdir "${BOOT}"
|
||||||
else
|
else
|
||||||
error "line ${LINENO} error unmounting ${BOOT}..."
|
error "line ${LINENO} error unmounting ${BOOT}..."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
/usr/bin/umount "${ROOTP}"
|
/usr/bin/umount "${ROOTP}"
|
||||||
if [ ${?} -eq 0 ]; then
|
if [ ${?} -eq 0 ]; then
|
||||||
/bin/rmdir "${ROOT}"
|
/bin/rmdir "${ROOT}"
|
||||||
else
|
else
|
||||||
@ -624,7 +624,7 @@ function unloopingImage(){
|
|||||||
# losetup -d "${LOOP}"
|
# losetup -d "${LOOP}"
|
||||||
kpartx -d "${INSTALL_PATH}/${IMAGE}"
|
kpartx -d "${INSTALL_PATH}/${IMAGE}"
|
||||||
done
|
done
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,7 +659,7 @@ function mkfstab()
|
|||||||
function clean()
|
function clean()
|
||||||
{
|
{
|
||||||
title "Cleaning"
|
title "Cleaning"
|
||||||
|
|
||||||
unmountingPartitions
|
unmountingPartitions
|
||||||
unloopingImage
|
unloopingImage
|
||||||
|
|
||||||
@ -733,10 +733,10 @@ info ${0}
|
|||||||
# error "qemu-user-static package is needed."
|
# error "qemu-user-static package is needed."
|
||||||
# exit ${ERR_DEPENDENCY_MISSING}
|
# exit ${ERR_DEPENDENCY_MISSING}
|
||||||
#fi
|
#fi
|
||||||
#if [ 0 -ne $(id -u) ]; then
|
if [ 0 -ne $(id -u) ]; then
|
||||||
# error "Script need to be run as root."
|
error "Script need to be run as root."
|
||||||
# exit ${ERR_NOT_ROOT}
|
exit ${ERR_NOT_ROOT}
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
SOURCE_PATH="$(/bin/dirname "$(readlink -f "${0}")")"
|
SOURCE_PATH="$(/bin/dirname "$(readlink -f "${0}")")"
|
||||||
INSTALL_PATH="$(pwd)/build"
|
INSTALL_PATH="$(pwd)/build"
|
||||||
@ -865,7 +865,7 @@ if ! [ -d "${CONFIG_PATH}" ]; then
|
|||||||
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
|
||||||
|
|
||||||
@ -978,7 +978,7 @@ case ${OPT} in
|
|||||||
installbasesystem #Generate the rootfs, rootfiles, ...
|
installbasesystem #Generate the rootfs, rootfiles, ...
|
||||||
enableextrarepos
|
enableextrarepos
|
||||||
addurpmimedia
|
addurpmimedia
|
||||||
mkfstab
|
mkfstab
|
||||||
preparechroot
|
preparechroot
|
||||||
jumpchroot
|
jumpchroot
|
||||||
#Check before is useless (with $MIRROR
|
#Check before is useless (with $MIRROR
|
||||||
|
Reference in New Issue
Block a user