Commit 6669bf3e authored by picodotdev's avatar picodotdev

Use asciinema for record install and log

Fixes #22
parent 9a4207be
......@@ -36,6 +36,7 @@ Currently these scripts are for me but maybe they are useful for you too.
* Graphics controllers (intel, nvidia, amd) with early KMS start
* GRUB, rEFInd, systemd-boot bootloaders
* Script for download installation and recovery scripts and configuration files
* Installation log with all commands executed and output in a file and/or asciinema video
* Wait after installation for a abortable reboot
### Installation
......@@ -46,6 +47,8 @@ Currently these scripts are for me but maybe they are useful for you too.
# curl https://raw.githubusercontent.com/picodotdev/alis/master/download.sh | bash, or with URL shortener curl -sL https://bit.ly/2F3CATp | bash
# # Edit alis.conf and change variables values with your preferences
# vim alis.conf
# # Optional asciinema video
# ./alis-asciinema.sh
# ./alis.sh
```
......@@ -57,6 +60,8 @@ Currently these scripts are for me but maybe they are useful for you too.
# curl https://raw.githubusercontent.com/picodotdev/alis/master/download.sh | bash, or with URL shortener curl -sL https://bit.ly/2F3CATp | bash
# # Edit alis-recovery.conf and change variables values with your last installation with alis
# vim alis-recovery.conf
# # Optional asciinema video
# ./alis-asciinema-recovery.sh
# ./alis-recovery.sh
```
......
#!/usr/bin/env bash
set -e
# Arch Linux Install Script (alis) installs unattended, automated
# and customized Arch Linux system.
# Copyright (C) 2018 picodotdev
wget https://github.com/asciinema/asciinema/archive/v2.0.1.zip -O asciinema-2.0.1.zip
bsdtar -x -f asciinema-2.0.1.zip
cp -r asciinema-2.0.1/* .
rm -f alis.asciinema
python3 -m asciinema rec -i 5 ~/alis.asciinema
\ No newline at end of file
#!/usr/bin/env bash
set -e
# Arch Linux Install Script (alis) installs unattended, automated
# and customized Arch Linux system.
# Copyright (C) 2018 picodotdev
source alis.conf
if [ -f alis.asciinema ]; then
mkdir -p /mnt/var/log
cp alis.asciinema /mnt/var/log/alis.asciinema
fi
umount -R /mnt
reboot
\ No newline at end of file
#!/usr/bin/env bash
set -e
# Arch Linux Install Script (alis) installs unattended, automated
# and customized Arch Linux system.
# Copyright (C) 2018 picodotdev
wget https://github.com/asciinema/asciinema/archive/v2.0.1.zip -O asciinema-2.0.1.zip
bsdtar -x -f asciinema-2.0.1.zip
cp -r asciinema-2.0.1/* .
rm -f alis.asciinema
python3 -m asciinema rec -i 5 ~/alis-recovery.asciinema
\ No newline at end of file
#!/usr/bin/env bash
set -e
# Arch Linux Install Script (alis) installs unattended, automated
# and customized Arch Linux system.
# Copyright (C) 2018 picodotdev
source alis.conf
if [ -f alis-recovery.asciinema ]; then
mkdir -p /mnt/var/log
cp alis-recovery.asciinema /mnt/var/log/alis-recovery.asciinema
fi
umount -R /mnt
reboot
\ No newline at end of file
......@@ -40,7 +40,7 @@ set -e
# Usage:
# # loadkeys es
# # curl https://raw.githubusercontent.com/picodotdev/alis/master/download.sh | bash, or with URL shortener curl -sL https://bit.ly/2F3CATp | bash
# # vim alis.conf
# # vim alis-recovery.conf
# # ./alis-recovery.sh
# global variables (no configuration, don't edit)
......@@ -69,7 +69,6 @@ ADDITIONAL_USER_NAMES_ARRAY=()
ADDITIONAL_USER_PASSWORDS_ARRAY=()
MODULES=""
LOG="alis-recovery.log"
RED='\033[0;31m'
GREEN='\033[0;32m'
LIGHT_BLUE='\033[1;34m'
......@@ -145,16 +144,9 @@ function warning() {
}
function init() {
init_log
loadkeys $KEYS
}
function init_log() {
exec > >(tee -a $LOG)
exec 2> >(tee -a $LOG >&2)
set -o xtrace
}
function facts() {
if [ -d /sys/firmware/efi ]; then
BIOS_TYPE="uefi"
......
......@@ -40,6 +40,7 @@ set -e
# # ./alis.sh
# global variables (no configuration, don't edit)
ASCIINEMA=""
BIOS_TYPE=""
PARTITION_BIOS=""
PARTITION_BOOT=""
......@@ -179,6 +180,12 @@ function facts() {
BIOS_TYPE="bios"
fi
if [ -f alis.asciinema ]; then
ASCIINEMA="true"
else
ASCIINEMA="false"
fi
if [ -n "$(hdparm -I $DEVICE | grep TRIM)" ]; then
DEVICE_TRIM="true"
else
......@@ -838,32 +845,42 @@ function end() {
echo ""
REBOOT="true"
if [ "$LOG" == "false" ]; then
if [ "$ASCIINEMA" == "false" ]; then
set +e
for (( i = 15; i >= 1; i-- )); do
read -r -s -n 1 -t 1 -p "Rebooting in $i seconds... Press any key to abort."$'\n' KEY
if [ $? -eq 0 ]; then
echo ""
echo "Restart aborted. You will must do a explicit reboot (./alis-reboot.sh)."
echo ""
REBOOT="false"
break
fi
done
set -e
else
echo ""
echo "Restart aborted. You will must terminate asciinema recording and do a explicit reboot (exit, ./alis-reboot.sh)."
echo ""
REBOOT="false"
fi
if [ "$REBOOT" == 'true' ]; then
umount -R /mnt
reboot
fi
else
echo ""
echo -e "${GREEN}Arch Linux installed successfully"'!'"${NC}"
if [ "$ASCIINEMA" == "false" ]; then
echo ""
echo "You will must do a explicit reboot (./alis-reboot.sh)."
echo ""
else
echo ""
echo "Restart aborted. You will must do a explicit reboot (umount -R /mnt, reboot)."
echo "You will must terminate asciinema recording and do a explicit reboot (exit, ./alis-reboot.sh)."
echo ""
fi
else
echo ""
echo -e "${GREEN}Arch Linux installed successfully"'!'"${NC}"
echo ""
echo "You will must do a explicit reboot (umount -R /mnt, reboot)."
echo ""
fi
}
......
#!/usr/bin/env bash
set -e
# Arch Linux Install Script Download (alis-download) downloads scripts.
# Arch Linux Install Script (alis) installs unattended, automated
# and customized Arch Linux system.
# Copyright (C) 2018 picodotdev
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This script is hosted at https://github.com/picodotdev/alis. For new features,
# improvements and bugs fill an issue in GitHub or make a pull request.
# Pull Request are welcome!
#
# If you test it in real hardware please send me an email to pico.dev@gmail.com with
# the machine description and tell me if somethig goes wrong or all works fine.
#
# Please, don't ask for support for this script in Arch Linux forums, first read
# the Arch Linux wiki [1], the Installation Guide [2] and the General
# Recomendations [3], later compare the commands with those of this script.
#
# [1] https://wiki.archlinux.org
# [2] https://wiki.archlinux.org/index.php/Installation_guide
# [3] https://wiki.archlinux.org/index.php/General_recommendations
# Usage:
# # loadkeys es
# # curl https://raw.githubusercontent.com/picodotdev/alis/master/download.sh | bash
# # # see alis.sh or alis-recovery.sh usage
rm -f alis.conf
rm -f alis.sh
rm -f alis-asciinema.sh
rm -f alis-reboot.sh
rm -f alis-recovery.conf
rm -f alis-recovery.sh
wget https://raw.githubusercontent.com/picodotdev/alis/master/alis.conf
wget https://raw.githubusercontent.com/picodotdev/alis/master/alis.sh
wget https://raw.githubusercontent.com/picodotdev/alis/master/alis-recovery.conf
wget https://raw.githubusercontent.com/picodotdev/alis/master/alis-recovery.sh
rm -f alis-recovery-asciinema.sh
rm -f alis-recovery-reboot.sh
wget https://raw.githubusercontent.com/picodotdev/alis/sid/alis.conf
wget https://raw.githubusercontent.com/picodotdev/alis/sid/alis.sh
wget https://raw.githubusercontent.com/picodotdev/alis/sid/alis-asciinema.sh
wget https://raw.githubusercontent.com/picodotdev/alis/sid/alis-reboot.sh
wget https://raw.githubusercontent.com/picodotdev/alis/sid/alis-recovery.conf
wget https://raw.githubusercontent.com/picodotdev/alis/sid/alis-recovery.sh
wget https://raw.githubusercontent.com/picodotdev/alis/sid/alis-recovery-asciinema.sh
wget https://raw.githubusercontent.com/picodotdev/alis/sid/alis-recovery-reboot.sh
chmod +x alis.sh
chmod +x alis-recovery.sh
\ No newline at end of file
chmod +x alis-asciinema.sh
chmod +x alis-reboot.sh
chmod +x alis-recovery.sh
chmod +x alis-recovery-asciinema.sh
chmod +x alis-recovery-reboot.sh
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