mirror of
https://github.com/tuxbox-neutrino/buildenv.git
synced 2025-08-26 15:02:58 +02:00
refactor script
This commit is contained in:
@@ -1,9 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Function to replace the echo command
|
||||
function my_echo() {
|
||||
local no_term_output="$1"
|
||||
# Clean up text
|
||||
if [ "$no_term_output" == "true" ]; then
|
||||
shift
|
||||
fi
|
||||
local cleaned_output=$(echo -e "${@}" | sed -r "s/\x1B\[[0-9;]*[a-zA-Z]//g")
|
||||
# Write to log
|
||||
echo "[ $(date '+%Y-%m-%d %H:%M:%S') ] - ${cleaned_output}" >> "$LOGFILE"
|
||||
# Show on terminal
|
||||
if [[ "$no_term_output" != "true" && -t 1 ]]; then
|
||||
echo -e "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
# function for checking of valid machine(s)
|
||||
function is_valid_machine ()
|
||||
{
|
||||
ISM=$1
|
||||
local ISM=$1
|
||||
for M in $MACHINES ; do
|
||||
if [ "$ISM" == "$M" ] || [ "$MACHINE" == "all" ]; then
|
||||
echo true
|
||||
@@ -15,39 +31,53 @@ function is_valid_machine ()
|
||||
}
|
||||
|
||||
function do_exec() {
|
||||
DEX_ARG1=$1
|
||||
DEX_ARG2=$2
|
||||
DEX_ARG3=$3
|
||||
# rm -f $TMP_LOGFILE
|
||||
echo "[`date '+%Y%m%d_%H%M%S'`] EXEC: $DEX_ARG1" >> $LOGFILE
|
||||
if [ "$DEX_ARG3" == "show_output" ]; then
|
||||
$DEX_ARG1
|
||||
local cmd="$1"
|
||||
local exit_behavior="$2"
|
||||
local show_output="$3"
|
||||
local log_text
|
||||
local cmd_exit_status
|
||||
|
||||
my_echo true "[EXEC] $cmd"
|
||||
|
||||
# TODO: Evaluate alternatives to 'eval' for executing complex commands
|
||||
# Using 'eval' here allows for dynamic execution of commands that may include
|
||||
# special characters, variable expansions, or other complexities that are
|
||||
# difficult to handle with direct execution methods. However, 'eval' comes with
|
||||
# significant security implications, especially when dealing with untrusted input.
|
||||
# It executes the given string as a bash command, which can lead to code injection
|
||||
# vulnerabilities if not carefully managed. This usage is a temporary solution to
|
||||
# achieve desired functionality and should be revisited to explore safer alternatives.
|
||||
if [[ "$show_output" == "show_output" ]]; then
|
||||
eval $cmd 2>> "$TMP_LOGFILE"
|
||||
else
|
||||
$DEX_ARG1 > /dev/null 2>> $TMP_LOGFILE
|
||||
eval $cmd > /dev/null 2>> "$TMP_LOGFILE"
|
||||
fi
|
||||
# echo -e "DEX_ARG1 [$DEX_ARG1] DEX_ARG2 [$DEX_ARG2] DEX_ARG3 [$DEX_ARG3]"
|
||||
if test -f $TMP_LOGFILE; then
|
||||
LOGTEXT=`cat $TMP_LOGFILE`
|
||||
echo > $TMP_LOGFILE
|
||||
|
||||
cmd_exit_status=${PIPESTATUS[0]} # Get exit status of the first command in the last pipe
|
||||
|
||||
if [[ -f "$TMP_LOGFILE" ]]; then
|
||||
log_text=$(cat "$TMP_LOGFILE")
|
||||
>> "$LOGFILE" # Clear TMP_LOGFILE after reading
|
||||
fi
|
||||
if [ $? != 0 ]; then
|
||||
if [ "$DEX_ARG2" != "no_exit" ]; then
|
||||
if [ "$LOGTEXT" != "" ]; then
|
||||
echo -e "\033[31;1mERROR:\t\033[0m $LOGTEXT"
|
||||
echo "ERROR: $LOGTEXT" >> $LOGFILE
|
||||
|
||||
if [[ $cmd_exit_status -ne 0 ]]; then
|
||||
if [[ "$exit_behavior" != "no_exit" ]]; then
|
||||
if [[ -n "$log_text" ]]; then
|
||||
my_echo -e "\033[31;1mERROR:\033[0m $log_text"
|
||||
my_echo "ERROR: $log_text" >> "$LOGFILE"
|
||||
fi
|
||||
exit 1
|
||||
else
|
||||
if [ "$LOGTEXT" != "" ]; then
|
||||
echo -e "\033[37;1mNOTE:\t\033[0m $LOGTEXT"
|
||||
echo "NOTE: $LOGTEXT" >> $LOGFILE
|
||||
if [[ -n "$log_text" ]]; then
|
||||
my_echo -e "\033[37;1mNOTE:\033[0m $log_text"
|
||||
my_echo "NOTE: $log_text" >> "$LOGFILE"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function get_metaname () {
|
||||
TMP_NAME=$1
|
||||
local TMP_NAME=$1
|
||||
|
||||
if [ "$TMP_NAME" == "hd51" ] || [ "$TMP_NAME" == "bre2ze4k" ] || [ "$TMP_NAME" == "mutant51" ] || [ "$TMP_NAME" == "ax51" ]; then
|
||||
META_NAME="gfutures"
|
||||
@@ -66,51 +96,65 @@ function get_metaname () {
|
||||
}
|
||||
|
||||
# clone or update required branch for required meta-<layer>
|
||||
function clone_meta () {
|
||||
function fetch_meta() {
|
||||
local layer_name="$1"
|
||||
local branch_name="$2"
|
||||
local layer_git_url="$3"
|
||||
local branch_hash="$4"
|
||||
local target_git_path="$5"
|
||||
local patch_list="$6"
|
||||
|
||||
LAYER_NAME=$1
|
||||
BRANCH_NAME=$2
|
||||
LAYER_GIT_URL=$3
|
||||
BRANCH_HASH=$4
|
||||
TARGET_GIT_PATH=$5
|
||||
PATCH_LIST=$6
|
||||
local GIT_SSH_COMMAND=""
|
||||
if [[ "$GIT_SSH_KEYFILE" != "" ]]; then
|
||||
export GIT_SSH_COMMAND="$SSH -i \"$GIT_SSH_KEYFILE\""
|
||||
fi
|
||||
|
||||
#echo -e "Parameters= $LAYER_NAME $BRANCH_NAME $LAYER_GIT_URL $BRANCH_HASH $TARGET_GIT_PATH $PATCH_LIST"
|
||||
|
||||
TMP_LAYER_BRANCH=$BRANCH_NAME
|
||||
|
||||
if test ! -d $TARGET_GIT_PATH/.git; then
|
||||
echo -e "\033[35;1mclone branch $BRANCH_NAME from $LAYER_GIT_URL\033[0m"
|
||||
do_exec "git clone -b $BRANCH_NAME $LAYER_GIT_URL $TARGET_GIT_PATH" ' ' 'show_output'
|
||||
do_exec "git -C $TARGET_GIT_PATH checkout $BRANCH_HASH -b $IMAGE_VERSION"
|
||||
do_exec "git -C $TARGET_GIT_PATH pull -r origin $BRANCH_NAME" ' ' 'show_output'
|
||||
echo -e "\033[35;1mpatching $TARGET_GIT_PATH.\033[0m"
|
||||
for PF in $PATCH_LIST ; do
|
||||
PATCH_FILE="$FILES_DIR/$PF"
|
||||
echo -e "apply: $PATCH_FILE"
|
||||
do_exec "git -C $TARGET_GIT_PATH am $PATCH_FILE" ' ' 'show_output'
|
||||
done
|
||||
if [[ ! -d "$target_git_path/.git" ]]; then
|
||||
my_echo -e "Clone branch $branch_name from $layer_git_url into $target_git_path"
|
||||
if do_exec "git clone -b "$branch_name" "$layer_git_url" "$target_git_path""; then
|
||||
do_exec "git -C "$target_git_path" checkout "$branch_hash" -b "$IMAGE_VERSION""
|
||||
do_exec "git -C "$target_git_path" pull -r origin "$branch_name""
|
||||
else
|
||||
TMP_LAYER_BRANCH=`git -C $TARGET_GIT_PATH rev-parse --abbrev-ref HEAD`
|
||||
echo -e "\033[35;1mupdate $TARGET_GIT_PATH $TMP_LAYER_BRANCH\033[0m"
|
||||
do_exec "git -C $TARGET_GIT_PATH stash" 'no_exit'
|
||||
|
||||
if [ "$TMP_LAYER_BRANCH" != "$BRANCH_NAME" ]; then
|
||||
echo -e "switch from branch $TMP_LAYER_BRANCH to branch $BRANCH_NAME..."
|
||||
do_exec "git -C $TARGET_GIT_PATH checkout $BRANCH_NAME"
|
||||
my_echo -e "\033[31;1mError cloning $layer_name from $layer_git_url\033[0m"
|
||||
return 1
|
||||
fi
|
||||
## Patching
|
||||
if [[ -n "$patch_list" ]]; then
|
||||
for patch_file in $patch_list; do
|
||||
# First, check if the patch can be applied cleanly
|
||||
my_echo -e "Applying patch: $patch_file"
|
||||
if do_exec "git -C "$target_git_path" apply --check "$FILES_DIR/$patch_file""; then
|
||||
# Attempt to apply the patch if 'apply --check' was successful
|
||||
if ! do_exec "git -C "$target_git_path" am < "$FILES_DIR/$patch_file""; then
|
||||
# Error message if 'git am' fails
|
||||
my_echo -e "\033[31;1mFailed to apply patch $patch_file to $layer_name\033[0m"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
# Message about skipping if 'apply --check' fails
|
||||
my_echo -e "\033[33;1mSkipping patch $patch_file already applied or cannot be applied cleanly.\033[0m"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
if [[ $DO_UPDATE == "$true" ]]; then
|
||||
my_echo -e "Update $target_git_path on branch $branch_name"
|
||||
if [[ $(git -C "$target_git_path" stash list) ]]; then
|
||||
my_echo -e "Stashing changes in $target_git_path"
|
||||
do_exec "git -C "$target_git_path" stash push --include-untracked"
|
||||
local stash_applied=true
|
||||
fi
|
||||
do_exec "git -C "$target_git_path" checkout "$branch_name"" || do_exec "git -C "$target_git_path" checkout -b "$branch_name""
|
||||
do_exec "git -C "$target_git_path" pull -r origin "$branch_name""
|
||||
if [[ "$stash_applied" == true ]]; then
|
||||
if do_exec "git -C "$target_git_path" stash pop"; then
|
||||
my_echo -e "Stash applied successfully."
|
||||
else
|
||||
my_echo -e "\033[33;1mNote: Stash could not be applied. Manual intervention required.\033[0m"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#echo -e "\033[35;1mUPDATE:\033[0m\nupdate $LAYER_NAME from (branch $BRANCH_NAME) $LAYER_GIT_URL ..."
|
||||
do_exec "git -C $TARGET_GIT_PATH pull -r origin $BRANCH_NAME" ' ' 'show_output'
|
||||
|
||||
if [ "$TMP_LAYER_BRANCH" != "$BRANCH_NAME" ]; then
|
||||
echo -e "\033[35;1mswitch back to branch $TMP_LAYER_BRANCH\033[0m"
|
||||
do_exec "git -C $TARGET_GIT_PATH checkout $TMP_LAYER_BRANCH"
|
||||
echo -e "\033[35;1mrebase branch $BRANCH_NAME into branch $TMP_LAYER_BRANCH\033[0m"
|
||||
do_exec "git -C $TARGET_GIT_PATH rebase $BRANCH_NAME" ' ' 'show_output'
|
||||
fi
|
||||
|
||||
do_exec "git -C $TARGET_GIT_PATH stash pop" 'no_exit'
|
||||
fi
|
||||
|
||||
return 0
|
||||
@@ -119,7 +163,7 @@ function clone_meta () {
|
||||
# clone/update required branch from tuxbox bsp layers
|
||||
function is_required_machine_layer ()
|
||||
{
|
||||
HIM1=$1
|
||||
local HIM1=$1
|
||||
for M in $HIM1 ; do
|
||||
if [ "$M" == "$MACHINE" ]; then
|
||||
echo true
|
||||
@@ -132,7 +176,7 @@ function is_required_machine_layer ()
|
||||
|
||||
# get matching machine type from machine build id
|
||||
function get_real_machine_type() {
|
||||
MACHINE_TYPE=$1
|
||||
local MACHINE_TYPE=$1
|
||||
if [ "$MACHINE_TYPE" == "mutant51" ] || [ "$MACHINE_TYPE" == "ax51" ] || [ "$MACHINE_TYPE" == "hd51" ]; then
|
||||
RMT_RES="hd51"
|
||||
elif [ "$MACHINE_TYPE" == "hd60" ] || [ "$MACHINE_TYPE" == "ax60" ]; then
|
||||
@@ -149,7 +193,7 @@ function get_real_machine_type() {
|
||||
|
||||
# get matching machine build id from machine type
|
||||
function get_real_machine_id() {
|
||||
MACHINEBUILD=$1
|
||||
local MACHINEBUILD=$1
|
||||
if [ "$MACHINEBUILD" == "hd51" ]; then
|
||||
RMI_RES="ax51"
|
||||
elif [ "$MACHINEBUILD" == "hd60" ]; then
|
||||
@@ -164,11 +208,11 @@ function get_real_machine_id() {
|
||||
echo $RMI_RES
|
||||
}
|
||||
|
||||
# function to create file enrties into a file, already existing entry will be ignored
|
||||
# function to create file entries into a file, already existing entry will be ignored
|
||||
function set_file_entry () {
|
||||
FILE_NAME=$1
|
||||
FILE_SEARCH_ENTRY=$2
|
||||
FILE_NEW_ENTRY=$3
|
||||
local FILE_NAME=$1
|
||||
local FILE_SEARCH_ENTRY=$2
|
||||
local FILE_NEW_ENTRY=$3
|
||||
if test ! -f $FILE_NAME; then
|
||||
echo $FILE_NEW_ENTRY > $FILE_NAME
|
||||
return 1
|
||||
@@ -186,38 +230,39 @@ function set_file_entry () {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# function to create configuration for box types
|
||||
function create_local_config () {
|
||||
CLC_ARG1=$1
|
||||
local machine=$1
|
||||
|
||||
if [ "$CLC_ARG1" != "all" ]; then
|
||||
if [ "$machine" != "all" ]; then
|
||||
|
||||
MACHINE_BUILD_DIR=$BUILD_ROOT/$CLC_ARG1
|
||||
MACHINE_BUILD_DIR=$BUILD_ROOT/$machine
|
||||
do_exec "mkdir -p $BUILD_ROOT"
|
||||
|
||||
BACKUP_CONFIG_DIR="$BACKUP_PATH/$CLC_ARG1/conf"
|
||||
BACKUP_CONFIG_DIR="$BACKUP_PATH/$machine/conf"
|
||||
do_exec "mkdir -p $BACKUP_CONFIG_DIR"
|
||||
|
||||
LOCAL_CONFIG_FILE_PATH=$MACHINE_BUILD_DIR/conf/local.conf
|
||||
|
||||
if test -d $BUILD_ROOT_DIR/$CLC_ARG1; then
|
||||
if test ! -L $BUILD_ROOT_DIR/$CLC_ARG1; then
|
||||
if test -d $BUILD_ROOT_DIR/$machine; then
|
||||
if test ! -L $BUILD_ROOT_DIR/$machine; then
|
||||
# generate build/config symlinks for compatibility
|
||||
echo -e "\033[37;1m\tcreate compatible symlinks directory for $CLC_ARG1 environment ...\033[0m"
|
||||
do_exec "mv -v $BUILD_ROOT_DIR/$CLC_ARG1 $BUILD_ROOT"
|
||||
do_exec "ln -sv $MACHINE_BUILD_DIR $BUILD_ROOT_DIR/$CLC_ARG1"
|
||||
my_echo -e "\033[37;1m\tcreate compatible symlinks directory for $machine environment ...\033[0m"
|
||||
do_exec "mv $BUILD_ROOT_DIR/$machine $BUILD_ROOT"
|
||||
do_exec "ln -s $MACHINE_BUILD_DIR $BUILD_ROOT_DIR/$machine"
|
||||
fi
|
||||
fi
|
||||
|
||||
# generate default config
|
||||
if test ! -d $MACHINE_BUILD_DIR/conf; then
|
||||
echo -e "\033[37;1m\tcreating build directory for $CLC_ARG1 environment ...\033[0m"
|
||||
my_echo -e "\033[37;1m\tcreating build directory for $machine environment ...\033[0m"
|
||||
do_exec "cd $BUILD_ROOT_DIR"
|
||||
do_exec ". ./oe-init-build-env $MACHINE_BUILD_DIR"
|
||||
# we need a clean config file
|
||||
if test -f $LOCAL_CONFIG_FILE_PATH & test ! -f $LOCAL_CONFIG_FILE_PATH.origin; then
|
||||
# so we save the origin local.conf
|
||||
do_exec "mv -v $LOCAL_CONFIG_FILE_PATH $LOCAL_CONFIG_FILE_PATH.origin"
|
||||
do_exec "mv $LOCAL_CONFIG_FILE_PATH $LOCAL_CONFIG_FILE_PATH.origin"
|
||||
fi
|
||||
do_exec "cd $BASEPATH"
|
||||
echo "[Desktop Entry]" > $BUILD_ROOT/.directory
|
||||
@@ -230,36 +275,41 @@ function create_local_config () {
|
||||
|
||||
if test -f $LOCAL_CONFIG_FILE_PATH; then
|
||||
HASHSTAMP=`MD5SUM $LOCAL_CONFIG_FILE_PATH`
|
||||
do_exec "cp -v $LOCAL_CONFIG_FILE_PATH $BACKUP_CONFIG_DIR/local.conf.$HASHSTAMP.$BACKUP_SUFFIX"
|
||||
do_exec "cp $LOCAL_CONFIG_FILE_PATH $BACKUP_CONFIG_DIR/local.conf.$HASHSTAMP.$BACKUP_SUFFIX"
|
||||
|
||||
# migrate settings after server switch
|
||||
echo -e "migrate settings within $LOCAL_CONFIG_FILE_INC_PATH..."
|
||||
sed -i -e 's|http://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH
|
||||
sed -i -e 's|https://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH
|
||||
my_echo "migrate settings within $LOCAL_CONFIG_FILE_INC_PATH..."
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
|
||||
sed -i -e 's|http://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_INC_PATH
|
||||
sed -i -e 's|https://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_INC_PATH
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
|
||||
sed -i -e 's|http://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH
|
||||
sed -i -e 's|https://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH
|
||||
do_exec "sed -i -e 's|http://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
do_exec "sed -i -e 's|https://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
|
||||
sed -i -e 's|archiv.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH
|
||||
sed -i -e 's|sstate.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH
|
||||
do_exec "sed -i -e 's|archiv.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
do_exec "sed -i -e 's|sstate.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
|
||||
echo -e "migrate settings within $LOCAL_CONFIG_FILE_PATH"
|
||||
sed -i -e 's|http://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH
|
||||
sed -i -e 's|https://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH
|
||||
my_echo "migrate settings within $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
|
||||
sed -i -e 's|http://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_PATH
|
||||
sed -i -e 's|https://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_PATH
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_PATH"
|
||||
|
||||
sed -i -e 's|http://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH
|
||||
sed -i -e 's|https://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH
|
||||
do_exec "sed -i -e 's|http://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|https://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
|
||||
sed -i -e 's|archiv.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH
|
||||
sed -i -e 's|sstate.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH
|
||||
do_exec "sed -i -e 's|archiv.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|sstate.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
|
||||
echo -e "\033[32;1mdone ...\033[0m\n"
|
||||
search_line="#UPDATE_SERVER_URL = \"http:\/\/@hostname@\""
|
||||
add_line="UPDATE_SERVER_URL = \"http://$HTTP_ADDRESS\""
|
||||
if ! grep -qF -- "$add_line" "$LOCAL_CONFIG_FILE_INC_PATH"; then
|
||||
# Wenn nicht, füge die neue Zeile nach der spezifischen Zeile ein
|
||||
sed -i -e "/$search_line/a $add_line" "$LOCAL_CONFIG_FILE_INC_PATH"
|
||||
fi
|
||||
fi
|
||||
|
||||
# add init note
|
||||
@@ -269,18 +319,18 @@ function create_local_config () {
|
||||
set_file_entry $LOCAL_CONFIG_FILE_PATH "$BASEPATH/local.conf.common.inc" "include $BASEPATH/local.conf.common.inc"
|
||||
|
||||
# add line 2, machine type
|
||||
M_TYPE='MACHINE = "'`get_real_machine_type $CLC_ARG1`'"'
|
||||
M_TYPE='MACHINE = "'`get_real_machine_type $machine`'"'
|
||||
if set_file_entry $LOCAL_CONFIG_FILE_PATH "MACHINE" "$M_TYPE" == 1; then
|
||||
echo -e "\t\033[37;1m$LOCAL_CONFIG_FILE_PATH has been upgraded with entry: $M_TYPE \033[0m"
|
||||
my_echo -e "\t\033[37;1m$LOCAL_CONFIG_FILE_PATH has been upgraded with entry: $M_TYPE \033[0m"
|
||||
fi
|
||||
|
||||
# add line 3, machine build
|
||||
M_ID='MACHINEBUILD = "'`get_real_machine_id $CLC_ARG1`'"'
|
||||
M_ID='MACHINEBUILD = "'`get_real_machine_id $machine`'"'
|
||||
if set_file_entry $LOCAL_CONFIG_FILE_PATH "MACHINEBUILD" "$M_ID" == 1; then
|
||||
echo -e "\t\033[37;1m$LOCAL_CONFIG_FILE_PATH has been upgraded with entry: $M_ID \033[0m"
|
||||
my_echo -e "\t\033[37;1m$LOCAL_CONFIG_FILE_PATH has been upgraded with entry: $M_ID \033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e "\033[31;1mERROR:\033[0m:\ttemplate $BASEPATH/local.conf.common.inc not found..."
|
||||
my_echo -e "\033[31;1mERROR:\033[0m:\ttemplate $BASEPATH/local.conf.common.inc not found..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -289,17 +339,17 @@ function create_local_config () {
|
||||
# craete backup for bblayer.conf
|
||||
if test -f $BBLAYER_CONF_FILE; then
|
||||
HASHSTAMP=`MD5SUM $BBLAYER_CONF_FILE`
|
||||
do_exec "cp -v $BBLAYER_CONF_FILE $BACKUP_CONFIG_DIR/bblayer.conf.$HASHSTAMP.$BACKUP_SUFFIX"
|
||||
do_exec "cp $BBLAYER_CONF_FILE $BACKUP_CONFIG_DIR/bblayer.conf.$HASHSTAMP.$BACKUP_SUFFIX"
|
||||
fi
|
||||
|
||||
META_MACHINE_LAYER=meta-`get_metaname $CLC_ARG1`
|
||||
META_MACHINE_LAYER=meta-`get_metaname $machine`
|
||||
|
||||
# add layer entries into bblayer.conf
|
||||
set_file_entry $BBLAYER_CONF_FILE "generated" '# auto generated entries by init script'
|
||||
LAYER_LIST=" $TUXBOX_LAYER_NAME $META_MACHINE_LAYER $OE_LAYER_NAME/meta-oe $OE_LAYER_NAME/meta-networking $PYTHON2_LAYER_NAME $QT5_LAYER_NAME "
|
||||
for LL in $LAYER_LIST ; do
|
||||
if set_file_entry $BBLAYER_CONF_FILE $LL 'BBLAYERS += " '$BUILD_ROOT_DIR'/'$LL' "' == 1;then
|
||||
echo -e "\t\033[37;1m$BBLAYER_CONF_FILE has been upgraded with entry: $LL... \033[0m"
|
||||
my_echo -e "\t\033[37;1m$BBLAYER_CONF_FILE has been upgraded with entry: $LL... \033[0m"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -311,7 +361,7 @@ function create_dist_tree () {
|
||||
# create dist dir
|
||||
DIST_BASEDIR="$BASEPATH/dist/$IMAGE_VERSION"
|
||||
if test ! -d "$DIST_BASEDIR"; then
|
||||
echo -e "\033[37;1mcreate dist directory:\033[0m $DIST_BASEDIR"
|
||||
my_echo -e "\033[37;1mcreate dist directory:\033[0m $DIST_BASEDIR"
|
||||
do_exec "mkdir -p $DIST_BASEDIR"
|
||||
fi
|
||||
|
||||
@@ -319,7 +369,7 @@ function create_dist_tree () {
|
||||
DIST_LIST=`ls $BUILD_ROOT`
|
||||
for DL in $DIST_LIST ; do
|
||||
DEPLOY_DIR="$BUILD_ROOT/$DL/tmp/deploy"
|
||||
do_exec "ln -sfv $DEPLOY_DIR $DIST_BASEDIR/$DL"
|
||||
do_exec "ln -sf $DEPLOY_DIR $DIST_BASEDIR/$DL"
|
||||
if test -L "$DIST_BASEDIR/$DL/deploy"; then
|
||||
do_exec "unlink -v $DIST_BASEDIR/$DL/deploy"
|
||||
fi
|
||||
@@ -327,7 +377,7 @@ function create_dist_tree () {
|
||||
}
|
||||
|
||||
function MD5SUM () {
|
||||
MD5SUM_FILE=$1
|
||||
local MD5SUM_FILE=$1
|
||||
MD5STAMP=`md5sum $MD5SUM_FILE |cut -f 1 -d " "`
|
||||
echo $MD5STAMP
|
||||
}
|
||||
|
424
init.sh
424
init.sh
@@ -2,16 +2,55 @@
|
||||
source init.functions.sh
|
||||
#set -x
|
||||
|
||||
BASEPATH=$(pwd)
|
||||
TIMESTAMP=$(date '+%Y%m%d_%H%M%S')
|
||||
|
||||
# only current version
|
||||
# IMAGE_VERSION=$(git -C $BASEPATH rev-parse --abbrev-ref HEAD)
|
||||
## Comatible image version
|
||||
IMAGE_VERSION="3.2.4"
|
||||
|
||||
## global vars
|
||||
BASEPATH=$(pwd)
|
||||
SSH=$(which ssh)
|
||||
GIT_SSH_KEYFILE=""
|
||||
true="1"
|
||||
false="0"
|
||||
DO_UPDATE=$false
|
||||
FILES_DIR="$BASEPATH/files"
|
||||
HTTPD_DIST_HOSTNAME="localhost"
|
||||
HTTPD_DIST_DIR="/var/www/html/dist"
|
||||
USER_CALL="$0 $@"
|
||||
|
||||
# identical listings
|
||||
## Basename of this script
|
||||
NAME=$(basename $0)
|
||||
|
||||
## Timestamp for logging
|
||||
TIMESTAMP=$(date '+%Y%m%d_%H%M%S')
|
||||
## Logfile
|
||||
LOG_PATH=$BASEPATH/log
|
||||
mkdir -p $LOG_PATH
|
||||
TMP_LOGFILE="$LOG_PATH/.$0-tmp.log"
|
||||
rm -f $TMP_LOGFILE
|
||||
LOGFILE_NAME="$NAME"_"$TIMESTAMP.log"
|
||||
LOGFILE=$LOG_PATH/$LOGFILE_NAME
|
||||
LOGFILE_LINK=$LOG_PATH/$NAME.log
|
||||
echo "" > $LOGFILE
|
||||
ln -sf $LOGFILE $LOGFILE_LINK
|
||||
my_echo "true" "$USER_CALL"
|
||||
|
||||
## Current build env script version
|
||||
VERSION=$(git -C $BASEPATH describe --tags 2>/dev/null)
|
||||
if [ -z "$VERSION" ]; then
|
||||
VERSION="$IMAGE_VERSION"
|
||||
fi
|
||||
INIT_VERSION="$NAME $VERSION"
|
||||
|
||||
## Preset required branches and revs
|
||||
COMPATIBLE_BRANCH="gatesgarth"
|
||||
COMPATIBLE_TAG="$IMAGE_VERSION"
|
||||
YOCTO_SRCREV="bc71ec0"
|
||||
PYTHON2_SRCREV="27d2aeb"
|
||||
OE_SRCREV="f3f7a5f"
|
||||
|
||||
|
||||
## Machines
|
||||
# Identical listings
|
||||
MACHINES_IDENTICAL_HD51="hd51 ax51 mutant51"
|
||||
MACHINES_IDENTICAL_H7="h7 zgemmah7"
|
||||
MACHINES_IDENTICAL_HD60="hd60 ax60" #TODO: move into gfutures
|
||||
@@ -24,62 +63,27 @@ MACHINES_HISI="$MACHINES_IDENTICAL_HD60 $MACHINES_IDENTICAL_HD61"
|
||||
# airdigital listing
|
||||
MACHINES_AIRDIGITAL="$MACHINES_IDENTICAL_H7"
|
||||
# edision listing
|
||||
#MACHINES_EDISION="osmio4k osmio4kplus"
|
||||
MACHINES_EDISION="osmio4k osmio4kplus"
|
||||
# ceryon listing
|
||||
MACHINES_CERYON="e4hdultra"
|
||||
|
||||
# valid machine list
|
||||
MACHINES="$MACHINES_GFUTURES $MACHINES_HISI $MACHINES_AIRDIGITAL $MACHINES_EDISION $MACHINES_CERYON"
|
||||
|
||||
HINT_SYNTAX='\033[37;1mUsage '$0' <machine>\033[0m'
|
||||
HINT_MACHINES="<$MACHINES>, <all> or keep empty < >"
|
||||
HINT_IMAGE_VERSIONS="$IMAGE_VERSION"
|
||||
|
||||
LOG_PATH=$BASEPATH/log
|
||||
mkdir -p $LOG_PATH
|
||||
MACHINE="all" # default for MACHINE, if not set
|
||||
HINT_MACHINES="Select a valid machine type (empty means <all> as default) <$MACHINES>"
|
||||
|
||||
## Backups
|
||||
BACKUP_PATH=$BASEPATH/backups
|
||||
mkdir -p $BACKUP_PATH
|
||||
|
||||
LOGFILE_NAME="$0_$TIMESTAMP.log"
|
||||
LOGFILE=$LOG_PATH/$LOGFILE_NAME
|
||||
TMP_LOGFILE=$LOG_PATH/.tmp.log
|
||||
touch $LOGFILE
|
||||
|
||||
LOGFILE_LINK=$BASEPATH/$0.log
|
||||
|
||||
rm -f $TMP_LOGFILE
|
||||
rm -f $LOGFILE_LINK
|
||||
ln -sf $LOGFILE $LOGFILE_LINK
|
||||
|
||||
|
||||
# set passed parameters
|
||||
if [ "$1" == "" ]; then
|
||||
MACHINE="all"
|
||||
else
|
||||
MACHINE=$1
|
||||
fi
|
||||
|
||||
if [ $(is_valid_machine "$MACHINE") == false ]; then
|
||||
echo -e "\033[31;1mERROR:\tNo valid machine defined.\033[0m\n\t$HINT_SYNTAX.
|
||||
\tKeep parameter <machine> empty to initialize all possible machine types or set your favorite machine.
|
||||
\tPossible types are:
|
||||
\t\033[37;1m$HINT_MACHINES\033[0m\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "##########################################################################################"
|
||||
echo -e "\033[37;1mInitialze build environment:\nversion: $IMAGE_VERSION\nmachine: $MACHINE\033[0m"
|
||||
echo -e "##########################################################################################\n"
|
||||
|
||||
|
||||
BACKUP_SUFFIX=bak
|
||||
|
||||
YOCTO_GIT_URL=https://git.yoctoproject.org/git/poky
|
||||
POKY=poky
|
||||
POKY_NAME=$IMAGE_VERSION
|
||||
BUILD_ROOT_DIR=$BASEPATH/$POKY-$IMAGE_VERSION
|
||||
BUILD_ROOT=$BUILD_ROOT_DIR/build
|
||||
## Layer sources
|
||||
YOCTO_GIT_URL="https://git.yoctoproject.org/git/poky"
|
||||
POKY="poky"
|
||||
POKY_NAME="$IMAGE_VERSION"
|
||||
BUILD_ROOT_DIR="$BASEPATH/$POKY-$IMAGE_VERSION"
|
||||
BUILD_ROOT="$BUILD_ROOT_DIR/build"
|
||||
|
||||
OE_LAYER_NAME=meta-openembedded
|
||||
OE_LAYER_GIT_URL=https://git.openembedded.org/meta-openembedded
|
||||
@@ -88,162 +92,244 @@ OE_LAYER_PATCH_LIST="0001-openembedded-disable-meta-python.patch 0002-openembedd
|
||||
OE_CORE_LAYER_NAME=openembedded-core
|
||||
OE_CORE_LAYER_GIT_URL=https://github.com/openembedded/openembedded-core.git
|
||||
|
||||
TUXBOX_LAYER_NAME=meta-neutrino
|
||||
TUXBOX_LAYER_GIT_URL=https://github.com/Tuxbox-Project
|
||||
# meta-neutrino project URL:
|
||||
PROJECT_URL="https://github.com/tuxbox-neutrino"
|
||||
|
||||
TUXBOX_BSP_LAYER_GIT_URL=$TUXBOX_LAYER_GIT_URL
|
||||
## Help
|
||||
show_help() {
|
||||
if [[ $LANG == de_* ]]; then
|
||||
echo "Dieses Skript initialisiert und aktualisiert die Entwicklungsumgebung für den Bau von Images und Paketen für verschiedene Maschinenkonfigurationen."
|
||||
echo "Es klont und aktualisiert Meta-Layer aus vorgegebenen Repositories, bereitet die Build-Umgebung vor und unterstützt die Konfiguration für spezifische Maschinentypen."
|
||||
else
|
||||
echo "This script initializes and updates the development environment for building images and packages for various machine configurations."
|
||||
echo "It clones and updates meta-layers from specified repositories, prepares the build environment, and supports configuration for specific machine types."
|
||||
fi
|
||||
echo ""
|
||||
echo "Usage: $0 [OPTIONS]..."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -m, --machine $HINT_MACHINES"
|
||||
echo " --httpd-dist-hostname IP or hostname (optional with portname) to define the update server address for local.conf.common.inc, default: $HTTPD_DIST_HOSTNAME"
|
||||
echo " --httpd-dist-dir Directory where the local httpd server find the deployed images and packages, default: $HTTPD_DIST_DIR"
|
||||
echo " -p, --project-url Project-URL where to find project meta layers,"
|
||||
echo " e.g. for read and write access: git@github.com:tuxbox-neutrino, default = $PROJECT_URL"
|
||||
echo " -u, --update Update your project meta layers"
|
||||
echo " -i, --id-rsa-file Path to your preferred id rsa file, default: users id rsa file, e.g. $HOME/.ssh/id_rsa"
|
||||
echo ""
|
||||
echo " -h, --help Show this help"
|
||||
echo " --version Show version information"
|
||||
}
|
||||
|
||||
AIRDIGITAL_LAYER_NAME=meta-airdigital
|
||||
AIRDIGITAL_LAYER_GIT_URL=$TUXBOX_BSP_LAYER_GIT_URL/$AIRDIGITAL_LAYER_NAME
|
||||
## Processing command line arguments
|
||||
TEMP=$(getopt -o up:m:i:h --long httpd-dist-hostname:,httpd-dist-dir:,update,project-url:,machine:,id-rsa-file,help,version -n 'init' -- "$@")
|
||||
if [ $? != 0 ] ; then
|
||||
my_echo "Error while process arguments" >&2
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GFUTURES_LAYER_NAME=meta-gfutures
|
||||
GFUTURES_LAYER_GIT_URL=$TUXBOX_BSP_LAYER_GIT_URL/$GFUTURES_LAYER_NAME
|
||||
# Note the quotes around `$TEMP`: they are essential!
|
||||
eval set -- "$TEMP"
|
||||
|
||||
EDISION_LAYER_NAME=meta-edision
|
||||
EDISION_LAYER_GIT_URL=$TUXBOX_LAYER_GIT_URL/$EDISION_LAYER_NAME
|
||||
# Extract arguments.
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-p|--project-url)
|
||||
PROJECT_URL="$2"; shift 2 ;;
|
||||
-m|--machine)
|
||||
MACHINE="$2"; shift 2 ;;
|
||||
-i|--id-rsa-file)
|
||||
GIT_SSH_KEYFILE="$2"; shift 2 ;;
|
||||
--httpd-dist-hostname)
|
||||
HTTPD_DIST_HOSTNAME="$2"; shift 2 ;;
|
||||
--httpd-dist-dir)
|
||||
HTTPD_DIST_DIR="$2"; shift 2 ;;
|
||||
-u|--update)
|
||||
DO_UPDATE="$true"; shift ;;
|
||||
-h|--help)
|
||||
show_help
|
||||
exit 0 ;;
|
||||
--version)
|
||||
echo "$INIT_VERSION"
|
||||
exit 0 ;;
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal Error!" ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
HISI_LAYER_NAME=meta-hisilicon #TODO: move into gfutures
|
||||
HISI_LAYER_GIT_URL=$TUXBOX_LAYER_GIT_URL/$HISI_LAYER_NAME
|
||||
# Check machine type
|
||||
if [ $(is_valid_machine "$MACHINE") == false ]; then
|
||||
my_echo "\033[31;1mNo valid machine defined.\033[0m"
|
||||
my_echo "$HINT_MACHINES"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CERYON_LAYER_NAME=meta-ceryon
|
||||
CERYON_LAYER_GIT_URL=$TUXBOX_BSP_LAYER_GIT_URL/$CERYON_LAYER_NAME
|
||||
my_echo "------------------------------------------------------------------------------------------"
|
||||
my_echo "Buildenv Version: \033[37;1m$INIT_VERSION\033[0m "
|
||||
my_echo "Image Version: \033[37;1m$IMAGE_VERSION\033[0m "
|
||||
my_echo "Compatible OE-branch: \033[37;1m$COMPATIBLE_BRANCH\033[0m "
|
||||
my_echo "httpd Dist hostname: \033[37;1m$HTTPD_DIST_HOSTNAME\033[0m "
|
||||
my_echo "httpd Dist directory: \033[37;1m$HTTPD_DIST_DIR\033[0m "
|
||||
my_echo "Machine: \033[37;1m$MACHINE\033[0m "
|
||||
my_echo "Project Repository URL: \033[37;1m$PROJECT_URL\033[0m "
|
||||
my_echo "SRCREV Yocto: \033[37;1m$YOCTO_SRCREV\033[0m "
|
||||
my_echo "SRCREV OE: \033[37;1m$OE_SRCREV\033[0m "
|
||||
my_echo "SRCREV Python2: \033[37;1m$PYTHON2_SRCREV\033[0m "
|
||||
my_echo "------------------------------------------------------------------------------------------"
|
||||
|
||||
## Fetch meta sources
|
||||
# fetch required branch from yocto
|
||||
fetch_meta "" $COMPATIBLE_BRANCH $YOCTO_GIT_URL $YOCTO_SRCREV $BUILD_ROOT_DIR
|
||||
|
||||
# fetch required branch from openembedded
|
||||
fetch_meta "" $COMPATIBLE_BRANCH $OE_LAYER_GIT_URL $OE_SRCREV $BUILD_ROOT_DIR/$OE_LAYER_NAME "$OE_LAYER_PATCH_LIST"
|
||||
|
||||
# fetch required branch of oe-core from openembedded
|
||||
fetch_meta "" master $OE_CORE_LAYER_GIT_URL "" $BUILD_ROOT_DIR/$OE_CORE_LAYER_NAME
|
||||
|
||||
# fetch required branch for meta-python2
|
||||
PYTHON2_LAYER_NAME=meta-python2
|
||||
PYTHON2_LAYER_GIT_URL=https://git.openembedded.org/$PYTHON2_LAYER_NAME
|
||||
PYTHON2_PATCH_LIST="0001-local_conf_outcomment_line_15.patch"
|
||||
fetch_meta "" $COMPATIBLE_BRANCH $PYTHON2_LAYER_GIT_URL $PYTHON2_SRCREV $BUILD_ROOT_DIR/$PYTHON2_LAYER_NAME "$PYTHON2_PATCH_LIST"
|
||||
|
||||
# fetch required branch for meta-qt5
|
||||
QT5_LAYER_NAME=meta-qt5
|
||||
QT5_LAYER_GIT_URL=https://github.com/meta-qt5/$QT5_LAYER_NAME
|
||||
fetch_meta "" $COMPATIBLE_BRANCH $QT5_LAYER_GIT_URL "" $BUILD_ROOT_DIR/$QT5_LAYER_NAME
|
||||
|
||||
# fetch required branch from meta-neutrino
|
||||
TUXBOX_LAYER_NAME="meta-neutrino"
|
||||
TUXBOX_LAYER_BRANCH="master"
|
||||
TUXBOX_LAYER_SRCREV="ffc1b65ec3cfd2c6bbd339d3ce201d6b39abd527"
|
||||
TUXBOX_LAYER_GIT_URL="${PROJECT_URL}/$TUXBOX_LAYER_NAME.git"
|
||||
fetch_meta "" $TUXBOX_LAYER_BRANCH $TUXBOX_LAYER_GIT_URL "$TUXBOX_LAYER_SRCREV" $BUILD_ROOT_DIR/$TUXBOX_LAYER_NAME
|
||||
safe_dir="$BUILD_ROOT_DIR/$TUXBOX_LAYER_NAME"
|
||||
if ! git config --global --get safe.directory | grep -qxF "$safe_dir"; then
|
||||
do_exec "git config --global --add safe.directory \"$safe_dir\""
|
||||
fi
|
||||
|
||||
# set required branches
|
||||
COMPATIBLE_BRANCH=gatesgarth
|
||||
YOCTO_BRANCH_HASH=bc71ec0
|
||||
PYTHON2_BRANCH_HASH=27d2aeb
|
||||
OE_BRANCH_HASH=f3f7a5f
|
||||
# fetch required branch from meta-airdigital
|
||||
AIRDIGITAL_LAYER_NAME="meta-airdigital"
|
||||
AIRDIGITAL_LAYER_BRANCH="master"
|
||||
AIRDIGITAL_LAYER_SRCREV="ac8f769e35f839bbcf9c38d2b2b98513be907ac1"
|
||||
AIRDIGITAL_LAYER_GIT_URL="$PROJECT_URL/$AIRDIGITAL_LAYER_NAME.git"
|
||||
if [ "$MACHINE" == "all" ] || [ $(is_required_machine_layer "' $MACHINES_AIRDIGITAL '") == true ]; then
|
||||
fetch_meta "" $AIRDIGITAL_LAYER_BRANCH $AIRDIGITAL_LAYER_GIT_URL "$AIRDIGITAL_LAYER_SRCREV" $BUILD_ROOT_DIR/$AIRDIGITAL_LAYER_NAME
|
||||
fi
|
||||
|
||||
|
||||
# clone/update required branch from yocto
|
||||
clone_meta '' $COMPATIBLE_BRANCH $YOCTO_GIT_URL $YOCTO_BRANCH_HASH $BUILD_ROOT_DIR
|
||||
# for compatibility with old path structure
|
||||
# ln -sf $BUILD_ROOT_DIR $BASEPATH/$POKY-$IMAGE_VERSION
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
|
||||
# clone required branch from openembedded
|
||||
clone_meta '' $COMPATIBLE_BRANCH $OE_LAYER_GIT_URL $OE_BRANCH_HASH $BUILD_ROOT_DIR/$OE_LAYER_NAME "$OE_LAYER_PATCH_LIST"
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
clone_meta '' master $OE_CORE_LAYER_GIT_URL '' $BUILD_ROOT_DIR/$OE_CORE_LAYER_NAME
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
|
||||
# clone required branch for meta-python2
|
||||
clone_meta '' $COMPATIBLE_BRANCH $PYTHON2_LAYER_GIT_URL $PYTHON2_BRANCH_HASH $BUILD_ROOT_DIR/$PYTHON2_LAYER_NAME "$PYTHON2_PATCH_LIST"
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
|
||||
# clone required branch for meta-qt5
|
||||
clone_meta '' $COMPATIBLE_BRANCH $QT5_LAYER_GIT_URL '' $BUILD_ROOT_DIR/$QT5_LAYER_NAME
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
|
||||
# clone/update required branch from meta-neutrino
|
||||
clone_meta '' $COMPATIBLE_BRANCH $TUXBOX_LAYER_GIT_URL/$TUXBOX_LAYER_NAME '' $BUILD_ROOT_DIR/$TUXBOX_LAYER_NAME
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
|
||||
|
||||
# gfutures
|
||||
# fetch required branch from meta-gfutures
|
||||
GFUTURES_LAYER_NAME=meta-gfutures
|
||||
GFUTURES_LAYER_BRANCH="master"
|
||||
GFUTURES_LAYER_SRCREV="bfceb9d2f79a8403ce1bdf1ad14a1714f781fed3"
|
||||
GFUTURES_LAYER_GIT_URL="$PROJECT_URL/$GFUTURES_LAYER_NAME.git"
|
||||
if [ "$MACHINE" == "all" ] || [ $(is_required_machine_layer "' $MACHINES_GFUTURES '") == true ]; then
|
||||
# gfutures
|
||||
clone_meta '' $COMPATIBLE_BRANCH $GFUTURES_LAYER_GIT_URL '' $BUILD_ROOT_DIR/$GFUTURES_LAYER_NAME
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
fetch_meta "" $GFUTURES_LAYER_BRANCH $GFUTURES_LAYER_GIT_URL "$GFUTURES_LAYER_SRCREV" $BUILD_ROOT_DIR/$GFUTURES_LAYER_NAME
|
||||
fi
|
||||
# airdigital
|
||||
if [ "$MACHINE" == "all" ] || [ $(is_required_machine_layer "' $MACHINES_AIRDIGITAL '") == true ]; then
|
||||
clone_meta '' $COMPATIBLE_BRANCH $AIRDIGITAL_LAYER_GIT_URL '' $BUILD_ROOT_DIR/$AIRDIGITAL_LAYER_NAME
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
fi
|
||||
# edision
|
||||
if [ "$MACHINE" == "all" ] || [ $(is_required_machine_layer "' $MACHINES_EDISION '") == true ]; then
|
||||
clone_meta '' $COMPATIBLE_BRANCH $EDISION_LAYER_GIT_URL '' $BUILD_ROOT_DIR/$EDISION_LAYER_NAME
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
fi
|
||||
# hisilicon #TODO: move into gfutures
|
||||
if [ "$MACHINE" == "all" ] || [ $(is_required_machine_layer "' $MACHINES_HISI '") == true; then
|
||||
clone_meta '' $COMPATIBLE_BRANCH $HISI_LAYER_GIT_URL '' $BUILD_ROOT_DIR/$HISI_LAYER_NAME
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
fi
|
||||
# ceryon
|
||||
|
||||
# fetch required branch from meta-ceryon
|
||||
CERYON_LAYER_NAME=meta-ceryon
|
||||
CERYON_LAYER_BRANCH="master"
|
||||
CERYON_LAYER_SRCREV="4a02145fc4c233b64f6110d166c46b59ebe73371"
|
||||
CERYON_LAYER_GIT_URL="$PROJECT_URL/$CERYON_LAYER_NAME.git"
|
||||
if [ "$MACHINE" == "all" ] || [ $(is_required_machine_layer "' $MACHINES_CERYON '") == true ]; then
|
||||
clone_meta '' $COMPATIBLE_BRANCH $CERYON_LAYER_GIT_URL '' $BUILD_ROOT_DIR/$CERYON_LAYER_NAME
|
||||
echo -e "\033[32;1mOK ...\033[0m\n"
|
||||
fetch_meta "" $CERYON_LAYER_BRANCH $CERYON_LAYER_GIT_URL "$CERYON_LAYER_SRCREV" $BUILD_ROOT_DIR/$CERYON_LAYER_NAME
|
||||
fi
|
||||
|
||||
# fetch required branch from meta-hisilicon #TODO: move into gfutures
|
||||
HISI_LAYER_NAME=meta-hisilicon #TODO: move into gfutures
|
||||
HISI_LAYER_BRANCH="master"
|
||||
HISI_LAYER_SRCREV="e85e1781704d96f5dfa0c554cf81d24c147d888c"
|
||||
HISI_LAYER_GIT_URL="$PROJECT_URL/$HISI_LAYER_NAME.git"
|
||||
if [ "$MACHINE" == "all" ] || [ $(is_required_machine_layer "' $MACHINES_HISI '") == true; then
|
||||
fetch_meta "" $HISI_LAYER_BRANCH $HISI_LAYER_GIT_URL "$HISI_LAYER_SRCREV" $BUILD_ROOT_DIR/$HISI_LAYER_NAME
|
||||
fi
|
||||
|
||||
# create included config file from sample file
|
||||
# fetch required branch from meta-edision
|
||||
EDISION_LAYER_NAME=meta-edision
|
||||
EDISION_LAYER_BRANCH="master"
|
||||
EDISION_LAYER_SRCREV="1b2c422d9218e86ca1cd9d20431d42e716b1d714"
|
||||
EDISION_LAYER_GIT_URL="$PROJECT_URL/$EDISION_LAYER_NAME.git"
|
||||
if [ "$MACHINE" == "all" ] || [ $(is_required_machine_layer "' $MACHINES_EDISION '") == true ]; then
|
||||
fetch_meta '' $EDISION_LAYER_BRANCH $EDISION_LAYER_GIT_URL "$EDISION_LAYER_SRCREV" $BUILD_ROOT_DIR/$EDISION_LAYER_NAME
|
||||
fi
|
||||
|
||||
## Configure buildsystem
|
||||
# Create included config file from sample file
|
||||
if test ! -f $BASEPATH/local.conf.common.inc; then
|
||||
echo -e "\033[37;1mCONFIG:\033[0m\tcreate $BASEPATH/local.conf.common.inc as include file for layer configuration ..."
|
||||
my_echo "\033[37;1mCONFIG:\033[0mCreate $BASEPATH/local.conf.common.inc as include file for local layer configuration ..."
|
||||
do_exec "cp -v $BASEPATH/local.conf.common.inc.sample $BASEPATH/local.conf.common.inc"
|
||||
fi
|
||||
|
||||
|
||||
# create configuration for machine
|
||||
# Create configuration for machine
|
||||
my_echo "\033[37;1mCreate configurations ...\033[0m"
|
||||
if [ "$MACHINE" == "all" ]; then
|
||||
for M in $MACHINES ; do
|
||||
create_local_config $M;
|
||||
done
|
||||
my_echo "\033[32;1mdone!\033[0m\n"
|
||||
else
|
||||
create_local_config $MACHINE;
|
||||
my_echo "\033[32;1mdone!\033[0m\n"
|
||||
fi
|
||||
|
||||
|
||||
## Create distribution structure
|
||||
create_dist_tree;
|
||||
|
||||
echo -e "\033[37;1mNOTE:\033[0m"
|
||||
|
||||
# check and create distribution directory inside html directory for online update
|
||||
if test ! -L /var/www/html/dist; then
|
||||
echo -e "\033[37;1m\tLocal setup for package online update.\033[0m"
|
||||
echo -e "\t############################################################################################"
|
||||
echo -e "\t/var/www/html/dist doesn't exists."
|
||||
echo -e "\tIf you want to use online update, please configure your webserver and use dist content"
|
||||
echo -e "\t"
|
||||
echo -e "\tAn easy way is to create a symlink to dist directory:"
|
||||
echo -e "\t"
|
||||
echo -e "\t\t\033[37;1msudo ln -s $BASEPATH/dist /var/www/html/dist\033[0m"
|
||||
|
||||
## check and create distribution directory inside httpd directory for online update
|
||||
if test ! -L $HTTPD_DIST_DIR; then
|
||||
my_echo "\033[37;1mLocal setup for package online update.\033[0m"
|
||||
my_echo "------------------------------------------------------------------------------------------------"
|
||||
my_echo "The httpd directory $HTTPD_DIST_DIR doesn't exists."
|
||||
my_echo "If you want to use online update, please configure your webserver and use dist content"
|
||||
my_echo ""
|
||||
my_echo "An easy way is to create a symlink to dist directory:"
|
||||
my_echo ""
|
||||
my_echo "\033[37;1m\tsudo ln -s $BASEPATH/dist $HTTPD_DIST_DIR\033[0m"
|
||||
fi
|
||||
echo -e "\t"
|
||||
echo -e "\033[37;1m\tLocal environment setup\033[0m"
|
||||
echo -e "\t############################################################################################"
|
||||
echo -e "\t$BASEPATH/local.conf.common.inc was created by the 1st call of $0 from"
|
||||
echo -e "\t$BASEPATH/local.conf.common.inc.sample"
|
||||
echo -e "\tIf this file already exists nothing was changed on this file for your configuration."
|
||||
echo -e "\tYou should check $BASEPATH/local.conf.common.inc and modify this file if required."
|
||||
echo -e "\t"
|
||||
echo -e "\tUnlike here: Please check this files for modifications or upgrades:"
|
||||
echo -e "\t"
|
||||
echo -e "\t\t\033[37;1m$BUILD_ROOT/<machine>/bblayer.conf\033[0m"
|
||||
echo -e "\t\t\033[37;1m$BUILD_ROOT/<machine>/local.conf\033[0m"
|
||||
# echo -e "\t############################################################################################"
|
||||
echo -e "\t"
|
||||
echo -e "\033[37;1m\tStart build\033[0m"
|
||||
echo -e "\t############################################################################################"
|
||||
echo -e "\tNow you are ready to build your own images and packages."
|
||||
echo -e "\tSelectable machines are:"
|
||||
echo -e "\t"
|
||||
echo -e "\t\t\033[37;1m$MACHINES\033[0m"
|
||||
echo -e "\t"
|
||||
echo -e "\t Select your favorite machine (or identical) and the next steps are:\033[37;1m"
|
||||
echo -e "\t"
|
||||
echo -e "\t\tcd $BUILD_ROOT_DIR"
|
||||
echo -e "\t\t. ./oe-init-build-env build/<machine>"
|
||||
echo -e "\t\tbitbake neutrino-image"
|
||||
echo -e "\t\033[0m"
|
||||
|
||||
echo -e "\t"
|
||||
echo -e "\033[37;1m\tUpdating meta-layers\033[0m"
|
||||
echo -e "\t############################################################################################"
|
||||
echo -e "\tExecute init script again."
|
||||
echo -e "\t"
|
||||
echo -e "\tFor more informations and next steps take a look at the README.md!"
|
||||
echo -e "\t"
|
||||
echo -e "\033[32;1mDONE!\033[0m"
|
||||
## Show results
|
||||
my_echo "\033[32;1m\nSummary:\033[0m"
|
||||
my_echo "\033[32;1m------------------------------------------------------------------------------------------------\033[0m"
|
||||
my_echo ""
|
||||
my_echo "\033[37;1mLocal environment setup was created\033[0m"
|
||||
my_echo "------------------------------------------------------------------------------------------------"
|
||||
my_echo "On 1st call of $0 Your config was created at this file from the template sample file"
|
||||
my_echo ""
|
||||
my_echo "\033[37;1m\t$BASEPATH/local.conf.common.inc\033[0m"
|
||||
my_echo ""
|
||||
my_echo "If this file has already exists some entries could be migrated or added on this file."
|
||||
my_echo "You should check $BASEPATH/local.conf.common.inc and modify it if required."
|
||||
my_echo ""
|
||||
my_echo "Unlike here: Please check this files for modifications or upgrades:"
|
||||
my_echo ""
|
||||
my_echo "\033[37;1m\t$BUILD_ROOT/<machine>/bblayer.conf\033[0m"
|
||||
my_echo "\033[37;1m\t$BUILD_ROOT/<machine>/local.conf\033[0m"
|
||||
|
||||
my_echo ""
|
||||
my_echo "\033[37;1mStart build\033[0m"
|
||||
my_echo "------------------------------------------------------------------------------------------------"
|
||||
my_echo "Now you are ready to build your own images and packages."
|
||||
my_echo "Selectable machines are:"
|
||||
my_echo ""
|
||||
my_echo "\033[37;1m\t$MACHINES\033[0m"
|
||||
my_echo ""
|
||||
my_echo "Select your favorite machine (or identical) and the next steps are:\033[37;1m"
|
||||
my_echo ""
|
||||
my_echo "\tcd $BUILD_ROOT_DIR"
|
||||
my_echo "\t. ./oe-init-build-env build/<machine>"
|
||||
my_echo "\tbitbake neutrino-image"
|
||||
my_echo "\033[0m"
|
||||
|
||||
my_echo ""
|
||||
my_echo "\033[37;1mUpdating build evironment and meta-layers\033[0m"
|
||||
my_echo "------------------------------------------------------------------------------------------------"
|
||||
my_echo ""
|
||||
my_echo "\033[37;1m\texecute: $USER_CALL\033[0m \033[32;1m--update\033[0m"
|
||||
my_echo ""
|
||||
my_echo "------------------------------------------------------------------------------------------------"
|
||||
my_echo "For more informations and next steps take a look at the README.md!"
|
||||
my_echo "\033[32;1mDONE!\033[0m"
|
||||
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user