forked from hanwckf/build-imou-sn1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-archlinux.sh
executable file
·50 lines (40 loc) · 1.4 KB
/
build-archlinux.sh
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
#!/bin/bash
# run following command to init pacman keyring:
# pacman-key --init
# pacman-key --populate archlinuxarm
[ "$EUID" != "0" ] && echo "please run as root" && exit 1
os="archlinux"
rootsize=1400
origin="latest"
source cfg.inc
chroot_prepare() {
rm -rf $rootfs_mount_point/etc/resolv.conf
if [ -z "$TRAVIS" ]; then
echo 'Server = https://mirrors.163.com/archlinuxarm/$arch/$repo' > $rootfs_mount_point/etc/pacman.d/mirrorlist
echo "nameserver 119.29.29.29" > $rootfs_mount_point/etc/resolv.conf
else
echo "nameserver 8.8.8.8" > $rootfs_mount_point/etc/resolv.conf
fi
}
ext_init_param() {
:
}
chroot_post() {
ln -sf /run/systemd/resolve/resolv.conf $rootfs_mount_point/etc/resolv.conf
if [ -n "$TRAVIS" ]; then
echo 'Server = https://mirrors.163.com/archlinuxarm/$arch/$repo' > $rootfs_mount_point/etc/pacman.d/mirrorlist
fi
}
add_services() {
echo "add resize mmc script"
cp ./tools/systemd/resizemmc.service $rootfs_mount_point/lib/systemd/system/
cp ./tools/systemd/resizemmc.sh $rootfs_mount_point/sbin/
mkdir -p $rootfs_mount_point/etc/systemd/system/basic.target.wants
ln -sf /lib/systemd/system/resizemmc.service $rootfs_mount_point/etc/systemd/system/basic.target.wants/resizemmc.service
touch $rootfs_mount_point/root/.need_resize
}
gen_new_name() {
local rootfs=$1
echo "`basename $rootfs | sed "s/${origin}/${device_name}-$(date +%Y-%m-%d)/" | sed 's/.tar.gz$//'`"
}
source ./common.sh