Commit c2d38b9c authored by Aral Balkan's avatar Aral Balkan
Browse files

Ensure settings directory is created with regular permissions

(When running the enable command.)
parent 78e4b1b0
......@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [16.3.2] - 2021-04-14
### Fixed
- Ensure that settings directory is always created with regular permissions.
## [16.3.1] - 2021-04-14
### Fixed
......
......@@ -66,6 +66,9 @@ function enable (args) {
console.log(`\n ❌ ${clr('❨site.js❩ Error:', 'red')} Cannot start daemon. Port 443 is already in use.\n`)
process.exit(1)
} else {
// Ensure the settings directory exists (and is created with regular permissions).
fs.ensureDirSync(Site.settingsDirectory)
// Ensure we are root (we do this here instead of before the asynchronous call to
// avoid any timing-related issues around a restart and a port-in-use error).
ensure.root()
......@@ -257,7 +260,6 @@ function enable (args) {
const internalOwncastInstallationScriptPath = path.resolve(path.join(__dirname, '..', 'sh', 'install-owncast.sh'))
const installationScript = fs.readFileSync(internalOwncastInstallationScriptPath, 'utf-8')
const externalOwncastInstallationScriptPath = path.join(Site.settingsDirectory, 'install-owncast.sh')
fs.ensureDirSync(Site.settingsDirectory)
fs.writeFileSync(externalOwncastInstallationScriptPath, installationScript, {encoding: 'utf-8', mode: 0o755})
childProcess.execSync(`OWNCAST_INSTALL_DIRECTORY=${owncastDirectory} ${externalOwncastInstallationScriptPath}`, {env: process.env, stdio: 'pipe'})
console.log(` 💮️ ❨site.js❩ Owncast installed at ${owncastDirectory}.`)
......
{
"name": "@small-tech/site.js",
"version": "16.3.1",
"version": "16.3.2",
"description": "Small Web construction set.",
"keywords": [
"web server",
......
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