This commit is contained in:
rickellis
2018-02-23 21:36:40 -07:00
parent 813d732c03
commit cbf66a4bb2
7 changed files with 185 additions and 127 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
# Archomatic
Automated Arch Linux Installation Script
Automated Arch Linux Post Installation Setup and Configuration
+36 -126
View File
@@ -10,14 +10,7 @@
VERSION="1.0.0"
#-----------------------------------------------------------------------------------
#
# Archomatic does the following:
#
# * Creates a 16 color palette image from the current wallpaper.
# * Extracts the hex color values of the palette.
# * Generates a .conkyrc file using colors randomly selected from the palette.
# * Exports a set of colorized weather icons.
# * Copies the new .conkyrc file to the home folder.
# * Relaunches the Conky application.
# Archomatic is an Arch Linux installation script
#
#-----------------------------------------------------------------------------------
# Author: Rick Ellis
@@ -25,130 +18,41 @@ VERSION="1.0.0"
# License: MIT
#-----------------------------------------------------------------------------------
# Array containing the files that will be executed by this script.
# IMPORTANT: The order that the items appear in the array is the
# order in which the execution happens.
declare -a install=( xorg desktop display-manager aur-helpers network bluetooth audio video sound printers sensors software-pacman software-aur extras setup personal )
# Name of the directory containing all the installer scripts
scriptdir="installers"
# This file is created automatically by Archomatic. As each installation
# script is executed, the name is added to the tracker file. This allows
# Archomatic to be aborted, and the next time it's run it will pick up
# where it left off.
tracker="tracker.txt"
# TEXT COLORS ----------------------------------------------------------------------
RED="\033[91m" # Red
GRN="\033[92m" # Green
BLU="\033[94m" # Blue
YEL="\033[93m" # Yellow
ORG="\033[38;5;202m" # Orange
MAG="\033[95m" # Magenta
CYN="\033[96m" # Cyan
RST="\033[0m" # Color Reset
# HEADING FUNCTION -----------------------------------------------------------------
# Generates heading with a background color and white text, centered.
function heading() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo 'Usage: heading <color> "My cool heading"'
exit 1
fi
color=${1}
color=${color,,} # Lowercase the color
text=${2}
length=74 # Overal length of heading
reset="\033[0m"
case "$color" in
black | blk)
color="\033[40m\033[97m" # Black with white text
;;
grey | gry)
color="\033[47m\033[100m" # Grey with white text
;;
red)
color="\033[41m\033[97m" # Red with white text
;;
darkred | dred)
color="\033[48;5;52m\033[97m" # Dark red with white text
;;
green | grn)
color="\033[42m\033[97m" # Green with white text
;;
blue | blu)
color="\033[44m\033[97m" # Blue with white text
;;
yellow | yel)
color="\033[42m\033[97m" # Yellow with white text
;;
orange | org)
color="\033[48;5;202m\033[97m" # OrNGE with white text
;;
olive | olv)
color="\033[48;5;58m\033[97m" # Yellow with white text
;;
magenta | mag)
color="\033[45m\033[97m" # Magenta with white text
;;
purple | pur)
color="\033[48;5;53m" # Purple with white text
;;
cyan | cyn)
color="\033[46m\033[97m" # Cyan with white text
;;
*)
color="\033[45m\033[97m" # Magenta with white text
;;
esac
# Get the lenghth of text string
# Divide 74 by the length.
# Divide it in half.
n=${#text}
l=$(( length - n ))
d=$(( l / 2 ))
declare padding
for i in $(seq 1 ${d}); do padding+=" "; done;
echo
echo -e "${color}${padding}${text}${padding}${reset}"
echo
}
# CONSENT --------------------------------------------------------------------------
function consent() {
unset CONSENT
msg="Hit ENTER to continue:"
if [ "$1" != "" ]; then
msg=${1}
fi
echo
read -p " ${msg} " CONSENT
echo
if ! [ -z "$CONSENT" ] && [ "$CONSENT" != 'y' ] && [ "$CONSENT" != 'Y' ]; then
echo "Goodbye..."
echo
exit 1
fi
}
# Source the functions script
. functions.sh
# MAIN HEADING ---------------------------------------------------------------------
clear
heading purple "Archomatic ${VERSION}"
consent "Ready to begin? [y|n] "
sheading purple "Archomatic ${VERSION}"
read -p "Ready to begin? [y|n] " CONSENT
if ! [ -z "$CONSENT" ] && [ "$CONSENT" != 'y' ] && [ "$CONSENT" != 'Y' ]; then
echo
echo "Goodbye..."
echo
exit 1
fi
# PRE-FLIGHT CHECKS ----------------------------------------------------------------
clear
heading green "PRE-FLIGHT CHECKS"
sheading green "PRE-FLIGHT CHECKS"
if [ ! -e "${tracker}}" ] ; then
@@ -166,36 +70,42 @@ for filename in "${install[@]}"
do
script="${scriptdir}/${filename}.sh"
if [ ! -f "$script" ]; then
echo -e " ${RED}FILE MISSING:${RST} ${YEL}${script}${RST}"
echo -e "${RED}FILE MISSING:${RST} ${YEL}${script}${RST}"
PASS="n"
continue
else
echo -e " ${GRN}FILE EXISTS:${RST} ${script}"
echo -e "${GRN}FILE EXISTS:${RST} ${script}"
fi
if [ ! -x "$script" ]; then
echo -e " ${RED}!EXECUTABLE:${RST} ${YEL}${script}${RST}"
echo -e "${RED}!EXECUTABLE:${RST} ${YEL}${script}${RST}"
PASS="n"
fi
done
if [ "$PASS" == 'n' ]; then
echo
echo -e " ${RED}EXECUTION ABORTED:${RST} Pre-flight checks failed."
echo -e "${RED}EXECUTION ABORTED:${RST} Pre-flight checks failed."
echo
exit 1
fi
echo
echo -e " ${GRN}All pre-flight tests passed!${RST}"
consent "Ready to continue? [y|n] "
echo -e "${GRN}All pre-flight tests passed!${RST}"
echo
read -p "Ready to continue? [y|n] " CONSENT
if ! [ -z "$CONSENT" ] && [ "$CONSENT" != 'y' ] && [ "$CONSENT" != 'Y' ]; then
echo
echo "Goodbye..."
echo
exit 1
fi
# INSTALLATION ---------------------------------------------------------------------
clear
heading green "Install"
sheading green "Install"
for filename in "${install[@]}"
do
@@ -206,14 +116,14 @@ do
continue
fi
read -p " INSTALL ${filename}? [y|n] " DOIT
echo -ne " ${GRN}INSTALL${RST} ${filename}? [y|n] "
read DOIT
if ! [ -z "$DOIT" ] && [ "$DOIT" != 'y' ] && [ "$DOIT" != 'Y' ]; then
continue
fi
sh "${scriptdir}/${filename}.sh"
echo "${filename}" >> "${tracker}"
done
+86
View File
@@ -1,8 +1,94 @@
#!/usr/bin/env bash
# TEXT COLORS ----------------------------------------------------------------------
RED="\033[91m" # Red
GRN="\033[92m" # Green
BLU="\033[94m" # Blue
YEL="\033[93m" # Yellow
ORG="\033[38;5;202m" # Orange
MAG="\033[95m" # Magenta
CYN="\033[96m" # Cyan
RST="\033[0m" # Color Reset
# HEADING FUNCTION -----------------------------------------------------------------
# Shell Heading Generator, from my script library
# https://github.com/rickellis/Shell-Scripts/blob/master/sheading.sh
function sheading() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo 'Usage: heading <color> "Heading Text"'
exit 1
fi
_color=${1,,} # lowercase
_heading=${2}
_h_length=${#_heading} # heading length
_t_width=$(tput cols) # terminal width
# Set the minimum width the length of the header string
if [ ! $_t_width -gt $_h_length ]; then
_t_width=$_h_length
fi
# Calculate the padding necessary on either side of the heading
l=$(( _t_width - _h_length ))
d=$(( l / 2 ))
_padding=""
for i in $(seq 1 ${d}); do
_padding+=" "
done
# Depending on the length of the terminal relative to the
# length of the heading we might end up one character off.
# To compensate we add one space to the right side
_padextra=""
_padlenth=${#_padding}
_totlenth=$(( _padlenth * 2 + _h_length ))
if [ $_t_width -ne $_totlenth ]; then
_padextra=" ";
fi
if [ "$_color" == 'rnd' ] || [ "$_color" == "rand" ] || [ "$_color" == "random" ]; then
_colors=( "gry" "chr" "red" "grn" "lim" "aqm" "olv" "blu" "sky" "cyn" "aqa" "gdr" "yel" "crl" "org" "pnk" "lav" "mag" "pur" )
_color=${_colors[$RANDOM % ${#_colors[@]}]}
fi
# White text \e[97m
# Black text: \e[38;5;232m
case "$_color" in
grey | gry) _color="\e[48;5;240m\e[97m" ;;
charcoal | chr) _color="\e[48;5;237m\e[97m" ;;
red) _color="\e[48;5;1m\e[97m" ;;
green | grn) _color="\e[48;5;22m\e[97m" ;;
lime | lim) _color="\e[48;5;40m\e[38;5;232m" ;;
aquamarine | aqm) _color="\e[48;5;120m\e[38;5;232m" ;;
olive | olv) _color="\e[48;5;58m\e[97m" ;;
blue | blu) _color="\e[44m\e[97m" ;;
sky) _color="\e[48;5;25m\e[97m" ;;
cyan | cyn) _color="\e[46m\e[97m" ;;
aqua | aqa) _color="\e[48;5;87m\e[38;5;232m" ;;
goldenrod | gdr) _color="\e[48;5;220m\e[38;5;232m" ;;
yellow | yel) _color="\e[48;5;11m\e[38;5;232m" ;;
coral| crl) _color="\e[48;5;3m\e[97m" ;;
orange | org) _color="\e[48;5;202m\e[97m" ;;
pink | pnk) _color="\e[48;5;200m\e[97m" ;;
lavender | lav) _color="\e[48;5;141m\e[38;5;232m" ;;
magenta | mag) _color="\e[45m\e[97m" ;;
purple | pur) _color="\e[48;5;53m\e[97m" ;;
*) _color="\e[48;5;237m\e[97m" ;;
esac
echo
echo -e "${_color}${_padding}${_heading}${_padding}${_padextra}\e[0m"
echo
}
# # How to get a function to return a value
# function sometest() {
# echo 0
View File
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
$ sudo nano /etc/pacman.conf
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
$ sudo pacman -Sy yaourt
OR MANUALLY:
sudo pacman -S base-devel yajl wget
mkdir -p ~/temp/AUR/
cd ~/temp/AUR/
# INSTALL package-query
wget https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz
tar xfz package-query.tar.gz
cd package-query
makepkg
sudo pacman -U package-query*.pkg.tar.xz
# INSTALL yaourt
wget https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz
tar xzf yaourt.tar.gz
cd yaourt
makepkg
sudo pacman -U yaourt*.pkg.tar.xz
+2
View File
@@ -200,6 +200,8 @@ gtk3
gtop
gufw
gutenprint
-------------------------------------------
guvcview
gvfs
gvfs-afc
+16
View File
@@ -0,0 +1,16 @@
xorg
desktop
display-manager
aur-helpers
network
bluetooth
audio
video
sound
printers
sensors
software-pacman
software-aur
extras
setup
personal