Verified Commit 1c91dea4 authored by Aral Balkan's avatar Aral Balkan
Browse files

Deploy, install, and update now supports alpha/beta builds

Also, remove the defunct http server error handling written for the pre-Auto Encrypt/Auto Encrypt Localhost-based @small-tech/https module.
parent 79ca4323
......@@ -948,7 +948,7 @@ module.exports = app => {
}
```
When using the _routes.js_ file, you can use all of the features in [wxpress](https://expressjs.com/) and [our fork of express-ws](https://github.com/aral/express-ws) (which itself wraps [ws](https://github.com/websockets/ws#usage-examples)).
When using the _routes.js_ file, you can use all of the features in [express](https://expressjs.com/) and [our fork of express-ws](https://github.com/aral/express-ws) (which itself wraps [ws](https://github.com/websockets/ws#usage-examples)).
### Routing precedence
......
......@@ -374,50 +374,73 @@ async function build () {
// site.js/app/bin/
//
// site.js
// |_ app This project.
// | |_ bin The folder that this script is running in.
// |_ site The Site.js web site.
// |_ releases The folder that release binaries are held.
// |_ app This project.
// | |_ bin The folder that this script is running in.
// |_ site The Site.js web site.
// |_ version/
// | |_ index.js (Dynamic) Returns source version (for compatibility with versions prior to 12.11.0)
// | |_ alpha
// | | |_ index.js (Dynamic) If it exists, returns latest alpha channel version.
// | |_ beta
// | | |_ index.js (Dynamic) If it exists, returns latest beta channel version.
// | |_ release
// | |_ index.js (Dynamic) If it exists, returns latest release channel version.
// |_ releases The folder that release binaries are held.
// |_ alpha Contains alpha releases. (12.11.0+)
// |_ beta Contains beta releases. (12.11.0+)
//
// If it cannot find the Site.js web site, the build script will simply skip this step.
//
const pathToWebSite = path.resolve(path.join(__dirname, '../../site/'))
const pathToReleasesFolder = path.resolve(path.join(pathToWebSite, 'releases/'))
const pathToDynamicVersionRoute = path.join(pathToWebSite, '.dynamic', 'version.js')
const pathToInstallationScriptsFolderOnWebSite = path.join(pathToWebSite, 'installation-scripts')
const pathToLinuxAndMacOSInstallationScriptFileOnWebSite = path.join(pathToInstallationScriptsFolderOnWebSite, 'install')
const pathToWindowsInstallationScriptFileOnWebSite = path.join(pathToInstallationScriptsFolderOnWebSite, 'install.txt')
const INDEX = 'index.js'
const websitePath = path.resolve(path.join(__dirname, '../../site/'))
const websitePathForReleases = path.resolve(path.join(websitePath, 'releases/'))
const websitePathForOldVersionRoute = path.join(websitePath, '.dynamic', 'version.js')
const websitePathForSourceVersionRoute = path.join(websitePath, '.dynamic', 'version', INDEX)
const websitePathForBinaryVersionRoute = path.join(websitePath, '.dynamic', 'version', releaseType, INDEX)
const websitePathForInstallScripts = path.join(websitePath, 'installation-scripts')
const websitePathForLinuxAndMacInstallScript = path.join(websitePathForInstallScripts, 'install')
const websitePathForWindowsInstallScript = path.join(websitePathForInstallScripts, 'install.txt')
// 12.10.5 → 12.11.0 migration. If old .dynamic/version.js path exists on the site, delete it.
fs.removeSync(websitePathForOldVersionRoute)
// Check that a local working copy of the Site.js web site exists at the relative location
// that we expect it to. If it doesn’t skip this step.
if (fs.existsSync(pathToWebSite)) {
if (fs.existsSync(websitePath)) {
console.log(' • Copying release binaries to the Site.js web site…')
const linuxX64VersionZipFilePath = path.join(linuxX64WorkingDirectory, zipFileName)
const linuxArmVersionZipFilePath = path.join(linuxArmWorkingDirectory, zipFileName)
const macOsVersionZipFilePath = path.join(macOsWorkingDirectory, zipFileName )
const windowsVersionZipFilePath = path.join(windowsWorkingDirectory, zipFileName )
const linuxX64VersionZipFilePath = path.join(linuxX64WorkingDirectory, zipFileName)
const linuxArmVersionZipFilePath = path.join(linuxArmWorkingDirectory, zipFileName)
const macOsVersionZipFilePath = path.join(macOsWorkingDirectory, zipFileName)
const windowsVersionZipFilePath = path.join(windowsWorkingDirectory, zipFileName)
const websitePathForLinuxX64Version = path.join(websitePathForReleases, 'linux' )
const websitePathForLinuxArmVersion = path.join(websitePathForReleases, 'linux-arm')
const websitePathForMacVersion = path.join(websitePathForReleases, 'macos' )
const websitePathForWindowsVersion = path.join(websitePathForReleases, 'windows' )
fs.mkdirSync(websitePathForLinuxX64Version, {recursive: true})
fs.mkdirSync(websitePathForLinuxArmVersion, {recursive: true})
fs.mkdirSync(websitePathForMacVersion, {recursive: true})
fs.mkdirSync(websitePathForWindowsVersion, {recursive: true})
const linuxX64VersionTargetDirectoryOnSite = path.join(pathToReleasesFolder, 'linux' )
const linuxArmVersionTargetDirectoryOnSite = path.join(pathToReleasesFolder, 'linux-arm')
const macOsVersionTargetDirectoryOnSite = path.join(pathToReleasesFolder, 'macos' )
const windowsVersionTargetDirectoryOnSite = path.join(pathToReleasesFolder, 'windows' )
fs.copyFileSync(linuxX64VersionZipFilePath, path.join(websitePathForLinuxX64Version, zipFileName))
fs.copyFileSync(linuxArmVersionZipFilePath, path.join(websitePathForLinuxArmVersion, zipFileName))
fs.copyFileSync(macOsVersionZipFilePath, path.join(websitePathForMacVersion, zipFileName))
fs.copyFileSync(windowsVersionZipFilePath, path.join(websitePathForWindowsVersion, zipFileName))
fs.mkdirSync(linuxX64VersionTargetDirectoryOnSite, {recursive: true})
fs.mkdirSync(linuxArmVersionTargetDirectoryOnSite, {recursive: true})
fs.mkdirSync(macOsVersionTargetDirectoryOnSite, {recursive: true})
fs.mkdirSync(windowsVersionTargetDirectoryOnSite, {recursive: true})
// Write out a dynamic routes with the latest source version (for compatibility with releases prior to
// source version 12.11.0) and binary version ( for source version 12.11.0+). These endpoints are used by the
// auto-update feature to decide whether the binary needs to update.
console.log(' • Adding dynamic source version endpoint to Site.js web site.')
const sourceVersionRoute = `module.exports = (request, response) => { response.end('${sourceVersion}') }\n`
fs.writeFileSync(websitePathForSourceVersionRoute, sourceVersionRoute, {encoding: 'utf-8'})
fs.copyFileSync(linuxX64VersionZipFilePath, path.join(linuxX64VersionTargetDirectoryOnSite, zipFileName))
fs.copyFileSync(linuxArmVersionZipFilePath, path.join(linuxArmVersionTargetDirectoryOnSite, zipFileName))
fs.copyFileSync(macOsVersionZipFilePath, path.join(macOsVersionTargetDirectoryOnSite, zipFileName))
fs.copyFileSync(windowsVersionZipFilePath, path.join(windowsVersionTargetDirectoryOnSite, zipFileName))
console.log(` • Adding dynamic binary version endpoint for ${releaseType ? `${releaseType} `: ''}release to Site.js web site.`)
const binaryVersionRoute = `module.exports = (request, response) => { response.end('${binaryVersion}') }\n`
fs.writeFileSync(websitePathForBinaryVersionRoute, binaryVersionRoute, {encoding: 'utf-8'})
// Write out a dynamic route with the latest version into the site. That endpoint will be used by the
// auto-update feature to decide whether it needs to update.
console.log(' • Adding dynamic version endpoint to Site.js web site.')
const versionRoute = `module.exports = (request, response) => { response.end('${binaryVersion}') }\n`
fs.writeFileSync(pathToDynamicVersionRoute, versionRoute, {encoding: 'utf-8'})
// Update the install file and deploy them to the Site.js web site.
console.log(' • Updating the installation scripts and deploying them to Site.js web site.')
......@@ -427,10 +450,11 @@ async function build () {
//
const linuxAndMacOSInstallScriptFile = path.join(mainSourceDirectory, 'script', 'install')
let linuxAndMacOSInstallScript = fs.readFileSync(linuxAndMacOSInstallScriptFile, 'utf-8')
linuxAndMacOSInstallScript = linuxAndMacOSInstallScript.replace(/\d+\.\d+\.\d+/g, binaryVersion)
linuxAndMacOSInstallScript = linuxAndMacOSInstallScript.replace(/\d+\.\d+\.\d+/g, sourceVersion)
linuxAndMacOSInstallScript = linuxAndMacOSInstallScript.replace(/\d{14}/, binaryVersion)
fs.writeFileSync(linuxAndMacOSInstallScriptFile, linuxAndMacOSInstallScript)
fs.copyFileSync(linuxAndMacOSInstallScriptFile, pathToLinuxAndMacOSInstallationScriptFileOnWebSite)
fs.copyFileSync(linuxAndMacOSInstallScriptFile, websitePathForLinuxAndMacInstallScript)
//
// Windows.
......@@ -440,10 +464,10 @@ async function build () {
windowsInstallScript = windowsInstallScript.replace(/\d+\.\d+\.\d+/g, binaryVersion)
fs.writeFileSync(windowsInstallScriptFile, windowsInstallScript)
fs.copyFileSync(windowsInstallScriptFile, pathToWindowsInstallationScriptFileOnWebSite)
fs.copyFileSync(windowsInstallScriptFile, websitePathForWindowsInstallScript)
} else {
console.log(' • No local working copy of Site.js web site found. Skipped copy of release binaries.')
console.log(` • No local working copy of Site.js web site found. Skipped copy of release binaries. Please clone https://small-tech.org/site.js/site to ${websitePath} and ensure you have commit permissions on the repository before attempting to deploy.`)
}
}
......
......@@ -207,12 +207,6 @@ function serve (args) {
const server = site.server
// Exit on known errors as we have already logged them to console.
// (Otherwise, the stack trace will be output for debugging purposes.)
server.on(server.SMALL_TECH_ORG_ERROR_HTTP_SERVER, () => {
process.exit(1)
})
// Start sync if requested.
if (syncOptions !== null) {
sync(syncOptions)
......
......@@ -26,39 +26,59 @@ async function update () {
const cpuArchitecture = os.arch()
const isLinux = platform === 'linux'
const releaseType = Site.releaseType
const releaseTypePath = releaseType === 'release' ? '/' : `/${releaseType}/`
ensure.root('update')
Site.logAppNameAndVersion(/* compact = */ true)
console.log(' 🧐 Checking for updates…\n')
console.log(` 🧐 Checking for ${releaseType} updates…\n`)
let response
try {
response = await secureGet('https://sitejs.org/version')
response = await secureGet(`https://sitejs.org/version/${releaseType}`)
} catch (error) {
console.log(' 🤯 Error: Could not check for updates.\n')
console.log(` 🤯 Error: Could not check for ${releaseType} updates.\n`)
console.log(error)
exitGracefully(1)
return
}
const latestVersion = response.body
const [latestMajor, latestMinor, latestPatch] = latestVersion.split('.').map(string => parseInt(string))
const currentVersion = Site.binaryVersion
const currentVersion = Site.versionNumber()
const [currentMajor, currentMinor, currentPatch] = currentVersion.split('.').map(string => parseInt(string))
const humanReadableCurrentVersion = Site.humanReadableBinaryVersion
const humanReadableLatestVersion = Site.binaryVersionToHumanReadableDateString(latestVersion)
if (currentVersion !== latestVersion) {
// Are we running a newer (development or beta) version than the latest release version?
if (currentMajor > latestMajor || (currentMajor === latestMajor && currentMinor > latestMinor) || (currentMajor === latestMajor && currentMinor === latestMinor && currentPatch > latestPatch)) {
console.log(` 🤓 You are running a newer version (${currentVersion}) than the latest released version (${latestVersion}).\n`)
// Are we running a newer version than the latest release version?
if (currentVersion > latestVersion) {
console.log(` 🤓 You are running a newer ${releaseType} version (released on ${humanReadableCurrentVersion}) than the latest ${releaseType} version (released on ${humanReadableLatestVersion}).\n`)
exitGracefully()
return
}
// Get the source version also.
try {
response = await secureGet(`https://sitejs.org/version/`)
} catch (error) {
console.log(` 🤯 Error: Could not check for ${releaseType} source version.\n`)
console.log(error)
exitGracefully(1)
return
}
const latestSourceVersion = response.body
const currentSourceVersion = Site.sourceVersion
const currentFullVersion = `${currentBinaryVersion}/${currentSourceVersion}`
const latestFullVersion = `${latestBinaryVersion}/${latestSourceVersion}`
// The current version is not newer than the latest version and we know
// that it isn’t equal to the release version so it must be older. Let’s
// update!
console.log(` 🎁 There is a new version of Site.js available (v${latestVersion}).\n`)
console.log(` 🎁 There is a new ${releaseType} version of Site.js available (${latestFullVersion} released on ${humanReadableLatestVersion}). You currently have ${releaseType} version ${currentFullVersion} released on ${humanReadableCurrentVersion}\n`)
//
// Compose the right binary URL for the platform and architecture.
......@@ -74,9 +94,9 @@ async function update () {
platformPath = `${platformPath}-arm`
}
let binaryUrl = `https://sitejs.org/releases/${platformPath}/${latestVersion}.tar.gz`
let binaryUrl = `https://sitejs.org/releases/${releaseTypePath}${platformPath}/${latestVersion}.tar.gz`
console.log(` 📡 Downloading Site.js version ${latestVersion}…`)
console.log(` 📡 Downloading Site.js ${releaseType} version ${latestFullVersion}…`)
let latestReleaseResponse
try {
......@@ -121,7 +141,7 @@ async function update () {
if (ensure.commandExists('systemctl')) {
const { isActive } = status()
if (isActive) {
console.log(` 😈 Daemon is running on old version. Restarting it using Site.js v${latestVersion}…`)
console.log(` 😈 Daemon is running on old version. Restarting it using Site.js ${releaseType} version ${latestFullVersion}…`)
try {
restart()
......
......@@ -46,7 +46,6 @@ const errors = require('./lib/errors')
class Site {
static #appNameAndVersionAlreadyLogged = false
static #manifest = null
......@@ -54,72 +53,53 @@ class Site {
return `${clr('🅷', 'magenta')} ${clr('🆄', 'blue')} ${clr('🅶', 'green')} ${clr('🅾', 'yellow')} `
}
// Emitted when the address the server is trying to use is already in use by a different process on the system.
static get SMALL_TECH_ORG_ERROR_HTTP_SERVER () { return 'small-tech.org-error-http-server' }
// The cross-platform hostname (os.hostname() on Linux and macOS, special handling on Windows to return
// the full computer name, which can be a domain name and thus the equivalent of hostname on Linux and macOS).
static get hostname () { return crossPlatformHostname }
// This is the directory that settings and other persistent data is stored for Site.js.
static get settingsDirectory () { return path.join(os.homedir(), '.small-tech.org', 'site.js') }
// Logs a nicely-formatted version string based on
// the version set in the package.json file to console.
// (Only once per Site lifetime.)
// (Synchronous.)
static logAppNameAndVersion (compact = false) {
if (process.env.QUIET) {
return
}
if (!Site.#appNameAndVersionAlreadyLogged && !process.argv.includes('--dont-log-app-name-and-version')) {
let prefix1 = compact ? ' 💕 ' : ' 💕 '
let prefix2 = compact ? ' ' : ' '
this.readAndCacheManifest()
let message = [
`\n${prefix1}Site.js ${this.humanReadableReleaseType()}\n\n`,
`${prefix2}Build : ${clr(this.humanReadableVersion(), 'green')}\n`,
`${prefix2}Engine: ${clr(`Node.js ${process.version}`, 'green')}\n`,
`${prefix2}Source: ${clr(`https://source.small-tech.org/site.js/app/tags/${this.#manifest.sourceVersion}`, 'cyan')}\n\n`,
`${prefix2}╔═══════════════════════════════════════════╗\n`,
`${prefix2}║ Like this? Fund us! ║\n`,
`${prefix2}║ ║\n`,
`${prefix2}║ We’re a tiny, independent not-for-profit. ║\n`,
`${prefix2}║ https://small-tech.org/fund-us ║\n`,
`${prefix2}╚═══════════════════════════════════════════╝\n`,
].join('')
console.log(message)
Site.#appNameAndVersionAlreadyLogged = true
}
// Manifest helpers. The manifest file is created by the build script and includes metadata such as the
// binary version (in calendar version format YYYYMMDDHHmmss), the source version (in semantic version format), and
// the release type (alpha, beta, or release).
static RELEASE_TYPE = {
alpha : 'alpha',
beta : 'beta',
release: 'release'
}
static readAndCacheManifest () {
this.#manifest = JSON.parse(fs.readFileSync(path.join(__dirname, './manifest.json'), 'utf-8'))
}
// Return the binary version.
static versionNumber () {
static get releaseType () {
if (this.#manifest === null) {
this.readAndCacheManifest()
}
return this.#manifest.releaseType
}
static get binaryVersion () {
if (this.#manifest === null) {
this.readAndCacheManifest()
}
return this.#manifest.binaryVersion
}
static humanReadableVersion () {
static get sourceVersion () {
if (this.#manifest === null) {
this.readAndCacheManifest()
}
const m = moment(this.#manifest.binaryVersion, 'YYYYMMDDHHmmss')
return this.#manifest.sourceVersion
}
static binaryVersionToHumanReadableDateString (binaryVersion) {
const m = moment(binaryVersion, 'YYYYMMDDHHmmss')
return `${m.format('MMMM Do, YYYY')} at ${m.format('HH:mm:ss')}`
}
static humanReadableReleaseType () {
static get humanReadableBinaryVersion () {
if (this.#manifest === null) {
this.readAndCacheManifest()
}
return this.binaryVersionToHumanReadableDateString(this.#manifest.binaryVersion)
}
static get releaseTypeFormattedForConsole () {
if (this.#manifest === null) {
this.readAndCacheManifest()
}
......@@ -143,6 +123,48 @@ class Site {
}
}
// The cross-platform hostname (os.hostname() on Linux and macOS, special handling on Windows to return
// the full computer name, which can be a domain name and thus the equivalent of hostname on Linux and macOS).
static get hostname () { return crossPlatformHostname }
// This is the directory that settings and other persistent data is stored for Site.js.
static get settingsDirectory () { return path.join(os.homedir(), '.small-tech.org', 'site.js') }
// Logs a nicely-formatted version string based on
// the version set in the package.json file to console.
// (Only once per Site lifetime.)
// (Synchronous.)
static logAppNameAndVersion (compact = false) {
if (process.env.QUIET) {
return
}
if (!Site.#appNameAndVersionAlreadyLogged && !process.argv.includes('--dont-log-app-name-and-version')) {
let prefix1 = compact ? ' 💕 ' : ' 💕 '
let prefix2 = compact ? ' ' : ' '
this.readAndCacheManifest()
let message = [
`\n${prefix1}Site.js ${this.releaseTypeFormattedForConsole}\n\n`,
`${prefix2}Build : ${clr(this.humanReadableBinaryVersion, 'green')}\n`,
`${prefix2}Engine: ${clr(`Node.js ${process.version}`, 'green')}\n`,
`${prefix2}Source: ${clr(`https://source.small-tech.org/site.js/app/tags/${this.sourceVersion}`, 'cyan')}\n\n`,
`${prefix2}╔═══════════════════════════════════════════╗\n`,
`${prefix2}║ Like this? Fund us! ║\n`,
`${prefix2}║ ║\n`,
`${prefix2}║ We’re a tiny, independent not-for-profit. ║\n`,
`${prefix2}║ https://small-tech.org/fund-us ║\n`,
`${prefix2}╚═══════════════════════════════════════════╝\n`,
].join('')
console.log(message)
Site.#appNameAndVersionAlreadyLogged = true
}
}
// Default error pages.
static default404ErrorPage(missingPath) {
return `<!doctype html><html lang="en" style="font-family: sans-serif; background-color: #eae7e1"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Error 404: Not found</title></head><body style="display: grid; align-items: center; justify-content: center; height: 100vh; vertical-align: top; margin: 0;"><main><h1 style="font-size: 16vw; color: black; text-align:center; line-height: 0.25">4🤭4</h1><p style="font-size: 4vw; text-align: center; padding-left: 2vw; padding-right: 2vw;"><span>Could not find</span> <span style="color: grey;">${missingPath}</span></p></main></body></html>`
......@@ -520,18 +542,6 @@ class Site {
// Enable the ability to destroy the server (close all active connections).
enableDestroy(this.server)
// Provide access to the error constant on the server instance itself
// as consuming objects may not have access to the class itself.
this.server.SMALL_TECH_ORG_ERROR_HTTP_SERVER = Site.SMALL_TECH_ORG_ERROR_HTTP_SERVER
this.server.on('error', error => {
this.log('\n 🤯 ❨Site.js❩ Error: could not start server.\n')
if (error.code === 'EADDRINUSE') {
this.log(` 💥 ❨Site.js❩ Port ${this.port} is already in use.\n`)
}
this.server.emit(Site.SMALL_TECH_ORG_ERROR_HTTP_SERVER)
})
this.server.on('close', () => {
// Clear the auto update check interval.
if (this.autoUpdateCheckInterval !== undefined) {
......
#!/bin/bash
######################################################################
##########################################################################################
#
# Site.js v12.11.0 Installer for Linux (x86 and armv7l) and macOS.
# Site.js version 202005010942/12.11.0 Installer for Linux (x86 and ARM) and macOS.
#
# To use:
#
# wget -qO- https://sitejs.org/install | bash
#
# Copyright (c) 2019 Aral Balkan.
# Copyright (c) 2019-2020 Aral Balkan.
# Released under the AGPL version 3.0 or later license.
# Made with ♥ by Small Technology Foundation (https://small-tech.org)
# Like this? Fund us! (https://small-tech.org/fund-us)
#
######################################################################
##########################################################################################
set -e
echo
echo " 📡 Downloading Site.js v12.11.0…"
echo " 📡 Downloading Site.js version 202005010942/12.11.0…"
function cleanUp {
popd > /dev/null
rm -rf /tmp/sitejs.org
}
releaseType=$1
releaseTypePath='/'
if [[ "$releaseType" == "alpha" ]]; then
# Writes ALPHA in large red block letters.
echo -e '\033[31m'
echo ' █████  ██  ██████  ██  ██  █████'
echo ' ██   ██ ██  ██   ██ ██  ██ ██   ██ '
echo ' ███████ ██  ██████  ███████ ███████ '
echo ' ██   ██ ██  ██      ██   ██ ██   ██ '
echo ' ██  ██ ███████ ██  ██  ██ ██  ██'
echo -e '\033[0m'
releaseTypePath='/alpha/'
elif [[ "$releaseType" == "beta" ]]; then
# Writes BETA in large yellow block letters.
echo -e '\033[33m'
echo ' ██████  ███████ ████████  █████ '
echo ' ██   ██ ██         ██    ██   ██ '
echo ' ██████  █████  ██  ███████ '
echo ' ██   ██ ██     ██  ██   ██ '
echo ' ██████  ███████  ██  ██  ██'
echo -e '\033[0m'
releaseTypePath='/beta/'
else
# Ignore any other type and default to the release version.
releaseType=''
fi
# Setup
rm -rf /tmp/sitejs.org
mkdir -p /tmp/sitejs.org
......@@ -33,29 +61,33 @@ if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux-gnueabihf" ]]; then
cpuArchitecture=`uname -m`
if [[ "$cpuArchitecture" == "x86_64" ]]; then
# Linux on x64.
wget -q https://sitejs.org/releases/linux/12.11.0.tar.gz
wget -q "https://sitejs.org/releases${releaseTypePath}linux/202005010942.tar.gz"
elif [[ "$cpuArchitecture" == "armv7l" || "$cpuArchitecture" == "armv6l" ]]; then
# Linux on ARM. Tested on Raspberry Pi Zero W (armv6l), 3B+ and 4B (both reporting armv7l).
wget -q https://sitejs.org/releases/linux-arm/12.11.0.tar.gz
wget -q "https://sitejs.org/releases${releaseTypePath}linux-arm/202005010942.tar.gz"
else
# Unsupported
echo "\n ❌ Error: this architecture is not supported on Linux (only x86_64, armv6l, and armv7l are).\n"
echo
echo " ❌ Error: this architecture is not supported on Linux (only x86_64, armv6l, and armv7l are)."
echo
cleanUp
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
curl -Os https://sitejs.org/releases/macos/12.11.0.tar.gz
curl -Os "https://sitejs.org/releases${releaseTypePath}macos/202005010942.tar.gz"
else
# Unsupported
echo "\n ❌ Error: this operating system is not supported.\n"
echo
echo " ❌ Error: this operating system is not supported."
echo
cleanUp
exit 1
fi
echo " 📦 Installing…"
gzip -d 12.11.0.tar.gz
tar -xf 12.11.0.tar
gzip -d 202005010942.tar.gz
tar -xf 202005010942.tar
# Ensure that the /usr/local/bin directory exists (it does not by default on macOS)
sudo mkdir -p /usr/local/bin/
......
################################################################################
#
# Site.js v12.11.0 Installer for Windows 10 (PowerShell)
# Site.js 202005010942/12.11.0 Installer for Windows 10 (PowerShell)
#
# To use:
#
# iex(iwr -UseBasicParsing https://sitejs.org/windows).Content
#
# Copyright (c) 2019 Aral Balkan.
# Copyright (c) 2019-2020 Aral Balkan.
# Released under the AGPL version 3.0 or later license.
# Made with <3 by Small Technology Foundation (https://small-tech.org)
# Like this? Fund us! (https://small-tech.org/fund-us)
......@@ -23,7 +23,7 @@ $installationScriptUrl = 'https://sitejs.org/install.txt'
$installationScriptFileName = 'install-site.js.ps1'
# The address to download the tar-gzipped archive of the Site.js binary from.
$archiveUrl = 'https://sitejs.org/releases/windows/12.11.0.tar.gz'
$archiveUrl = 'https://sitejs.org/releases/windows/202005010942.tar.gz'
# Emoji encodings (because Powershell is from the Stone Age and cannot handle
# emoji literals in strings)
......@@ -86,7 +86,7 @@ if (!([Security.Principal.WindowsPrincipal] `
# Installer is running with regular privileges. Start a new PowerShell session with elevated privileges.
#
Write-Output ''
Write-Output " $satelliteEmoji Downloading Site.js v12.11.0$ellipsis"
Write-Output " $satelliteEmoji Downloading Site.js 202005010942/12.11.0$ellipsis"
# We need to start a new PowerShell session with elevated privileges but if we're running in memory
# only after being downloaded by the installation command, we don't have a copy of ourselves to run.
......@@ -112,16 +112,16 @@ if (!([Security.Principal.WindowsPrincipal] `
Write-Output "`n`n`n`n`n`n"
Write-Output ' Installing Site.js using administrator privileges...'
Write-Output ''
Write-Output ' * Downloading Site.js v12.11.0...'
Write-Output ' * Downloading Site.js 202005010942/12.11.0...'
# Download the latest Site.js archive.
Invoke-WebRequest -Uri $archiveUrl -OutFile '12.11.0.tar.gz'
Invoke-WebRequest -Uri $archiveUrl -OutFile '202005010942.tar.gz'
Write-Output ''
Write-Output ' * Extracting binary...'
# Gunzip and untar the binary.
tar -xf 12.11.0.tar.gz
tar -xf 202005010942.tar.gz
Write-Output ''
Write-Output ' * Installing binary...'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment