Commit be945f4c authored by Cássio Kirch's avatar Cássio Kirch

First commit

parents
#!/bin/bash
# Copyright (c) 2018 Cássio Kirch <cassio.kirch@inf.ufrgs.br>
# LICENSE: GPL-3.0
readonly MNT=/mnt
readonly ROOTDEV=/dev/sdd1
# Install debootstrap:
## sed -i 's/deb.debian.org/debian.c3sl.ufpr.br/g' /etc/apt/sources.list
apt update
apt install debootstrap -y
# Mount flash drive
mkdir $MNT -p
mount $ROOTDEV $MNT
# Install packages:
debootstrap --include linux-image-amd64,grub-pc,locales,bash-completion,emacs25-nox,ncdu,htop --arch amd64 stretch $MNT http://debian.c3sl.ufpr.br/debian
# Prepare to change root:
cp /etc/mtab $MNT/etc/mtab
mount -o bind /dev $MNT/dev
mount -o bind /proc $MNT/proc
mount -o bind /sys $MNT/sys
# Configure grub
chroot $MNT grub-install /dev/sdd
chroot $MNT update-grub
# Configure fstab
uuid=$(blkid $ROOTDEV | awk '{for (c=1; c<=NF; c=c+1) { print $c }}' | grep ^UUID | sed 's/"//g')
fs=$(blkid $ROOTDEV | awk '{for (c=1; c<=NF; c=c+1) { print $c }}' | grep ^TYPE | sed 's/"//g' | awk -F'=' '{print $2}')
echo $uuid / $fs defaults 0 1 > $MNT/etc/fstab
# Set hostname:
echo tropos > $MNT/etc/hostname
# Change language:
sed -i 's/# pt_BR.UTF-8 UTF-8/pt_BR.UTF-8 UTF-8/g' $MNT/etc/locale.gen
chroot $MNT dpkg-reconfigure locales -f noninteractive
#chroot $MNT passwd
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment