# Installing Megal EPOS for Windows

## Upgrade an existing till

1. Close Megal EPOS on the till before replacing any files.
2. Back up the entire existing installation folder, including its `data` and `sales` folders.
3. Extract this ZIP into a temporary folder. Copy only `MegalEPOS.exe`, `MegalEPOS.ico`, and `topbar-logo.png` into the SAME application folder used by the existing till, replacing those three files.
4. Preserve the existing `data` and `sales` folders, all other local settings and files, and the existing shortcuts. Start the till using its usual shortcut.

Do not run an upgrade from the freshly extracted folder or point the existing shortcuts at that folder. A fresh folder creates a separate, empty till installation instead of opening the existing till data. Do not delete or replace the existing data or sales folders.

## Fresh installation

For a new till, extract the whole ZIP into a writable folder where you want the application to remain, then run `MegalEPOS.exe` from that folder. Do not run the executable from inside the ZIP. The application creates its local data folders on first launch. Create a shortcut to this executable if required.

## Developer packaging instructions

# Clean Windows release packaging

Never distribute the `build` directory. It is a developer/runtime directory and intentionally preserves local `data` and `sales` state between normal builds.

After compiling the current Windows executable, create a fresh customer package with:

```powershell
.\package-windows-release.ps1
```

The command creates a new timestamped folder and ZIP under `release\windows-fresh`. It copies only `MegalEPOS.exe`, `MegalEPOS.ico`, `topbar-logo.png`, and this release note. It does not copy any database, sales, customer, order, attendance, log, test, or device state from the project or `build` directory.

Both the package folder and ZIP are checked before they are reported as ready. The verifier rejects database files, database sidecars, state directories, symbolic links, and every file not on the explicit release allowlist. It can also be run independently:

```powershell
.\verify-windows-release.ps1 -PackageDirectory '<package-folder>' -ArchivePath '<package.zip>'
```

On first launch from this clean package, Megal EPOS creates its local databases and the single blank 16x10 starter menu. Existing developer and live databases are not changed by packaging.

`build.ps1` retains its existing developer behavior. Run it first when a new executable is required, but package only with `package-windows-release.ps1`.
