Commit fd88abec authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ fixes for script

parent abb4dd4a
Loading
Loading
Loading
Loading
Loading
+21 −6
Original line number Diff line number Diff line
@@ -4,14 +4,16 @@ BASE_URL=$1
TARGET_CHANNEL=$2
SITE_PATH=$3
RELEASE_BASE_PATH=$4
#$BASE_URL="https://top.etsi.org/top-extras/updatesite"

update_contents() {
    local TARGET_PATH=$1
    # Escape slashes in the variable
    CLEAN=$(echo "$TARGET_PATH" | sed 's/\//\\\//g')
    echo $TARGET_PATH
    CLEAN=$(echo "$TARGET_PATH/" | sed 's/\//\\\//g')
    echo $CLEAN
    # Use the escaped variable in a sed command
    find . -type f | sed -e "s|$CLEAN_URL||g" > "$TARGET_PATH/content.txt"
    echo "find . -type f | sed -e \"s|$CLEAN||g\" > \"$TARGET_PATH/content.txt\""
    find $TARGET_PATH -type f | sed -e "s|$CLEAN||g" > "$TARGET_PATH/content.txt"
}

process_contents() {
@@ -26,6 +28,10 @@ process_contents() {
    while IFS= read -r line; do
        # Execute your command for each line
        echo "Processing: $line"
        if [ "$line" == "" ]; then
            echo "Empty line, aborting."
            exit 0
        fi        
        # make parent dirs
        mkdir -p `dirname "$line"`
        # get file
@@ -33,6 +39,7 @@ process_contents() {
        # update contents
    done < "$file"
    update_contents $channel
    mkdir -p $RELEASE_BASE_PATH/$channel
    cp -r -f $channel/* $RELEASE_BASE_PATH/$channel
}

@@ -43,6 +50,14 @@ else
    process_contents "beta"
fi

# update conteints
# update contents
update_contents "$SITE_PATH"

# Debugging
# BASE_URL="https://top.etsi.org/top-extras/updatesite"
# TARGET_CHANNEL="beta"
# SITE_PATH="updatesite/org.etsi.mts.tdl.extras.updatesite/target/repository"
# RELEASE_BASE_PATH="public/updatesite"

# # process_contents beta
# update_contents "$SITE_PATH"