1
0
mirror of https://github.com/hak8or/proxmox_scripts.git synced 2025-12-08 23:18:06 +00:00

Logging fix, using static IP, yaourt->yay, and changed to 10.10.10.200

This commit is contained in:
2018-12-23 21:43:27 -05:00
parent b4026ccf13
commit 0167216d0c
2 changed files with 37 additions and 30 deletions

48
arch_setup.sh Normal file → Executable file
View File

@@ -25,19 +25,19 @@ set -o pipefail
# Enable and start sshd so we can ssh in here in the future.
echo "$TAGSTR Enabling SSH"
systemctl enable sshd > $LOGFILE 2>&1
systemctl start sshd > $LOGFILE 2>&1
systemctl enable sshd >> $LOGFILE 2>&1
systemctl start sshd >> $LOGFILE 2>&1
# Setup keys for pacman
echo "$TAGSTR Setting up keys for pacman"
pacman-key --init > $LOGFILE 2>&1
pacman-key --populate archlinux > $LOGFILE 2>&1
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 "$TAGSTR Setting up mirror list"
if [[ -e /etc/pacman.d/mirrorlist ]]; then
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup # > $LOGFILE 2>&1
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup # >> $LOGFILE 2>&1
fi
cat <<- 'EOM05594313219813' > /etc/pacman.d/mirrorlist
# Server list generated by rankmirrors on 2017-11-03
@@ -57,42 +57,42 @@ EOM05594313219813
# Update as needed.
echo "$TAGSTR Updating all packages as needed"
pacman -Syu --noconfirm > $LOGFILE 2>&1
pacman -Syu --noconfirm >> $LOGFILE 2>&1
# Do an update and install some packages.
echo "$TAGSTR Installing base-devel, git, htop, vim, rsync, go, dotnet-sdk, wget, tmux, and cowsay"
pacman -Syu base-devel git htop vim cowsay rsync go dotnet-sdk wget tmux --noconfirm --needed > $LOGFILE 2>&1
pacman -Syu base-devel git htop vim cowsay rsync go dotnet-sdk wget tmux --noconfirm --needed >> $LOGFILE 2>&1
# Change locale to EN US UTF-8
echo "$TAGSTR Changing locale to EN US UTF-8"
sed -i 's/if (( EUID == 0 )); then/if (( 0 )); then/' /usr/bin/makepkg > $LOGFILE 2>&1
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen > $LOGFILE 2>&1
locale-gen > $LOGFILE 2>&1
echo LANG=en_US.UTF-8 > /etc/locale.conf > $LOGFILE 2>&1
sed -i 's/if (( EUID == 0 )); then/if (( 0 )); then/' /usr/bin/makepkg >> $LOGFILE 2>&1
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen >> $LOGFILE 2>&1
locale-gen >> $LOGFILE 2>&1
echo LANG=en_US.UTF-8 > /etc/locale.conf >> $LOGFILE 2>&1
export LANG=en_US.UTF-8
# Install Yaourt. Why yaourt instead of pacaur? Because pacaur doesn't allow
# Install yay. Why yay 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
# and I don't want to bother fiddling with users just for this. Yay on the
# other hand works fine for this.
if ! type yaourt &> /dev/null; then
# 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 > $LOGFILE 2>&1
sed -i 's/if (( EUID == 0 )); then/if (( 0 )); then/' /usr/bin/makepkg >> $LOGFILE 2>&1
echo "$TAGSTR Installing package-query and yaourt"
echo "$TAGSTR Installing package-query and yay"
mkdir ~/tmp
cd ~/tmp
# ----------- package query for yaourt -----------
git clone https://aur.archlinux.org/package-query.git > $LOGFILE 2>&1
# ----------- package query for yay -----------
git clone https://aur.archlinux.org/package-query.git >> $LOGFILE 2>&1
cd package-query
makepkg -si --noconfirm > $LOGFILE 2>&1
makepkg -si --noconfirm >> $LOGFILE 2>&1
cd ..
# ----------- yaourt itself -----------
git clone https://aur.archlinux.org/yaourt.git > $LOGFILE 2>&1
cd yaourt
makepkg -si --noconfirm > $LOGFILE 2>&1
# ----------- yay itself -----------
git clone https://aur.archlinux.org/yay.git >> $LOGFILE 2>&1
cd yay
makepkg -si --noconfirm >> $LOGFILE 2>&1
cd ..
# Wipe tmp dir
cd ..
@@ -101,8 +101,8 @@ fi
# Get the ip addresses using some grep and awk magic.
# Magic inspired by this: https://superuser.com/questions/468727/how-to-get-the-ipv6-ip-address-of-linux-machine
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]}')
ipv6addr=$(ip addr show dev eth0 | grep "inet6 fe80" | awk '{a=$2; split(a, b, "/"); print b[1]}')
ipv4addr=$(ip addr show dev eth0 | grep "inet 10" | awk '{a=$2; split(a, b, "/"); print b[1]}')
# Lastly, say we are done.
echo "$TAGSTR Completed $TITLE"