blob: 02d84343203c493340caa0c383ed7ab5f9f44a29 (
plain)
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
|
#!/bin/sh
DEFAULT_KEYS="davidovski https://xi.davidovski.xyz/keychain/xi.pub"
create_directories () {
mkdir -p ${SYSROOT}
mkdir -p ${SYSROOT}/dev
mkdir -p ${SYSROOT}/tmp
mkdir -p ${SYSROOT}/sys
mkdir -p ${SYSROOT}/run
mkdir -p ${SYSROOT}/proc
mkdir -p ${SYSROOT}/usr
mkdir -p ${SYSROOT}/root
mkdir -p ${SYSROOT}/usr/bin
mkdir -p ${SYSROOT}/usr/lib
ln -s usr/bin ${SYSROOT}/bin
ln -s usr/bin ${SYSROOT}/sbin
ln -s bin ${SYSROOT}/usr/sbin
ln -s usr/lib ${SYSROOT}/lib
ln -s usr/lib ${SYSROOT}/lib64
ln -s usr/lib ${SYSROOT}/usr/lib64
ln -s usr ${SYSROOT}/usr/local
chmod 0755 ${SYSROOT}/dev
chmod 1777 ${SYSROOT}/tmp
chmod 0555 ${SYSROOT}/sys
chmod 0555 ${SYSROOT}/proc
chmod 0755 ${SYSROOT}/run
chmod 0755 ${SYSROOT}/usr
chmod 0750 ${SYSROOT}/root
chmod 0755 ${SYSROOT}/usr/bin
chmod 0755 ${SYSROOT}/usr/lib
}
import_keys () {
# import all keys
set -o noglob
if [ -d ${KEYCHAIN_DIR} ] && [ "$(ls ${KEYCHAIN_DIR} | wc -w)" != "0" ]; then
keyimport *
else
keyimport $DEFAULT_KEYS
fi
}
bootstrap () {
if [ "${SYSROOT}" = "/" ]; then
printf "${RED}Error! Cannot bootstrap on existing system! Use ${LIGHT_RED}--root${RED} to specify new root filesystem\n"
return 1
fi
if [ -e ${SYSROOT} ] && [ "$(ls -1 ${SYSROOT})" != "0" ]; then
if prompt_question "${WHITE}System already exists on ${SYSROOT}, clear?"; then
rm -rf ${SYSROOT}/*
fi
fi
printf "${BLUE}Creating directories..."
create_directories
printf "${GREEN}${CHECKMARK}\n"
${DO_SYNC} && sync
[ "$#" != "0" ] && install $@
import_keys
}
|