@scarn/cli 0.0.0-stage → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License. See License.txt in the project root for license information.
3
+ ARG BASE_IMAGE
4
+ FROM $BASE_IMAGE
5
+
6
+ USER root
7
+
8
+ ARG REMOTE_USER
9
+ ARG NEW_UID
10
+ ARG NEW_GID
11
+ SHELL ["/bin/sh", "-c"]
12
+ RUN eval $(sed -n "s/${REMOTE_USER}:[^:]*:\([^:]*\):\([^:]*\):[^:]*:\([^:]*\).*/OLD_UID=\1;OLD_GID=\2;HOME_FOLDER=\3/p" /etc/passwd); \
13
+ eval $(sed -n "s/\([^:]*\):[^:]*:${NEW_UID}:.*/EXISTING_USER=\1/p" /etc/passwd); \
14
+ eval $(sed -n "s/\([^:]*\):[^:]*:${NEW_GID}:.*/EXISTING_GROUP=\1/p" /etc/group); \
15
+ if [ -z "$OLD_UID" ]; then \
16
+ echo "Remote user not found in /etc/passwd ($REMOTE_USER)."; \
17
+ elif [ "$OLD_UID" = "$NEW_UID" -a "$OLD_GID" = "$NEW_GID" ]; then \
18
+ echo "UIDs and GIDs are the same ($NEW_UID:$NEW_GID)."; \
19
+ elif [ "$OLD_UID" != "$NEW_UID" -a -n "$EXISTING_USER" ]; then \
20
+ echo "User with UID exists ($EXISTING_USER=$NEW_UID)."; \
21
+ else \
22
+ if [ "$OLD_GID" != "$NEW_GID" -a -n "$EXISTING_GROUP" ]; then \
23
+ echo "Group with GID exists ($EXISTING_GROUP=$NEW_GID)."; \
24
+ NEW_GID="$OLD_GID"; \
25
+ fi; \
26
+ echo "Updating UID:GID from $OLD_UID:$OLD_GID to $NEW_UID:$NEW_GID."; \
27
+ sed -i -e "s/\(${REMOTE_USER}:[^:]*:\)[^:]*:[^:]*/\1${NEW_UID}:${NEW_GID}/" /etc/passwd; \
28
+ if [ "$OLD_GID" != "$NEW_GID" ]; then \
29
+ sed -i -e "s/\([^:]*:[^:]*:\)${OLD_GID}:/\1${NEW_GID}:/" /etc/group; \
30
+ fi; \
31
+ chown -R $NEW_UID:$NEW_GID $HOME_FOLDER; \
32
+ fi;
33
+
34
+ ARG IMAGE_USER
35
+ USER $IMAGE_USER
package/package.json CHANGED
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "name": "@scarn/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.8.0",
4
+ "bin": {
5
+ "scarn": "bin/scarn"
6
+ },
7
+ "scripts": {
8
+ "postinstall": "node bin/postinstall.js"
9
+ },
10
+ "files": [
11
+ "README.md",
12
+ "bin",
13
+ "dist"
14
+ ],
15
+ "dependencies": {
16
+ "pino": "^9.14.0",
17
+ "pino-pretty": "^13.1.2"
18
+ },
19
+ "optionalDependencies": {
20
+ "@scarn/cli-darwin-arm64": "0.8.0",
21
+ "@scarn/cli-darwin-x64": "0.8.0",
22
+ "@scarn/cli-linux-x64": "0.8.0",
23
+ "@scarn/cli-linux-arm64": "0.8.0",
24
+ "@scarn/cli-win32-x64": "0.8.0"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/scarn-io/scarn"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ }
33
+ }