aboutsummaryrefslogtreecommitdiff
path: root/mkarmtix
blob: 540db49bde0b8520afb74c017f00a155810d8e22 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#! /bin/bash

set -e

function get_cmdline {
	sed -r 's/[[:alnum:]]+=/\n&/g' /proc/cmdline | awk -F= "\$1==\"$1\"{print \$2}" | sed 's/.\{1\}$//'
}

# cmdline options
TIMEZONE=$(get_cmdline tz)
KEYMAP=$(get_cmdline keytable)

pacman -Syu --noconfirm

rc-service ntpd start

ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime

sed -i "s/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" /etc/locale.gen
locale-gen

cat <<EOT > /etc/locale.conf
export LANG="en_US.UTF-8"
export LC_COLLATE="C"
EOT

sed -i "s/keymap=\"us\"/keymap=\"${KEYMAP}\"/" /etc/conf.d/keymaps

pacman -Sy --needed --noconfirm btrfs-progs

# Network
## Hostname
echo armtix > /etc/hostname

cat <<EOT > /etc/hosts
# Static table lookup for hostnames.
# See hosts(5) for details.

127.0.0.1	localhost
127.0.1.1	armtix.local armtix

# IPv6
::1		localhost	ip6-localhost	ip6-loopback
ff02::1	ip6-allnodes
ff02::2	ip6-allrouters
EOT

sed -i 's/hostname="localhost"/hostname="armtix"/' /etc/conf.d/hostname

## Networking essentials
pacman -Sy --needed --noconfirm dhcpcd wpa_supplicant

# Repositories
## Arch
pacman -Sy --needed --noconfirm artix-archlinux-support

cat <<EOT >> /etc/pacman.conf

#
# Custom
#

# Arch

#[testing]
#Include = /etc/pacman.d/mirrorlist-archlinuxarm

[extra]
Include = /etc/pacman.d/mirrorlist-archlinuxarm

#[community-testing]
#Include = /etc/pacman.d/mirrorlist-archlinuxarm

[community]
Include = /etc/pacman.d/mirrorlist-archlinuxarm

#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist-archlinuxarm

#[multilib]
#Include = /etc/pacman.d/mirrorlist-archlinuxarm

[alarm]
Include = /etc/pacman.d/mirrorlist-archlinuxarm
EOT

pacman-key --init
pacman-key --populate archlinuxarm
pacman -Sy

hwclock --systohc

pacman -Sy --needed --noconfirm --dbonly raspberrypi-bootloader raspberrypi-firmware

rc-update add ntpd default

#
# Configuration
#

echo -en 'armtix\narmtix' | passwd
userdel -r armtix

pacman -Rns --noconfirm sudo

rc-update del dhcpcd default
pacman -R --noconfirm dhcpcd-openrc

echo -e "\n\e[1m\e[1;32mArmtix has been successfully configured! It is NOT safe to reboot."
echo -e "\e[1m\e[1;32mDon't forget to change the root password and hostname, and to add a regular user for SSH."
echo -e "\e[1m\e[1;32mSetting up networking is left to you, dhcpcd and wpa_supplicant are installed."
echo -e "\e[1m\e[1;32mRebooting now will cause the device to become inaccessible due to disallowed SSH root login and the lack of network configuration."
echo -en "\e[0m"