mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-04-18 12:10:10 +08:00
fix a bug for OTA updating feature.
Add a help script to pack OTA package
This commit is contained in:
parent
f6dc9c1ab4
commit
df19e91845
81
scripts/pack_profiles.sh
Executable file
81
scripts/pack_profiles.sh
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check if required arguments are provided
|
||||||
|
if [ "$#" -lt 3 ]; then
|
||||||
|
echo "Usage: $0 VERSION NUMBER VENDOR1 [VENDOR2 ...]"
|
||||||
|
echo "Example: $0 2.3.0 1 OrcaFilamentLibrary BBL"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get version and number from arguments
|
||||||
|
VERSION="$1"
|
||||||
|
NUMBER="$2"
|
||||||
|
shift 2 # Remove first two arguments, leaving only vendor names
|
||||||
|
|
||||||
|
# Set paths
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
RESOURCES_DIR="$SCRIPT_DIR/../resources/profiles"
|
||||||
|
ORIGINAL_DIR="$(pwd)"
|
||||||
|
OUTPUT_FILE="orcaslicer-profiles_ota_${VERSION}.${NUMBER}.zip"
|
||||||
|
TEMP_DIR="/tmp/orca_profiles_$$" # Use PID to make temp dir unique
|
||||||
|
|
||||||
|
# Check if resources directory exists
|
||||||
|
if [ ! -d "$RESOURCES_DIR" ]; then
|
||||||
|
echo "Error: Profiles directory not found at $RESOURCES_DIR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create temporary directory with profiles root folder
|
||||||
|
mkdir -p "$TEMP_DIR/profiles"
|
||||||
|
|
||||||
|
# Process each vendor
|
||||||
|
for VENDOR in "$@"; do
|
||||||
|
echo "Processing vendor: $VENDOR"
|
||||||
|
|
||||||
|
# Copy JSON file if it exists
|
||||||
|
if [ -f "$RESOURCES_DIR/$VENDOR.json" ]; then
|
||||||
|
cp "$RESOURCES_DIR/$VENDOR.json" "$TEMP_DIR/profiles/"
|
||||||
|
echo "Added $VENDOR.json"
|
||||||
|
else
|
||||||
|
echo "Warning: $VENDOR.json not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy vendor directory if it exists
|
||||||
|
if [ -d "$RESOURCES_DIR/$VENDOR" ]; then
|
||||||
|
cp -r "$RESOURCES_DIR/$VENDOR" "$TEMP_DIR/profiles/"
|
||||||
|
echo "Added $VENDOR directory"
|
||||||
|
|
||||||
|
# Remove excluded file types
|
||||||
|
find "$TEMP_DIR/profiles/$VENDOR" -type f \( \
|
||||||
|
-name "*.jpg" -o \
|
||||||
|
-name "*.stl" -o \
|
||||||
|
-name "*.svg" -o \
|
||||||
|
-name "*.png" -o \
|
||||||
|
-name "*.py" \
|
||||||
|
\) -delete
|
||||||
|
else
|
||||||
|
echo "Warning: $VENDOR directory not found"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Create zip file
|
||||||
|
cd "$TEMP_DIR"
|
||||||
|
zip -r "$OUTPUT_FILE" profiles/
|
||||||
|
|
||||||
|
# Move zip file to original directory
|
||||||
|
mv "$OUTPUT_FILE" "$ORIGINAL_DIR/"
|
||||||
|
|
||||||
|
# Return to original directory
|
||||||
|
cd "$ORIGINAL_DIR"
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -rf "$TEMP_DIR"
|
||||||
|
|
||||||
|
# Print results
|
||||||
|
if [ -f "$OUTPUT_FILE" ]; then
|
||||||
|
echo "Created profiles package: $OUTPUT_FILE"
|
||||||
|
echo "Size: $(du -h "$OUTPUT_FILE" | cut -f1)"
|
||||||
|
else
|
||||||
|
echo "Error: Failed to create zip file"
|
||||||
|
exit 1
|
||||||
|
fi
|
@ -4789,6 +4789,7 @@ void GUI_App::start_sync_user_preset(bool with_progress_dlg)
|
|||||||
[this, progressFn, cancelFn, finishFn, t = std::weak_ptr<int>(m_user_sync_token)] {
|
[this, progressFn, cancelFn, finishFn, t = std::weak_ptr<int>(m_user_sync_token)] {
|
||||||
// get setting list, update setting list
|
// get setting list, update setting list
|
||||||
std::string version = preset_bundle->get_vendor_profile_version(PresetBundle::ORCA_DEFAULT_BUNDLE).to_string();
|
std::string version = preset_bundle->get_vendor_profile_version(PresetBundle::ORCA_DEFAULT_BUNDLE).to_string();
|
||||||
|
if(!m_agent) return;
|
||||||
int ret = m_agent->get_setting_list2(version, [this](auto info) {
|
int ret = m_agent->get_setting_list2(version, [this](auto info) {
|
||||||
auto type = info[BBL_JSON_KEY_TYPE];
|
auto type = info[BBL_JSON_KEY_TYPE];
|
||||||
auto name = info[BBL_JSON_KEY_NAME];
|
auto name = info[BBL_JSON_KEY_NAME];
|
||||||
|
@ -1203,9 +1203,9 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version
|
|||||||
auto machine_in_cache = (cache_profile_path / vendor_name / PRESET_PRINTER_NAME);
|
auto machine_in_cache = (cache_profile_path / vendor_name / PRESET_PRINTER_NAME);
|
||||||
|
|
||||||
if (( fs::exists(path_in_vendor))
|
if (( fs::exists(path_in_vendor))
|
||||||
&&( fs::exists(print_in_cache))
|
|| fs::exists(print_in_cache)
|
||||||
&&( fs::exists(filament_in_cache))
|
|| fs::exists(filament_in_cache)
|
||||||
&&( fs::exists(machine_in_cache))) {
|
|| fs::exists(machine_in_cache)) {
|
||||||
Semver vendor_ver = get_version_from_json(path_in_vendor.string());
|
Semver vendor_ver = get_version_from_json(path_in_vendor.string());
|
||||||
|
|
||||||
std::map<std::string, std::string> key_values;
|
std::map<std::string, std::string> key_values;
|
||||||
@ -1240,11 +1240,10 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version
|
|||||||
Version version;
|
Version version;
|
||||||
version.config_version = cache_ver;
|
version.config_version = cache_ver;
|
||||||
version.comment = description;
|
version.comment = description;
|
||||||
|
// Orca: update vendor.json
|
||||||
updates.updates.emplace_back(std::move(file_path), std::move(path_in_vendor.string()), std::move(version), vendor_name, changelog, "", force_update, false);
|
updates.updates.emplace_back(std::move(file_path), std::move(path_in_vendor.string()), std::move(version), vendor_name, changelog, "", force_update, false);
|
||||||
|
//Orca: update vendor folder
|
||||||
//BBS: add directory support
|
updates.updates.emplace_back(cache_profile_path / vendor_name, vendor_path / vendor_name, Version(), vendor_name, "", "", force_update, true);
|
||||||
updates.updates.emplace_back(cache_path / vendor_name, vendor_path / vendor_name, Version(), vendor_name, "", "", force_update, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user