Skip to content

Commit cce63d4

Browse files
committed
feat: add arch-init.sh script
1 parent e653f94 commit cce63d4

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
![Docker Image Size (alpine-node-aws-dev)](https://img.shields.io/docker/image-size/namesmt/linux-stuff/alpine-node-aws-dev?label=image%20size%3Anode-aws-dev)
55

66
### Features:
7+
78
- Latest Node LTS & pnpm (**node** tag)
89
- [@antfu/ni](https://github.com/antfu/ni)
910
- Self-built latest aws-cli v2 (**aws** tag)
@@ -42,6 +43,7 @@ docker run -it --rm namesmt/linux-stuff:node-dev_pnpm8.10.5
4243
#### Alpine:
4344

4445
##### `alpine-node-dev` dev environment setup:
46+
4547
*(Tips: Follow [Yuka](https://github.com/yuk7/AlpineWSL)'s instruction to install Alpine WSL2)*
4648

4749
Run `alpine-node-dev` script: *([`fnm`](https://github.com/Schniz/fnm) included to manage node version)*
@@ -50,18 +52,21 @@ wget https://raw.githubusercontent.com/NamesMT/linux-stuff/main/alpine/alpine-no
5052
```
5153

5254
##### Install [fnm](https://github.com/Schniz/fnm) - Fast Node Manager, similar to `nvm`
55+
5356
```sh
5457
wget https://raw.githubusercontent.com/NamesMT/linux-stuff/main/alpine/scripts/install-fnm.sh -O- | sh
5558
```
5659

5760
##### Install Docker
61+
5862
```sh
5963
wget https://raw.githubusercontent.com/NamesMT/linux-stuff/main/alpine/scripts/install-docker.sh -O- | sh
6064
```
6165
You can call `sh ~/alpine.docker.service.sh` to start the docker service,
6266
And call `sh ~/alpine.docker.service.sh stop` to stop the docker service.
6367

6468
##### Install [sgerrand/alpine-pkg-glibc](https://github.com/sgerrand/alpine-pkg-glibc)
69+
6570
This package will help you in cases where an app requires glibc and `gcompat` doesn't work, like `Miniconda`, glibc `bun`.
6671
```sh
6772
wget https://raw.githubusercontent.com/NamesMT/linux-stuff/main/scripts/install-glibc.sh -O- | sh
@@ -70,14 +75,23 @@ wget https://raw.githubusercontent.com/NamesMT/linux-stuff/main/scripts/install-
7075
#### Ubuntu:
7176

7277
##### `ubuntu-node-dev` dev environment setup:
78+
7379
Run `ubuntu-node-dev` script: *([`fnm`](https://github.com/Schniz/fnm) included to manage node version)*
7480
```sh
7581
wget https://raw.githubusercontent.com/NamesMT/linux-stuff/main/ubuntu/ubuntu-node-dev.sh -O- | bash
7682
```
7783

7884
#### Arch:
7985

86+
##### `arch-init` Arch initialization script:
87+
88+
This script will help you do some initial setup for an Arch Linux installation, like: updating databases (key, packages), updating all packages, create a new user.
89+
```sh
90+
export NEW_USER=yourname && curl -fsSL https://raw.githubusercontent.com/NamesMT/linux-stuff/main/arch/arch-init.sh | bash
91+
```
92+
8093
##### `arch-node-dev` dev environment setup:
94+
8195
Run `arch-node-dev` script: *([`fnm`](https://github.com/Schniz/fnm) included to manage node version)*
8296
```sh
8397
curl -fsSL https://raw.githubusercontent.com/NamesMT/linux-stuff/main/arch/arch-node-dev.sh | bash
@@ -86,6 +100,7 @@ curl -fsSL https://raw.githubusercontent.com/NamesMT/linux-stuff/main/arch/arch-
86100
---
87101

88102
### Build:
103+
89104
```sh
90105
export imageName=namesmt/linux-stuff
91106
export imageTag= # node | node-dev | node-aws ...
@@ -94,7 +109,9 @@ docker push "${imageName}:${imageTag}"
94109
```
95110

96111
## Roadmap
112+
97113
- [x] Github Actions to automate build
98114

99115
## Credits:
116+
100117
- [theidledeveloper/aws-cli-alpine](https://github.com/theidledeveloper/aws-cli-alpine): most of starting points

arch/arch-init.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [ -z "$NEW_USER" ]; then echo "\$NEW_USER is not set" exit 1; fi
6+
7+
## Whats this?
8+
## Script to initialize a new Arch Linux installation: init & update databases, packages, create new user.
9+
## CAUTION: this script will allow passwordless sudo for users.
10+
11+
# Update package database, keychain, and trust database
12+
pacman-key --init
13+
pacman-key --populate archlinux
14+
pacman -Syu archlinux-keyring sudo --noconfirm
15+
16+
# Create user
17+
useradd -m -G wheel -s /bin/bash $NEW_USER
18+
sed -i 's/# %wheel ALL=(ALL:ALL)/%wheel ALL=(ALL:ALL)/g' /etc/sudoers
19+
20+
# WSL goodie: sets the new user as default user
21+
if [ -f "/etc/wsl.conf" ]; then
22+
echo "[user]" | tee -a /etc/wsl.conf
23+
echo "default=$NEW_USER" | tee -a /etc/wsl.conf
24+
fi
25+
26+
echo "Please run \"su - $NEW_USER\" to ensure logged in as the newly created user"

0 commit comments

Comments
 (0)