blob: ea15c8793255fb60c9902819f0ad88de640403da (
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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
#!/bin/bash
# Name: parautinst
# Description: Parabola automated installer
# Author: Esteban V. Carnevale - alfplayer@mailoo.org
# Binary configuration switches are set like this
# 1 to enable
# 0 to disable
# sshfs remote cache directory location
#cache_sshfs='USER@HOST:CACHEDIR'
# Chroot directory
#chrootdir=/tmp/chroot
chrootdir="/mnt"
# HTTP proxy
#http_proxy=http://HOST:PORT/
# Create partition and mount? (binary)
partitioning_and_mount=1
# Pacman needs to be updated before installing Parabola? (binary)
pacman_needs_upgrade=0
# parabola-keyring needs to be updated before installing Parabola? (binary)
parabola_keyring_needs_upgrade=0
# Set a Parabola mirror
#mirror='http://repo.parabola.nu/$repo/os/$arch'
# Hostname
hostname="parabola"
# Time zone
timezone="/usr/share/zoneinfo/America/Buenos_Aires"
# Locale
locale="en_US.UTF-8 UTF-8"
# Keymap
keymap="es"
# Install virtio initramfs modules? (binary)
virtio=0
red='\e[31m' # Red
cyan_bg='\e[46m' # Cyan background
txtrst='\e[0m' # Text Reset
info() { echo -e ${cyan_bg}PARAUTINST:${txtrst} "$@" ; }
error() { echo -e ${cyan_bg}PARAUTINST error:${txtrst} "$@" 1>&2 ; exit 1 ; }
[[ "$@" ]] || error "Usage: parautinst [partition]\nExample: parautinst sda1\nWARNING! All data on the specified partition will be lost."
info "${red}WARNING! All data on the partition $1 will be lost.${txtrst}\n\nPress any key to continue, or Ctrl-C to cancel."
read -n1
echo
part="$1"
hdd=${part%?}
export red cyan_bg txtrst info error part hdd chrootdir hostname timezone locale keymap virtio
export -f info error
[[ ! -e ${chrootdir} ]] && mkdir "${chrootdir}"
[[ ${mirror} ]] && echo "Server = ${mirror}" > /etc/pacman.d/mirrorlist
pacmancmd='pacman --cachedir /tmp -Sy --noconfirm --needed'
(( ${partitioning_and_mount} )) & {
info "Unmounting ${part}"
umount /dev/${part}
info "Partitioning ${hdd}"
parted /dev/${hdd} -s "mklabel msdos"
parted /dev/${hdd} -s "mkpart primary ext4 1MiB -1s"
info "Creating filesystem on ${part}"
mkfs.ext4 /dev/${part}
info "Mounting ${part} on ${chrootdir}"
mount /dev/${part} "${chrootdir}"
}
(( ${pacman_needs_upgrade} )) && {
info "Updating pacman database"
pacman -Sy
info "Updating pacman"
${pacmancmd} pacman
}
[[ ${cache_sshfs} ]] && {
info "Installing sshfs"
${pacmancmd} sshfs
info "Mounting package cache over sshfs"
if grep -s '\s/var/cache/pacman/pkg\s' /etc/mtab ; then
info "Package cache already mounted"
else
mount -t fuse.sshfs -o noauto,user,idmap=user,comment=x-systemd.automount,allow_other,StrictHostKeyChecking=no "${cache_sshfs}" /var/cache/pacman/pkg || error "Error mounting the package cache using sshfs"
fi
}
(( ${parabola_keyring_needs_upgrade} )) && {
info "Installing parabola-keyring"
${pacmancmd} parabola-keyring
}
info "Running parautinst and installing base group and grub"
pacstrap -c "${chrootdir}" base grub
#cp /etc/libretools.conf /etc/makepkg.conf ${chrootdir}/etc
info "Running genfstab"
genfstab -p "${chrootdir}" >> "${chrootdir}"/etc/fstab
cp parautinst-chroot "${chrootdir}"/parautinst-chroot
#chmod +x ${chrootdir}/parautinst-chroot
arch-chroot "${chrootdir}" /bin/bash parautinst-chroot
rm "${chrootdir}"/parautinst-chroot
|