diff --git a/CLAUDE.md b/CLAUDE.md index f7c033c..e745059 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -57,7 +57,7 @@ These are duplicated as local constants across files; keep them in sync when cha ## Installation / distribution -`install.lua` is fetched and run on a machine via `wget run /install.lua`. It deletes old paths, re-downloads every file in `LIST_FILES` from the `master` branch raw GitHub URL, and runs `startup/servers.lua`. **When adding a new file that ships to machines, add it to `LIST_FILES` in `install.lua`** (and to `SERVERS` in `startup/servers.lua` if it's a server). +`install.lua` is fetched and run on a machine via `wget run /install.lua`. It deletes old paths, re-downloads every file in `LIST_FILES` from the `master` branch raw GitHub URL by default, or from `next` when run with `--beta`, and runs `startup/servers.lua`. **When adding a new file that ships to machines, add it to `LIST_FILES` in `install.lua`** (and to `SERVERS` in `startup/servers.lua` if it's a server). ## Conventions diff --git a/README.md b/README.md index 09ea0ca..b9cd7ad 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,11 @@ wget run https://raw.githubusercontent.com/guillaumearm/cc-libs/master/install.lua ``` +Install the beta branch: +``` +wget run https://raw.githubusercontent.com/guillaumearm/cc-libs/next/install.lua --beta +``` + ## APIs - `/apis/eventloop`: a simple event loop API. - `/apis/net`: an API to simplify sending and receiving routed messages, based on the `eventloop` library. @@ -21,6 +26,7 @@ All servers are automatically started at boot. - `ping`: pings machines using `apis/net`. - `cube`: cube client for deployment. Use the `cube help` command for more details. - `goo`: turtle program for Just Dire Things goo block processing. +- `upgrade`: upgrades the machine. Use `upgrade --beta` to install from the beta branch. ## Development See [DEVELOPMENT.md](./DEVELOPMENT.md) for development setup and workflow. diff --git a/install.lua b/install.lua index 8aec1e1..c37864c 100644 --- a/install.lua +++ b/install.lua @@ -1,4 +1,6 @@ -local _VERSION = '2.0.3' +local _VERSION = '2.1.0' + +local command = ...; local LIST_FILES = { -- startup @@ -18,6 +20,22 @@ local LIST_FILES = { 'apis/eventloop.lua', }; +local function printUsage() + print('install usage:'); + print(); + print('\t\t\twget run '); + print('\t\t\twget run --beta'); +end + +local branch = 'master'; + +if command == '--beta' or command == '-beta' then + branch = 'next'; +elseif command ~= nil and command ~= '' then + printUsage(); + return; +end + -- remove old files fs.delete('ping-server.lua'); -- replaced by `servers/ping-server.lua` fs.delete('ping.lua') -- replaced by `programs/ping.lua` @@ -25,7 +43,7 @@ fs.delete('cube.lua') -- replaced by `programs/cube.lua` fs.delete('router.lua') -- replaced by `programs/router.lua` fs.delete('servers/cube-startup.lua'); -- replaced by `servers/cube-boot.lua` -local REPO_PREFIX = 'https://raw.githubusercontent.com/guillaumearm/cc-libs/master/' +local REPO_PREFIX = 'https://raw.githubusercontent.com/guillaumearm/cc-libs/' .. branch .. '/' local previousDir = shell.dir() diff --git a/programs/upgrade.lua b/programs/upgrade.lua index 0f4b201..752da3d 100644 --- a/programs/upgrade.lua +++ b/programs/upgrade.lua @@ -1,6 +1,7 @@ -local _VERSION = '1.0.0'; +local _VERSION = '1.1.0'; local INSTALL_URL = 'https://raw.githubusercontent.com/guillaumearm/cc-libs/master/install.lua'; +local BETA_INSTALL_URL = 'https://raw.githubusercontent.com/guillaumearm/cc-libs/next/install.lua'; local command = ...; @@ -8,6 +9,7 @@ local function printUsage() print('upgrade usage:'); print(); print('\t\t\tupgrade'); + print('\t\t\tupgrade --beta'); print('\t\t\tupgrade version'); print('\t\t\tupgrade help'); end @@ -22,6 +24,11 @@ if command == 'help' or command == '-help' or command == '--help' then return; end +if command == '--beta' or command == '-beta' then + shell.execute('wget', 'run', BETA_INSTALL_URL, '--beta'); + return; +end + if command ~= nil and command ~= '' then printUsage(); return;