Modified command parameters
create config tree if not existing
This commit is contained in:
parent
78c432a294
commit
f1ff1b3d17
@ -38,7 +38,7 @@ function error()
|
|||||||
|
|
||||||
SOURCE_PATH="`/bin/dirname \"$(readlink -f \"$0\")\"`"
|
SOURCE_PATH="`/bin/dirname \"$(readlink -f \"$0\")\"`"
|
||||||
INSTALL_PATH="$SOURCE_PATH/raspi"
|
INSTALL_PATH="$SOURCE_PATH/raspi"
|
||||||
|
FILES_PATH="$SOURCE_PATH/files"
|
||||||
CMDNAME=`/bin/basename -z "$0"`
|
CMDNAME=`/bin/basename -z "$0"`
|
||||||
|
|
||||||
#while read -r;do
|
#while read -r;do
|
||||||
@ -67,9 +67,8 @@ function help()
|
|||||||
echo "--chroot chroot to arm directory and launch packages installation"
|
echo "--chroot chroot to arm directory and launch packages installation"
|
||||||
echo "--create-image Create the image of Mageia $MAGEIA_VERSION"
|
echo "--create-image Create the image of Mageia $MAGEIA_VERSION"
|
||||||
echo "--build-path Path to the build directory of the image of Mageia $MAGEIA_VERSION"
|
echo "--build-path Path to the build directory of the image of Mageia $MAGEIA_VERSION"
|
||||||
echo "--config Path to config file to use"
|
echo "--target target system (for now rpi, xu3, xu4)"
|
||||||
echo "--rpi Create Raspberry 2 and 3 image"
|
echo "--config Path to config files"
|
||||||
echo "--xu4 Create Odroid XU3 and XU4 image"
|
|
||||||
echo "--bootfs filesystem of boot partition (ext4 or vfat) default: etx4"
|
echo "--bootfs filesystem of boot partition (ext4 or vfat) default: etx4"
|
||||||
echo "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)"
|
echo "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)"
|
||||||
}
|
}
|
||||||
@ -528,7 +527,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# parsing commandline
|
# parsing commandline
|
||||||
TEMP=`getopt -o h,a --long all,help,clean,create-chroot,addmedia,create-image,rpi,xu3-4,config:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size: -n $CMDNAME -- "$@"`
|
TEMP=`getopt -o h,a --long all,help,clean,create-chroot,addmedia,create-image,,config:,target:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size: -n $CMDNAME -- "$@"`
|
||||||
if [ $? -ne 0 ] ; then error "line $LINENO Failed parsing options." >&2 ; exit 1 ; fi
|
if [ $? -ne 0 ] ; then error "line $LINENO Failed parsing options." >&2 ; exit 1 ; fi
|
||||||
eval set -- "$TEMP"
|
eval set -- "$TEMP"
|
||||||
|
|
||||||
@ -596,13 +595,9 @@ do
|
|||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--xu3-4)
|
--system)
|
||||||
TARGET="xu3-4"
|
SYSTEM=$2
|
||||||
shift
|
shift 2
|
||||||
;;
|
|
||||||
--rpi)
|
|
||||||
TARGET="rpi"
|
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
--config)
|
--config)
|
||||||
CONFIG_PATH=$2
|
CONFIG_PATH=$2
|
||||||
@ -627,31 +622,36 @@ BOOT="/mnt/boot"
|
|||||||
ROOT="/mnt/root"
|
ROOT="/mnt/root"
|
||||||
BUILD_PATH="$INSTALL_PATH/build"
|
BUILD_PATH="$INSTALL_PATH/build"
|
||||||
ARM_VERSION="armv7hl"
|
ARM_VERSION="armv7hl"
|
||||||
|
if [ -z $CONFIG_PATH ];then
|
||||||
if [ -e "./$CONFIG_PATH" ];then
|
CONFIG_PATH="./$SYSTEM"
|
||||||
info "using $CONFIG_PATH as config"
|
|
||||||
. "./$CONFIG_PATH"
|
|
||||||
else
|
|
||||||
$CONFIG_PATH="$SOURCE_PATH/config/`basename $CONFIG_PATH`"
|
|
||||||
if [ -e "$CONFIG_PATH" ];then
|
|
||||||
. "$CONFIG_PATH"
|
|
||||||
info "using $CONFIG_PATH as config"
|
|
||||||
else
|
|
||||||
warning "$CONFIG_PATH do not exists"
|
|
||||||
if [ -e "$SOURCE_PATH/config/config.txt" ];then
|
|
||||||
. "$SOURCE_PATH/config.txt"
|
|
||||||
warning "Using $SOURCE_PATH/config.txt as config file"
|
|
||||||
else
|
|
||||||
warning "config file does not exist !! Default config will be used"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -d "./$CONFIG_PATH" ];then
|
||||||
|
if [-e "./$CONFIG_PATH/config.txt" ]
|
||||||
|
info "using $CONFIG_PATH/config.txt as config"
|
||||||
|
. "./$CONFIG_PATH/config.txt"
|
||||||
|
else
|
||||||
|
warning "Config file does not exists, do you want i copy template ? [Y|n] "
|
||||||
|
read yn
|
||||||
|
if [ -z $yn || $yn -eq "Y" || $yn -eq "y" ];then
|
||||||
|
/usr/bin/cp ./config.template "./$CONFIG_PATH/config.txt"
|
||||||
|
fi
|
||||||
|
/usr/bin/cp ./config.template "./$CONFIG_PATH/config.txt"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warning "Config directory does not exists, do you want i make it and copy the template file in? [Y|n] "
|
||||||
|
read yn
|
||||||
|
if [ -z $yn || $yn -eq "Y" || $yn -eq "y" ];then
|
||||||
|
/usr/bin/mkdir ./$CONFIG_PATH/
|
||||||
|
/usr/bin/cp ./config.template "./$CONFIG_PATH/config.txt"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# assign TARGET ( rpi or xu3-4 )
|
# assign TARGET ( rpi or xu3-4 )
|
||||||
if [ $CREATEIMAGE ];then
|
if [ $CREATEIMAGE ];then
|
||||||
case $TARGET in
|
case $TARGET in
|
||||||
xu3-4)
|
xu3||xu4)
|
||||||
CREATEIMG="createxu3image"
|
CREATEIMG="createxu3-4image"
|
||||||
break;;
|
break;;
|
||||||
rpi)
|
rpi)
|
||||||
CREATEIMG="createrpiimage"
|
CREATEIMG="createrpiimage"
|
||||||
@ -661,7 +661,7 @@ if [ $CREATEIMAGE ];then
|
|||||||
break;;
|
break;;
|
||||||
*)
|
*)
|
||||||
CREATEIMG="createxu3-4image"
|
CREATEIMG="createxu3-4image"
|
||||||
TARGET="xu3-4"
|
TARGET="xu4"
|
||||||
break;;
|
break;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user