mirror of
https://github.com/akuker/RASCSI.git
synced 2025-08-15 08:27:34 +00:00
Remove image padding (#312)
* Remove special handling of CD image padding * Remove image padding, since it is no longer needed
This commit is contained in:
@@ -207,22 +207,6 @@ def download_image(url):
|
|||||||
return {"status": False, "msg": "Error loading the URL"}
|
return {"status": False, "msg": "Error loading the URL"}
|
||||||
|
|
||||||
|
|
||||||
def pad_image(file_name, file_size):
|
|
||||||
"""
|
|
||||||
Adds a number of bytes to the end of a file up to a size
|
|
||||||
Takes str file_name, int file_size
|
|
||||||
Returns a dict with boolean status and str msg
|
|
||||||
"""
|
|
||||||
from subprocess import run
|
|
||||||
|
|
||||||
dd_proc = run(
|
|
||||||
["dd", "if=/dev/null", f"of={file_name}", "bs=1", "count=1", f"seek={file_size}" ], capture_output=True
|
|
||||||
)
|
|
||||||
if dd_proc.returncode != 0:
|
|
||||||
return {"status": False, "msg": str(dd_proc)}
|
|
||||||
return {"status": True, "msg": "File padding successful" }
|
|
||||||
|
|
||||||
|
|
||||||
def write_config(file_name):
|
def write_config(file_name):
|
||||||
"""
|
"""
|
||||||
Takes str file_name
|
Takes str file_name
|
||||||
|
@@ -337,53 +337,6 @@
|
|||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Pad Image File</summary>
|
|
||||||
<ul>
|
|
||||||
<li>If RaSCSI fails to attach an image with a size error, you can try to pad it here. This will create a "_padded" copy of the file.</li>
|
|
||||||
<li>Drive images are padded to the nearest multiple of 512 bytes, CD-ROM images to multiples of 2048 bytes.</li>
|
|
||||||
<li>The UI only lists image files that may need padding based on their file sizes.</li>
|
|
||||||
<li>For other usecases, pad your file manually using a tool like <tt>dd</tt> on Linux.</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<table style="border: none">
|
|
||||||
<tr style="border: none">
|
|
||||||
<td style="border: none; vertical-align:top;">
|
|
||||||
<form action="/files/pad" method="post">
|
|
||||||
<label for="image">Drive images:</label>
|
|
||||||
<select name="image">
|
|
||||||
{% for f in drive_files %}
|
|
||||||
{% if f[1] % 512 %}
|
|
||||||
<option value="{{f[0]}},{{f[1]}}">{{f[0]}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
<input type="hidden" name="multiple" value="512" />
|
|
||||||
<input type="submit" value="Pad image" />
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr style="border: none">
|
|
||||||
<td style="border: none; vertical-align:top;">
|
|
||||||
<form action="/files/pad" method="post">
|
|
||||||
<label for="image">CD-ROM images:</label>
|
|
||||||
<select name="image">
|
|
||||||
{% for f in cdrom_files %}
|
|
||||||
{% if f[1] % 2048 %}
|
|
||||||
<option value="{{f[0]}},{{f[1]}}">{{f[0]}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
<input type="hidden" name="multiple" value="2048" />
|
|
||||||
<input type="submit" value="Pad image" />
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Logging</summary>
|
<summary>Logging</summary>
|
||||||
<ul>
|
<ul>
|
||||||
|
@@ -13,7 +13,6 @@ from flask import (
|
|||||||
|
|
||||||
from file_cmds import (
|
from file_cmds import (
|
||||||
list_config_files,
|
list_config_files,
|
||||||
list_files,
|
|
||||||
list_images,
|
list_images,
|
||||||
create_new_image,
|
create_new_image,
|
||||||
download_file_to_iso,
|
download_file_to_iso,
|
||||||
@@ -21,7 +20,6 @@ from file_cmds import (
|
|||||||
delete_file,
|
delete_file,
|
||||||
unzip_file,
|
unzip_file,
|
||||||
download_image,
|
download_image,
|
||||||
pad_image,
|
|
||||||
write_config,
|
write_config,
|
||||||
read_config,
|
read_config,
|
||||||
write_drive_properties,
|
write_drive_properties,
|
||||||
@@ -61,10 +59,6 @@ def index():
|
|||||||
device_types=get_device_types()
|
device_types=get_device_types()
|
||||||
files = list_images()
|
files = list_images()
|
||||||
config_files = list_config_files()
|
config_files = list_config_files()
|
||||||
drive_files = list_files(tuple(server_info["sahd"] + \
|
|
||||||
server_info["schd"] + server_info["scrm"] + \
|
|
||||||
server_info["scmo"]), server_info["image_dir"])
|
|
||||||
cdrom_files = list_files(tuple(server_info["sccd"]), server_info["image_dir"])
|
|
||||||
|
|
||||||
sorted_image_files = sorted(files["files"], key = lambda x: x["name"].lower())
|
sorted_image_files = sorted(files["files"], key = lambda x: x["name"].lower())
|
||||||
sorted_config_files = sorted(config_files, key = lambda x: x.lower())
|
sorted_config_files = sorted(config_files, key = lambda x: x.lower())
|
||||||
@@ -93,8 +87,6 @@ def index():
|
|||||||
devices=formatted_devices,
|
devices=formatted_devices,
|
||||||
files=sorted_image_files,
|
files=sorted_image_files,
|
||||||
config_files=sorted_config_files,
|
config_files=sorted_config_files,
|
||||||
drive_files=drive_files,
|
|
||||||
cdrom_files=cdrom_files,
|
|
||||||
base_dir=server_info["image_dir"],
|
base_dir=server_info["image_dir"],
|
||||||
cfg_dir=cfg_dir,
|
cfg_dir=cfg_dir,
|
||||||
scsi_ids=scsi_ids,
|
scsi_ids=scsi_ids,
|
||||||
|
Reference in New Issue
Block a user