Welcome to Our Dreambox World - Japhar Sim - SuperSim
Forum Stats
12423 Members
237 Forums
7843 Topics
24069 Posts

Max Online: 9115 @ 08/24/24 07:30 PM
Newest Members
untac, vanessa, pepesol, dbr210, nik
12423 Registered Users
Who's Online
6 registered (Admin, Toysoft, bitgames, haki, Smokey, untac), 275 Guests and 107 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Top Posters
Admin 10015
Toysoft 2671
satsedhu 1713
fairbird 765
ludo19 442
Top Posters (30 Days)
Toysoft 21
Admin 13
dmr 7
Bobo360 3
Hum@xel 2
February
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
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: 10015
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 (3 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
Format ext4 in linux
by Admin
02/02/25 12:53 PM
Orange unveils EU-backed satellite project
by Admin
01/29/25 03:53 PM
Cannot install any plugin with 8 star image
by dmr
01/25/25 03:00 PM
SFR Business finalise le déploiement d'une...
by Admin
01/22/25 10:02 AM
La lutte contre le piratage IPTV échoue lamentable
by Admin
01/22/25 10:01 AM
Pas de miracle pour les plateformes de streaming
by Admin
01/22/25 10:01 AM
DreamTwo : Openatv 7.3 dreamone 20231224 (mmc)
by Toysoft
01/21/25 01:49 AM
DreamOne : Openatv 7.3 dreamone 20231224 (mmc)
by Toysoft
01/21/25 01:48 AM
DreamTwo : Newnigma2 2024.06.09
by Toysoft
01/21/25 01:47 AM
DreamOne : Newnigma2 2024.06.09
by Toysoft
01/21/25 01:47 AM
Convert script DreamOne/DreamTwo images Multibooot
by Admin
01/17/25 03:21 PM
DreamTwo : OpenPLi 9.xStar 20250115 GSt 1.20.5
by Toysoft
01/17/25 12:24 AM