How bin456789/reinstall works
1. This repository is a script-driven OS reinstallation toolkit, not an application server. The top-level product is a single workflow that can reboot a machine into a temporary installer environment, reimage the disk, and then hand control to the new OS.
2. There are two primary entrypoints: reinstall.sh for Linux hosts and reinstall.bat for Windows hosts. They expose the same command surface so the same tool can be launched from either current OS.
3. The core control flow is: parse user intent and target OS, fetch the needed install media or boot artifacts, generate temporary network/storage configuration, write or patch the boot/install environment, then reboot into that environment. Most of the repository exists to support one of those stages.
4. The repo supports several provisioning modes, which are architecturally distinct:
- Linux installation from distro images or cloud images
- Raw image/DD deployment
- Booting into Alpine Live OS for manual recovery
- Booting into netboot.xyz for manual OS selection
- Windows ISO installation with driver injection and unattended setup
5. Linux provisioning is built around config injection files such as cloud-init.yaml, ubuntu.yaml, debian.cfg, redhat.cfg, and helper scripts like initrd-network.sh, cloud-init-fix-onlink.sh, and ubuntu-storage-early.sh. These pieces adapt network and storage behavior so the temporary installer can reach mirrors and lay out disks correctly across many distro families.
6. Windows provisioning is a separate subsystem centered on windows.xml plus batch/PowerShell helpers like windows-setup.bat, windows-set-netconf.bat, windows-resize.bat, windows-driver-utils.sh, wmic.ps1, and the windows-*.bat utilities. This side handles ISO selection, image index selection, driver injection, RDP/ping tweaks, network setup, and post-install customization.
7. The repository also includes hardware-compatibility shims such as fix-eth-name.*, resize.sh, ttys.sh, windows-change-rdp-port.bat, and related scripts. These are focused on making the installer usable across cloud providers, BIOS/EFI variants, ARM hosts, and machines with unusual NIC naming or disk layouts.
8. Runtime observability is an explicit subsystem. logviewer-nginx.conf and logviewer.html indicate a small local web UI served during installation, complementing SSH access, serial console, VNC, and optional frpc tunneling. In other words, the install process is designed to be monitored and rescued remotely while it is running.
9. External dependencies are mostly fetched on demand rather than bundled. The scripts pull Linux mirrors, Windows ISO links, official driver packages, and cloud-init-style artifacts from upstream sources at runtime. That means the repo is more of an orchestrator than a content host.
10. The frpc files (frpc-example.toml, frpc.service, windows-frpc.*, get-frpc-url.sh) form an optional reverse-connect path that can expose the temporary installer or installed machine through an external tunnel. This is a separate communications channel from SSH/web logs and is meant for NATed VPS recovery.
11. cloud-init.yaml, windows.xml, and the various distro/OS-specific config files are the main boundary between generic orchestration and OS-specific provisioning logic. The orchestration scripts decide “which path,” while these assets define “how that OS boots and configures itself.”
12. The .github/workflows files are support infrastructure for distribution, not runtime behavior. They automate repository sync/mirroring and reinstall-related checks, which is consistent with a tool that is primarily consumed as a downloadable script rather than installed as a package.
Main entry points: initrd-network.sh Boot prep · windows.xml Windows config · logviewer.html Remote access · windows-setup.bat Setup scripts
Components 20
Entry points
Primary launchers for Linux and Windows hosts.
- Reinstall SH · Linux-host launcher exposing the reinstall command surface.
reinstall.sh - Reinstall BAT · Windows-host launcher exposing the same reinstall command surface.
reinstall.bat
Orchestration
Cross-platform flow that selects mode, fetches media, prepares boot artifacts, and reboots.
- Main flow · Coordinates intent parsing, target OS selection, artifact fetch, boot prep, and reboot.
- Media fetch · Downloads distro images, Windows ISOs, drivers, and other upstream install inputs on demand.
- Boot prep · Writes or patches temporary installer environments before rebooting into them.
initrd-network.sh
Linux provisioning
Linux installer and recovery paths, plus distro-specific config injection.
- Linux config · Linux-side OS-specific boot and storage/network configuration assets.
- Cloud-init · Cloud-init injection and on-link/network fixes for cloud and distro installs.
cloud-init.yaml - Distro configs · Distribution-specific installer settings for Debian, Red Hat, and Ubuntu flows.
debian.cfg - Ubuntu storage · Early storage layout adjustments for Ubuntu-style installation flows.
ubuntu-storage-early.sh - Recovery modes · Manual recovery and alternative boot paths such as Alpine live and netboot selection.
Windows provisioning
Windows ISO deployment, setup customization, and driver/network injection.
- Windows config · Windows-specific unattended install, network, driver, and post-install configuration.
windows.xml - Setup scripts · Batch and PowerShell helpers that drive ISO setup, net configuration, and tuning.
windows-setup.bat - Driver tools · Driver injection and image-index related helper logic for Windows deployments.
windows-driver-utils.sh
Access and recovery
Operator visibility and remote reachability during install or recovery.
- Remote access · Local logs, console access, and remote viewing paths used during installs.
logviewer.html - Log viewer · Small local web UI for installer logs, typically served by nginx.
logviewer-nginx.conf - FRPC tunnel · Optional reverse-connect path for NAT traversal and remote rescue.
frpc-example.toml
Compatibility shims
Host-specific fixes for NIC naming, storage layout, console access, and resizing.
- NIC fixes · Host adaptation for unusual NIC naming, init scripts, and service wiring.
fix-eth-name.sh - Resize tools · Disk and partition resize helpers for hosts with atypical layouts.
resize.sh - TTY tools · Console and terminal access helpers for installer visibility.
ttys.sh - Windows tweaks · Ping, RDP, and network-access adjustments for Windows recovery and post-install use.
windows-change-rdp-port.bat
Connections 23
- Reinstall SH → Main flow: launches · Linux launcher enters the shared reinstall workflow.
- Reinstall BAT → Main flow: launches · Windows launcher enters the shared reinstall workflow.
- Main flow → Media fetch: fetches · Workflow retrieves install media and upstream artifacts as needed.
- Main flow → Boot prep: prepares · Workflow builds the temporary boot/install environment.
- Main flow → Linux config: selects · Workflow routes Linux targets into distro-specific provisioning.
- Main flow → Recovery modes: selects · Workflow can switch into manual recovery or netboot paths.
- Main flow → Windows config: selects · Workflow routes Windows targets into unattended deployment.
- Boot prep → NIC fixes: applies · Boot preparation incorporates compatibility shims where needed.
- Boot prep → Resize tools: applies · Boot preparation may resize or reshape storage before install.
- Boot prep → TTY tools: exposes · Temporary environment is made accessible over consoles or TTYs.
- Linux config → Cloud-init: uses · Linux provisioning uses cloud-init style injection and fixes.
- Linux config → Distro configs: uses · Linux provisioning branches into distro-specific configs.
- Linux config → Ubuntu storage: uses · Ubuntu flow uses early storage adjustments.
- Recovery modes → Media fetch: downloads · Recovery modes still rely on fetched live images or boot artifacts.
- Windows config → Setup scripts: driven by · Windows config is applied through setup and network helper scripts.
- Windows config → Driver tools: injects · Windows deployment injects drivers and aligns image selection.
- Setup scripts → Windows tweaks: tunes · Setup helpers adjust ping, RDP, and access settings.
- Remote access → Log viewer: served by · Log viewer UI is exposed through the nginx config.
- Main flow → Remote access: monitors · Workflow is designed to be observed and rescued remotely.
- Main flow → FRPC tunnel: optionally tunnels · Workflow can expose the installer through an external reverse tunnel.
- FRPC tunnel → Remote access: complements · Tunnel is a separate access path alongside local log viewing.
- NIC fixes → Main flow: supports · NIC fix shims support the shared workflow across hosts.
- Windows tweaks → Windows config: supports · Windows tweaks support the Windows provisioning subsystem.