mirror of
https://github.com/hak8or/proxmox_scripts.git
synced 2025-12-08 23:18:06 +00:00
Pretty much working scripts!
This commit is contained in:
@@ -1,23 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##########################
|
||||
# Arch Linux initilizing script
|
||||
##########################
|
||||
|
||||
# Header for this script
|
||||
TITLE="Arch_Setup"
|
||||
LOGFILE=/tmp/$TITLE.log
|
||||
DEPTH=1
|
||||
if [[ $DEPTH == 0 ]]; then
|
||||
TAGSTR="-->"
|
||||
elif [[ $DEPTH == 1 ]]; then
|
||||
TAGSTR="--->"
|
||||
elif [[ $DEPTH == 2 ]]; then
|
||||
TAGSTR="----->"
|
||||
elif [[ $DEPTH == 3 ]]; then
|
||||
TAGSTR="------>"
|
||||
fi
|
||||
echo "$TAGSTR ====== $TITLE (Logged to $LOGFILE) ======"
|
||||
|
||||
# For making the script stop if something fails like make.
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
# Enable and start sshd so we can ssh in here in the future.
|
||||
echo "----> Enabling SSH"
|
||||
systemctl enable sshd
|
||||
systemctl start sshd
|
||||
echo "$TAGSTR Enabling SSH"
|
||||
systemctl enable sshd > $LOGFILE 2>&1
|
||||
systemctl start sshd > $LOGFILE 2>&1
|
||||
|
||||
# Setup keys for pacman
|
||||
echo "----> Setting up keys for pacman"
|
||||
pacman-key --init
|
||||
pacman-key --populate archlinux
|
||||
echo "$TAGSTR Setting up keys for pacman"
|
||||
pacman-key --init > $LOGFILE 2>&1
|
||||
pacman-key --populate archlinux > $LOGFILE 2>&1
|
||||
|
||||
# Setup mirrors, hardcoded for now. Could have been done with rankmirror
|
||||
# with USA and worldwide mirrors but eh.
|
||||
echo "----> Setting up mirror list"
|
||||
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
|
||||
echo "$TAGSTR Setting up mirror list"
|
||||
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup > $LOGFILE 2>&1
|
||||
cat <<- 'EOM05594313219813' > /etc/pacman.d/mirrorlist
|
||||
# Server list generated by rankmirrors on 2017-11-03
|
||||
##
|
||||
@@ -33,33 +52,32 @@ cat <<- 'EOM05594313219813' > /etc/pacman.d/mirrorlist
|
||||
Server = http://mirrors.advancedhosters.com/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.math.princeton.edu/pub/archlinux/$repo/os/$arch
|
||||
EOM05594313219813
|
||||
cat /etc/pacman.d/mirrorlist
|
||||
|
||||
# Do an update and install some packages.
|
||||
echo "----> Updating and installing base-devel, git, htop, vim, and cowsay"
|
||||
pacman -Syu base-devel git htop vim cowsay --noconfirm
|
||||
echo "$TAGSTR Updating and installing base-devel, git, htop, vim, and cowsay"
|
||||
pacman -Syu base-devel git htop vim cowsay --noconfirm > $LOGFILE 2>&1
|
||||
|
||||
# Disable root check for makepkg since we are using root for everything.
|
||||
# Replace the "if (( EUID == 0 )); then" with "if (( 0 )); then" to force root
|
||||
# check to always fail.
|
||||
sed -i 's/if (( EUID == 0 )); then/if (( 0 )); then/' /usr/bin/makepkg
|
||||
sed -i 's/if (( EUID == 0 )); then/if (( 0 )); then/' /usr/bin/makepkg > $LOGFILE 2>&1
|
||||
|
||||
# Install Yaourt. Why yaourt instead of pacaur? Because pacaur doesn't allow
|
||||
# itself to be ran as root, even though all we have is root in the container,
|
||||
# and I don't want to bother fiddling with users just for this. Yaourt on the
|
||||
# other hand works fine for this.
|
||||
echo "----> Installing package-query and yaourt"
|
||||
echo "$TAGSTR Installing package-query and yaourt"
|
||||
mkdir ~/tmp
|
||||
cd ~/tmp
|
||||
# ----------- package query for yaourt -----------
|
||||
git clone https://aur.archlinux.org/package-query.git
|
||||
git clone https://aur.archlinux.org/package-query.git > $LOGFILE 2>&1
|
||||
cd package-query
|
||||
makepkg -si --noconfirm
|
||||
makepkg -si --noconfirm > $LOGFILE 2>&1
|
||||
cd ..
|
||||
# ----------- yaourt itself -----------
|
||||
git clone https://aur.archlinux.org/yaourt.git
|
||||
git clone https://aur.archlinux.org/yaourt.git > $LOGFILE 2>&1
|
||||
cd yaourt
|
||||
makepkg -si --noconfirm
|
||||
makepkg -si --noconfirm > $LOGFILE 2>&1
|
||||
cd ..
|
||||
# Wipe tmp dir
|
||||
cd ..
|
||||
@@ -70,5 +88,5 @@ rm -r -f ~/tmp
|
||||
ipv6addr=$(ip -6 addr show eth0 | grep /128 | grep -v fd75 | awk '{a=$2; split(a, b, "/"); print b[1]}')
|
||||
ipv4addr=$(ip -4 addr show eth0 | grep inet | awk '{a=$2; split(a, b, "/"); print b[1]}')
|
||||
|
||||
# And say what the IP address is to the terminal.
|
||||
cowsay "All Done! $ipv4addr $ipv6addr"
|
||||
# Lastly, say we are done.
|
||||
echo "$TAGSTR Completed $TITLE"
|
||||
|
||||
Reference in New Issue
Block a user