Welcome to Our Dreambox World - Japhar Sim - SuperSim
Forum Stats
12364 Members
237 Forums
7868 Topics
24169 Posts

Max Online: 9115 @ 08/24/24 07:30 PM
Newest Members
puntik, bercat, claxalc, r00ted_be, Ben Sad
12364 Registered Users
Who's Online
4 registered (Admin, Toysoft, Smokey, 1593), 597 Guests and 421 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Top Posters
Admin 10038
Toysoft 2697
satsedhu 1713
fairbird 765
ludo19 442
Top Posters (30 Days)
Toysoft 4
Admin 2
frnk 1
Hum@xel 1
OMEGA 1
June
M Tu W Th F Sa Su
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
Topic Options
#25583 - 01/17/25 03:21 PM Convert script DreamOne/DreamTwo images Multibooot
Admin Online   content
Japhar Member
Carpal Tunnel

Registered: 10/19/10
Posts: 10038
Convert script DreamOne/DreamTwo images Multibooot

Code:
#!/bin/bash
# Version 1.2
# create by OE-A

if [ $# -ne 1 ]; then
  echo "Usage: $0 <input_tar.xz>"
  exit 1
fi

input_file="$1"

if [ ! -f "$input_file" ]; then
  echo "Input file does not exist: $input_file"
  exit 1
fi

# Determine the folder name(s) based on the input file name
if [[ "$input_file" == *"-dreambox-"* ]]; then
  folder_names=("dreamone" "dreamtwo")
  aio="-AIO"
elif [[ "$input_file" == *"-dreamone-"* ]]; then
  folder_names=("dreamone")
  aio=""
elif [[ "$input_file" == *"-dreamtwo-"* ]]; then
  folder_names=("dreamtwo")
  aio=""
else
  echo "Input file name should contain '-dreambox-,' '-dreamone-,' or '-dreamtwo-'"
  exit 1
fi

# Determine the Namen and the Version based on the input file name
if [[ "$input_file" == *"dream-elite"* ]]; then
  name="Dream Elite"
  version="2.6"
elif [[ "$input_file" == *"dreambox-image"* ]]; then
  name="Dreambox"
  version="2.6"
elif [[ "$input_file" == *"gemini4.2-unstable"* ]]; then
  name="Gemini"
  version="4.2"
elif [[ "$input_file" == *"Merlin_OE-2.6"* ]]; then
  name="Merlin"
  version="2.6"
elif [[ "$input_file" == *"newnigma2-deb"* ]]; then
  name="Newnigma2"
  version="2.6"
elif [[ "$input_file" == *"openpli-enigma2"* ]]; then
  name="OpenPLI"
  version="8xstar"
elif [[ "$input_file" == *"peterpan-"* ]]; then
  name="PeterPan"
  version="2.6"
else
  name="Opendreambox"
  version="2.6"
fi


# Determine the AIO TYPE based on the input file name
if [[ "$input_file" == *"-aio-"* ]]; then
  aio="-AIO"
fi


# Get the directory where the script is located
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Create a temporary directory in the same folder as the script
temp_dir=$(mktemp -d "$script_dir/tempdir.XXXXXXXXXX")

# Function to create a folder if it doesn't exist
create_folder_if_not_exists() {
  local folder="$1"
  if [ ! -d "$folder" ]; then
    echo "Creating folder: $folder"
    mkdir -p "$folder"
  fi
}

# Function to delete an existing folder
delete_existing_folder() {
  local folder="$1"
  if [ -d "$folder" ]; then
    echo "Deleting existing folder: $folder"
    rm -rf "$folder"
  fi
}

# Extract the tar.xz file as a tar into the temporary directory
echo "Extracting $input_file in a temporary directory..."
tar -xf "$input_file" -C "$temp_dir"

# create Multiboot Imagename
echo "${name} ${version}${aio} \n \l" > ${temp_dir}/etc/issue
echo "\n \l" >> ${temp_dir}/etc/issue

for folder_name in "${folder_names[@]}"; do
  delete_existing_folder "$folder_name"
  create_folder_if_not_exists "$folder_name"
  echo "copy $temp_dir/boot/Image.gz-4.9 to $folder_name/kernel.bin"
  cp "$temp_dir/boot/Image.gz-4.9" "$folder_name/kernel.bin"
  echo "Creating imageversion file in $folder_name..."
  echo "$input_file" > "$folder_name/imageversion"
done

# Repack the extracted content as tar.bz2
echo "Repacking extracted content as rootfs.tar.bz2..."
tar -cjf "$script_dir/rootfs.tar.bz2" -C "$temp_dir" .

# Move the tar.bz2 file to each folder
for folder_name in "${folder_names[@]}"; do
  # Copy the repacked tar.bz2 file to the folder
  echo "Copying rootfs.tar.bz2 to $folder_name..."
  cp "$script_dir/rootfs.tar.bz2" "$folder_name/rootfs.tar.bz2"


  # Get the base name of the input file (without path)
  base_filename=$(basename "$input_file")

  # Zip each folder with the full input filename
  output_zip="${base_filename%.tar.xz}_${folder_name}.zip"
  echo "Zipping $folder_name to $output_zip..."
  zip -r "$output_zip" "$folder_name"
  delete_existing_folder "$folder_name"
  if [ $? -eq 0 ]; then
    echo "Task completed successfully for $folder_name. Output saved as $output_zip"
  else
    echo "Failed to create the zip file for $folder_name."
  fi
done

# Clean up the temporary directory
rm "$script_dir/rootfs.tar.bz2"
rm -rf "$temp_dir"


Attachments
repack-dreambox-image.zip (7 downloads)

_________________________

Top
#25591 - 01/22/25 03:05 PM Re: Convert script DreamOne/DreamTwo images Multibooot [Re: Admin]
mushikada Offline
stranger

Registered: 12/19/18
Posts: 14
thanks freind

Top


Moderator:  Emosim 
New Topics
EchoStar bondholders brace for default battle
by Admin
06/11/25 12:23 PM
Orange bolsters Eutelsat ties with new LEO deal
by Admin
06/06/25 12:56 PM
SES, Intelsat $3.1B deal to win unconditional EU
by Toysoft
06/05/25 12:37 PM
EchoStar misses $326M payment amid FCC probe
by Toysoft
06/02/25 12:17 PM
EmbyDream on DM500HD (v1): which image?
by frnk
05/27/25 07:52 PM
DM7020HDv2 : OpenPLi 9.xStar 20250115 GSt 1.20.5
by Toysoft
01/17/25 12:21 AM
Satellites.xml for Enigma² by Hum@xel
by Hum@xel
02/02/19 08:37 AM