-
-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lxc: fix auto repair in systemd script
- Loading branch information
Showing
7 changed files
with
32 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../install/proxmox/docker-compose.sh |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,35 @@ | ||
import fs from 'fs'; | ||
import sdk from '@scrypted/sdk'; | ||
|
||
export const SCRYPTED_INSTALL_ENVIRONMENT_LXC = 'lxc'; | ||
export const SCRYPTED_INSTALL_ENVIRONMENT_LXC_DOCKER = 'lxc-docker'; | ||
|
||
export async function checkLegacyLxc() { | ||
if (process.env.SCRYPTED_INSTALL_ENVIRONMENT !== SCRYPTED_INSTALL_ENVIRONMENT_LXC) | ||
return; | ||
|
||
sdk.log.a('This system is currently running the legacy LXC installation method and must be migrated to the new LXC manually: https://docs.scrypted.app/installation.html#proxmox-ve-container-reset'); | ||
} | ||
|
||
const DOCKER_COMPOSE_SH_PATH = '/root/.scrypted/docker-compose.sh'; | ||
const LXC_DOCKER_COMPOSE_SH_PATH = 'lxc/docker-compose.sh'; | ||
|
||
export async function checkLxc() { | ||
if (process.env.SCRYPTED_INSTALL_ENVIRONMENT !== SCRYPTED_INSTALL_ENVIRONMENT_LXC_DOCKER) | ||
return; | ||
|
||
const foundDockerComposeSh = await fs.promises.readFile(DOCKER_COMPOSE_SH_PATH, 'utf8'); | ||
const dockerComposeSh = await fs.promises.readFile(LXC_DOCKER_COMPOSE_SH_PATH, 'utf8'); | ||
|
||
if (foundDockerComposeSh === dockerComposeSh) { | ||
// check if the file is executable | ||
const stats = await fs.promises.stat(DOCKER_COMPOSE_SH_PATH); | ||
if (stats.mode & 0o111) | ||
return; | ||
await fs.promises.chmod(DOCKER_COMPOSE_SH_PATH, 0o755); | ||
return; | ||
} | ||
|
||
await fs.promises.copyFile(LXC_DOCKER_COMPOSE_SH_PATH, DOCKER_COMPOSE_SH_PATH); | ||
await fs.promises.chmod(DOCKER_COMPOSE_SH_PATH, 0o755); | ||
} |