### DSM Version Selection and Initialization Source: https://context7.com/auxxxilium/arc/llms.txt Guides the user through selecting a DSM product version, initializes synoinfo, modules, and addons for the target kernel, and writes version info to config. ```bash # Selects from versions like "7.2-64561" or "7.3-69057" arcVersion # Key writes to user-config.yml after selection: writeConfigKey "productver" "7.2" "${USER_CONFIG_FILE}" writeConfigKey "buildnum" "64561" "${USER_CONFIG_FILE}" writeConfigKey "smallnum" "0" "${USER_CONFIG_FILE}" writeConfigKey "paturl" "https://..." "${USER_CONFIG_FILE}" writeConfigKey "pathash" "" "${USER_CONFIG_FILE}" # Modules are repopulated for the kernel version: # writeConfigKey "modules" "{}" ... # mergeConfigModules "$(getAllModules epyc7002 5.10.55)" ... # Then proceeds to arcPatch -> arcSettings -> makearc ``` -------------------------------- ### GitHub Actions Build Workflow Source: https://context7.com/auxxxilium/arc/llms.txt Example configuration for a GitHub Actions workflow to build the Arc disk image. It outlines the trigger, versioning, and key build steps. ```yaml # Trigger via GitHub Actions workflow dispatch: # version: "25.1.0" # stable: true (publishes to arc repo) # beta: false # essential: false # Key build steps: # 1. getAddons / getModules / getConfigs / getPatches / getLKMs (from companion repos) # 2. getBuildroot "apex" && getBuildroot "evo" (pre-built Linux kernel + initrd) # 3. Write ARC-VERSION, ARC-BUILD, ARC-BRANCH to files/p1/ # 4. gzip -dc grub.img.gz > arc.img (base disk layout) # 5. losetup -P arc.img -> mount p1, p3 # 6. repackInitrd br/initrd-apex files/initrd files/p3/initrd-apex # (injects arc shell scripts into the buildroot initrd) # 7. Copy files/p1/* -> /tmp/p1, files/p3/* -> /tmp/p3 # 8. Convert: qemu-img -> arc-dyn.vmdk, arc.vmdk, arc.vhd, arc.vhdx, arc.ova # 9. zip -9 "arc-25.1.0.img.zip" arc.img # zip -9 "update-25.1.0.zip" ./p1 ./p3 (in-place update package) # sha256sum update-25.1.0.zip > update-25.1.0.hash ``` -------------------------------- ### Setup Navigation Event Listeners Source: https://github.com/auxxxilium/arc/blob/main/files/initrd/var/www/data/index.html Attaches click event listeners to navigation links. Handles opening DSM in a new tab and loading other pages within the current tab. ```javascript function setupNavigation() { document.querySelectorAll('#navigation-container a').forEach(link => { link.addEventListener('click', function(event) { if (this.textContent.includes('Go to DSM')) { event.preventDefault(); window.open(`http://${serverIP}:5000`, '_blank'); return; } if (!this.hasAttribute('target') || this.getAttribute('target') !== '_blank') { event.preventDefault(); loadPage(this.getAttribute('href')); } }); }); } ``` -------------------------------- ### Initialize Default Addons Source: https://context7.com/auxxxilium/arc/llms.txt Automatically selects default addons based on detected hardware. This command should be run to set up the initial configuration. ```bash init_default_addons ``` -------------------------------- ### Initialize Configuration Keys Source: https://context7.com/auxxxilium/arc/llms.txt Sets default values for configuration keys if they do not already exist in the user configuration file. This is typically run on first boot. ```bash initConfigKey "arc.backup" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.consoleblank" "600" "${USER_CONFIG_FILE}" initConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}" initConfigKey "bootscreen.dsminfo" "true" "${USER_CONFIG_FILE}" initConfigKey "bootscreen.systeminfo" "true" "${USER_CONFIG_FILE}" ``` -------------------------------- ### Fetch Server IP and Load Navigation Source: https://github.com/auxxxilium/arc/blob/main/files/initrd/var/www/data/index.html Initializes the page by fetching the server IP and then loading the navigation content. It replaces 'IP' placeholders with the actual server IP. ```javascript let embedSources = {}; let serverIP = null; fetch('./get-ip.cgi') .then(response => response.text()) .then(ip => { serverIP = ip.trim(); document.getElementById('server-ip').textContent = `Server IP: ${serverIP}`; fetch('./navigation.html') .then(response => response.text()) .then(data => { data = data.replace(/IP/g, serverIP); document.getElementById('navigation-container').innerHTML = data; setupNavigation(); loadPage('terminal'); }); }) .catch(error => { console.error('Error loading IP:', error); document.getElementById('server-ip').textContent = 'Error loading IP - reload the page'; }); ``` -------------------------------- ### Enumerate and Map Disk Controllers with `getmap` Source: https://context7.com/auxxxilium/arc/llms.txt Scans PCI devices for storage controllers (SATA, NVMe, SAS, SCSI, RAID, USB, MMC) and writes drive counts and SATA port remapping information to the user configuration file. ```bash getmap ``` ```bash # Writes to user-config.yml: # device.satadrives: 4 # device.nvmedrives: 1 # device.sasdrives: 0 # device.scsidrives: 0 # device.raiddrives: 0 # device.usbdrives: 0 # device.mmcdrives: 0 # device.drives: 5 (total) # device.harddrives: 5 (non-USB) # Also produces /tmp/drivesmax, /tmp/drivescon, /tmp/remap scratch files # used by getmapSelection to compute SataPortMap / DiskIdxMap cmdline values ``` -------------------------------- ### Initialize Configuration Key if Not Exists Source: https://context7.com/auxxxilium/arc/llms.txt Writes a configuration key and value only if the key does not already exist in the YAML file. This prevents overwriting existing user-defined settings during initialization. ```bash ``` -------------------------------- ### Fetch and Display System Information Source: https://github.com/auxxxilium/arc/blob/main/files/initrd/var/www/data/index.html Fetches system information from './get-sysinfo.cgi' and displays it within a preformatted block. It also hides all embeds. ```javascript function fetchSysinfo() { fetch('./get-sysinfo.cgi') .then(response => response.text()) .then(data => { document.getElementById('page-title').textContent = 'System Information'; const el = document.getElementById('sysinfo-container'); el.innerHTML = `
${data}
`; el.style.display = 'block'; document.querySelectorAll('.embed-container embed').forEach(embed => { embed.classList.remove('active'); embed.style.display = 'none'; }); }) .catch(error => { console.error('Error fetching system information:', error); }); } ``` -------------------------------- ### Select and Apply SATA Port Mapping Strategy with `getmapSelection` Source: https://context7.com/auxxxilium/arc/llms.txt Configures kernel command line parameters for SATA port remapping based on hardware detection or user-defined variables. It supports modes like Active Ports, Max Ports, SataRemap, and AhciRemap. ```bash # In automated mode, selection is automatic based on hardware: if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}" writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}" elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}" else writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}" writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}" fi ``` -------------------------------- ### Interactive DSM Model Selection Source: https://context7.com/auxxxilium/arc/llms.txt Presents an interactive wizard for selecting a DSM model, filtering based on hardware compatibility. Writes selected model and platform to config. ```bash # Called from the main menu (option "1 - Choose Model") or automated mode arcModel # What it checks per model entry: # - DT (Device Tree) compatibility with current controllers # - CPU thread count vs platform maximum (PLTCNT) # - NVMe/SATA/USB/SAS drive presence on the bus # - CPU flags (e.g., "avx", "aes", "movbe") in /proc/cpuinfo # - Arc serial number availability via genArc # - Hypervisor compatibility (e.g., SA6400 required for Hyper-V) # After selection, resets and writes to user-config.yml: writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}" writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}" writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}" # ... then calls arcVersion ``` -------------------------------- ### Build Patched DSM Loader Image with `makearc` Source: https://context7.com/auxxxilium/arc/llms.txt The `makearc` command orchestrates the download of DSM boot files, patching of the kernel and ramdisk using `livepatch`, and optionally uploads a config backup before triggering a boot check or prompt. ```bash # Full build flow (called after arcSettings): makearc ``` ```bash # Internal sequence: # 1. Validate: ORI_ZIMAGE_FILE, ORI_RDGZ_FILE, confdone=true, paturl, pathash # 2. Download DSM .tar if missing via getpatfiles # 3. Call livepatch (patches kernel + ramdisk, injects addons/modules/LKMs) # 4. If ARC_BACKUP=true && USERID set: POST user-config.yml to arc.auxxxilium.tech # 5. writeConfigKey "arc.builddone" "true" # 6. In automated mode: immediately call bootcheck # In config mode: prompt "Boot now? Yes/No" ``` ```bash # Files written to partition 3: # /mnt/p3/bzImage-arc (patched kernel) # /mnt/p3/initrd-arc (patched ramdisk) # /mnt/p3/zImage-dsm (original DSM zImage) # /mnt/p3/initrd-dsm (original DSM rd.gz) ``` -------------------------------- ### Check Boot Loader Integrity Source: https://context7.com/auxxxilium/arc/llms.txt Verifies that the three loader partitions are writable and essential tools are present. Returns 0 on success, 1 otherwise. ```bash checkBootLoader || die "The loader is corrupted, please rewrite it!" # Internal check performed: # - lsblk read-only flag cleared via hdparm -r0 # - [ -w /mnt/p1 ] && [ -w /mnt/p2 ] && [ -w /mnt/p3 ] # - type -p awk && type -p cut && type -p sed && type -p tar ``` -------------------------------- ### Configure Discord Notifications Source: https://context7.com/auxxxilium/arc/llms.txt Enables Discord notifications in the Arc configuration. Requires a registered HardwareID. ```bash writeConfigKey "arc.discordnotify" "true" "${USER_CONFIG_FILE}" writeConfigKey "addons.notification" "" "${USER_CONFIG_FILE}" ``` -------------------------------- ### Handle Window Resize for System Info Source: https://github.com/auxxxilium/arc/blob/main/files/initrd/var/www/data/index.html Adjusts the max-height of the system information container on window resize to ensure it fits within the viewport. ```javascript window.addEventListener('resize', () => { const el = document.getElementById('sysinfo-container'); if (el && el.style.display === 'block') { const topOffset = 120; const contentHeight = el.scrollHeight; const available = window.innerHeight - topOffset; const desired = Math.min(contentHeight + 16, available); el.style.maxHeight = desired + 'px'; } }); ``` -------------------------------- ### Load Page Content and Embeds Source: https://github.com/auxxxilium/arc/blob/main/files/initrd/var/www/data/index.html Loads different page content based on the 'page' parameter. It fetches configuration to determine ports for embeds and sets the active embed. ```javascript function loadPage(page) { let pageTitle = ''; let portKey = ''; let embedId = ''; if (page === 'terminal') { pageTitle = 'Terminal'; portKey = 'TTYD_PORT'; embedId = 'embed-terminal'; } else if (page === 'dufs') { pageTitle = 'File Manager'; portKey = 'DUFS_PORT'; embedId = 'embed-dufs'; } else if (page === 'sysinfo') { pageTitle = 'System Information'; fetchSysinfo(); return; } document.getElementById('page-title').textContent = pageTitle; document.getElementById('server-ip').textContent = `Server IP: ${serverIP}`; const sysinfoEl = document.getElementById('sysinfo-container'); if (sysinfoEl) sysinfoEl.style.display = 'none'; fetch('/etc/arc.conf') .then(response => response.text()) .then(configText => { const config = {}; configText.split('\n').forEach(line => { const [key, value] = line.split('='); if (key && value) { config[key.trim()] = value.trim(); } }); if (!config['DUFS_PORT']) { config['DUFS_PORT'] = '7304'; } if (!config['TTYD_PORT']) { config['TTYD_PORT'] = '7681'; } const port = config[portKey]; const embedSrc = `http://${serverIP}:${port}`; if (!embedSources[page]) { embedSources[page] = embedSrc; document.getElementById(embedId).src = embedSrc; } document.querySelectorAll('.embed-container embed').forEach(embed => { embed.classList.remove('active'); embed.style.display = 'none'; }); const chosen = document.getElementById(embedId); chosen.classList.add('active'); chosen.style.display = 'block'; }) .catch(error => { console.error('Error fetching config:', error); document.getElementById('server-ip').textContent = 'Error loading config - reload the page'; }); } ``` -------------------------------- ### Write Configuration Key to YAML Source: https://context7.com/auxxxilium/arc/llms.txt Persists a key/value pair into the user configuration YAML file. Use `"{}"` to create an empty map. This function is essential for saving settings. ```bash # Set the DSM model to DS923+ writeConfigKey "model" "DS923+" "${USER_CONFIG_FILE}" # Set platform writeConfigKey "platform" "epyc7002" "${USER_CONFIG_FILE}" # Create an empty addons map writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}" # Nested key: enable Arc patch writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" # Nested key: mark configuration as done writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}" ``` -------------------------------- ### Assign MAC Addresses to Network Interfaces with `getnet` Source: https://context7.com/auxxxilium/arc/llms.txt Generates and assigns MAC addresses to network interfaces, supporting Arc-signed MACs (Arc Patch mode), random MACs, or user-provided custom MACs (User mode). ```bash # Arc Patch mode: generate Arc-signed MACs for each interface MACS_OUTPUT=$(genArc "${ARC_PATCH}" "${MODEL}" mac "${ETHN}" 2>/dev/null) for i in "${!ETHX_ARRAY[@]}"; do writeConfigKey "${ETHX_ARRAY[$i]}" "${MACS_ARRAY[$i]}" "${USER_CONFIG_FILE}" done # Result in user-config.yml: # eth0: "001132aabbcc" # eth1: "001132aabbdd" ``` ```bash # User mode: prompts for each interface # writeConfigKey "eth0" "001132112233" "${USER_CONFIG_FILE}" ``` -------------------------------- ### Update Arc Loader In-Place with `updateLoader` Source: https://context7.com/auxxxilium/arc/llms.txt Performs an in-place update of the Arc loader by downloading a release zip, verifying its integrity, extracting updated files to partitions, and reloading Arc without reformatting the disk. ```bash # Update to latest stable release updateLoader "false" ``` ```bash # Update to latest beta release updateLoader "true" ``` ```bash # Update to a specific version tag updateLoader "false" "25.1.0" ``` ```bash # Update flow: # 1. Query API_URL (or BETA_API_URL) for latest tag via jq # 2. Check available disk space vs file size # 3. Download update-.zip with curl, show gauge progress via perl/dialog # 4. Verify SHA-256: curl UPDATE_URL//update-.hash # 5. Extract to /mnt/p1 and /mnt/p3 # 6. Reload Arc ``` -------------------------------- ### Read Configuration Key from YAML Source: https://context7.com/auxxxilium/arc/llms.txt Retrieves a scalar value from the YAML configuration. Returns an empty string if the key is not found or is null. Useful for accessing various settings. ```bash MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")" PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" ARC_PATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")" echo "Model: ${MODEL}, Platform: ${PLATFORM}, DSM: ${PRODUCTVER}, Kernel: ${KVER}" ``` -------------------------------- ### CSS for Embed Container and System Info Source: https://github.com/auxxxilium/arc/blob/main/files/initrd/var/www/data/index.html Styles for managing embedded content and a system information panel. Ensures proper display and scroll behavior. ```css .embed-container { position: relative; width: 100%; height: 750px; overflow: hidden; /* Prevent scrollbars from appearing */ } .embed-container embed { position: relative; width: 100%; height: 100%; border: none; display: none; overflow: hidden; /* Ensure no scrollbars appear */ } .embed-container embed.active { display: block; overflow: hidden; /* Ensure no scrollbars appear for the active embed */ } #sysinfo-container { margin-top: -750px; position: relative; z-index: 50; display: none; padding: 12px; background: #0f1113; border-radius: 6px; color: #fff; max-height: calc(100vh - 120px); overflow: auto; white-space: pre-wrap; word-break: break-word; } #sysinfo-container pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; } .embed-container embed::-webkit-scrollbar { display: none; } .embed-container embed { scrollbar-width: none; } .embed-container embed { -ms-overflow-style: none; } ``` -------------------------------- ### Configure Serial Number and Arc Patch Source: https://context7.com/auxxxilium/arc/llms.txt Sets the serial number (SN) and Arc patch status in the user configuration file. Choose between Arc-signed SN, a random anonymous SN, or a user-provided SN. ```bash SN="$(genArc "true" "${MODEL}" sn 2>/dev/null)" writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}" writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" ``` ```bash SN="$(genArc "false" "${MODEL}" sn 2>/dev/null)" writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}" ``` ```bash writeConfigKey "sn" "1234ABCDE5678" "${USER_CONFIG_FILE}" writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}" ``` -------------------------------- ### Read YAML Map Keys as Array Source: https://context7.com/auxxxilium/arc/llms.txt Retrieves only the keys from a YAML map node, outputting each key on a new line. This is useful for listing available platforms, DSM versions, or addon names. ```bash # List all supported platforms from platforms.yml PLATFORMS="$(readConfigEntriesArray "platforms" "${P_FILE}")" echo "${PLATFORMS}" # List DSM versions available for a platform VERSIONS="$(readConfigEntriesArray "platforms.epyc7002.productvers" "${P_FILE}")" echo "${VERSIONS}" ``` -------------------------------- ### Merge Module Configurations Source: https://context7.com/auxxxilium/arc/llms.txt Merges a list of module names into the `.modules` section of the YAML config. Handles numeric-named modules with a workaround. ```bash # Populate modules for a platform/kernel combination PLATFORM="epyc7002" KVER="5.10.55" ALL_MODS="$(getAllModules "${PLATFORM}" "${KVER}" | awk '{print $1}')" writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}" mergeConfigModules "${ALL_MODS}" "${USER_CONFIG_FILE}" ``` -------------------------------- ### Read YAML Map Entries Source: https://context7.com/auxxxilium/arc/llms.txt Reads all key=value pairs from a specified map node in the YAML config, returning them as newline-delimited lines. Ideal for iterating over sections like addons or command-line parameters. ```bash # Iterate over all configured addons while IFS=': ' read -r ADDON PARAM; do [ -z "${ADDON}" ] && continue echo "Addon: ${ADDON}, Param: ${PARAM:-\}" done <<<"$(readConfigMap "addons" "${USER_CONFIG_FILE}")" # Iterate cmdline parameters while IFS=': ' read -r KEY VALUE; do [ -n "${KEY}" ] && echo "cmdline.${KEY}=${VALUE}" done <<<"$(readConfigMap "cmdline" "${USER_CONFIG_FILE}")" ``` -------------------------------- ### Serial Number and MAC Address Patch Mode Selection Source: https://context7.com/auxxxilium/arc/llms.txt Offers selection between three modes for patching Serial Number and MAC address: Arc Patch, Random, or User-supplied. ```bash # Offers three SN/MAC modes: Arc Patch (AME/QC features enabled), Random (reduced features), or User-supplied (custom SN/MAC for migration scenarios). arcPatch ``` -------------------------------- ### Detect Arc Operating Mode Source: https://context7.com/auxxxilium/arc/llms.txt Detects the current operating mode by inspecting kernel command line flags. Sets the global ARC_MODE variable. ```bash # Kernel cmdline flags and corresponding ARC_MODE values: # automated_arc -> "automated" (fully unattended config+build+boot) # update_arc -> "update" (auto-update loader on boot) # force_arc -> "config" (forced interactive config UI) # force_junior -> "reinstall" (boot into DSM reinstall/junior mode) # recovery -> "recovery" (DSM recovery mode) # dsm_arc -> "dsm" (normal DSM boot path) # -> "config" (default: interactive TUI) arc_mode echo "Current mode: ${ARC_MODE}" # Output: Current mode: config # In arc.sh — branch on mode: if [ "${ARC_MODE}" = "automated" ]; then [ "${BUILDDONE}" = "false" ] && arcModel || makearc elif [ "${ARC_MODE}" = "update" ]; then updateLoader "false" elif [ "${ARC_MODE}" = "config" ]; then # drop into interactive TUI menu loop : fi ``` -------------------------------- ### Delete Configuration Key from YAML Source: https://context7.com/auxxxilium/arc/llms.txt Removes a key and its associated value from the YAML configuration file using `yq eval "del()"`. This function is used to clean up or reset specific settings. ```bash # Remove a specific cmdline parameter deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}" deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}" # Remove a specific addon deleteConfigKey "addons.\"i915\"" "${USER_CONFIG_FILE}" # Clear all modules (reset to empty map) writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}" ``` -------------------------------- ### Disable Webhook Notifications Source: https://context7.com/auxxxilium/arc/llms.txt Disables webhook notifications and removes notification addons from the Arc configuration. ```bash writeConfigKey "arc.webhooknotify" "false" "${USER_CONFIG_FILE}" deleteConfigKey "addons.notification" "${USER_CONFIG_FILE}" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.