Initial commit.

This commit is contained in:
Luke 2017-09-24 18:11:10 -07:00
commit d3a73bf0be
4 changed files with 226 additions and 0 deletions

70
README.md Normal file
View File

@ -0,0 +1,70 @@
# Luke's Auto-Rice Bootstraping Scripts (LARBS)
When you've installed Arch Linux 6 gorrillian times like me, you get pretty sick of having to reproduce your favorite configuration on fresh installs over and over. When you're a C-list YouTube celebrity, it gets even more difficult when literally thousands of people ask you how to do X or get Y.
The LARBS are a final solution to all of that. These scripts are to be run on a fresh install of Arch Linux, and they create a user, install all required programs and set up dotfiles directly from Github to give normal people a fairly sleek Linux configuration without hundreds of autsitic hours. I did the work, so why should you?
I've also documented the configuration fairly well, check out the documentation on my **voidrice** repository for that.
## What do you get?
[My dotfiles](https://github.com/lukesmithxyz/voidrice) and all their requisite programs installed without a problem. It'll just take some time because I include *everything* I use, ever. All LaTeX packages, Blender, etc.
## Installation
Once you've installed a fresh install of Arch Linux with an internet connection, but before making your user, just run the following in the command line as root:
```
curl -O http://lukesmith.xyz/larbs/1.sh #Downloads the script.
bash 1.sh #To run it.
```
This will prompt you to create a user and a password and install all of the basic pacakges in the Arch repos.
In the process, it will also download another script to be run as the user (this is all automated). This will install `packer`, an AUR helper, and will use it to install the last few (very important) programs from the AUR.
Finally, it will use `git` to download my [Voidrice](https://github.com/lukesmithxyz/voidrice) dotfiles and will plop them in your home directory for instant use!
Then, finally, once that all is done, you should be able to type `startx` to begin the graphical environment. Congrats!
## How to Use
Once you're in the environment, just type Super/Mod/Windows+F1 to pull up a document that will explain everything.
## Permission Details (sudoers file)
These script will give your new created user (and those others you put in the `wheel` group) sudo access (with a password), but will also allow some commands to be run without any password confirmation. Those include:
+ `shutdown`
+ `reboot`
+ `pacman -Syyu`/`pacman -Syu`
+ `packer -Syyu`/`packer -Syu`
+ `mount`
+ `umount`
+ `systemctl restart NetworkManager`
Additionally, if you've put your password in a terminal window already, you will not need to repeat putting it in in other terminal windows.
## Version
We're basically on Version 2.0 now, which is still pretty primitive. Specifically, I haven't really added any error-handling into the script because so long as you have an internet connection and Arch doesn't mess up an update, you shouldn't have any errors anyway.
Regardless, since you can never predict the non-predicted, I'll probably add in more trouble-shooting later, but right now it should work 95% of the time.
## Bugs?
### When I type `startx` I get some kind of non-descript error!
Some computers might require some additional drivers to run a graphical environment, for example, some ThinkPads might require you to install `xf86-video-intel`. If you search your model or graphics card along with "Arch Linux" on your preferred search engine, you'll probably get the answer fast.
### I have some other problem and it didn't install correctly.
In normal circumstances, there are two main causes of misinstalls: faulty internet connections and errors with particular package upgrades or with the pacman keyring.
Check yourself if the former may be at fault, but feel free to inform me in the latter case; I may be able to provide a quick fix.
Regardless, it's generally safe to rerun the script if something temporary went wrong, although you may want to delete the user created before rerunning:
```
userdel USER
```

78
arch.sh Normal file
View File

@ -0,0 +1,78 @@
#!/bin/bash
#This is a lazy script I have for auto-installing Arch.
#It's not officially part of LARBS, but I use it for testing.
#DO NOT RUN THIS YOURSELF because Step 1 is it reformatting /dev/sda WITHOUT confirmation,
#which means RIP in peace qq your data unless you've already backed up all of your drive.
timedatectl set-ntp true
cat <<EOF | fdisk /dev/sda
o
n
p
+200M
n
p
+12G
n
p
+25G
n
p
w
EOF
partprobe
mkfs.ext4 /dev/sda4
mkfs.ext4 /dev/sda3
mkfs.ext4 /dev/sda1
mkswap /dev/sda2
swapon /dev/sda2
mount /dev/sda3 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
mkdir /mnt/home
mount /dev/sda4 /mnt/home
pacstrap /mnt base
genfstab -U /mnt >> /mnt/etc/fstab
curl http://lukesmith.xyz/larbs/chroot.sh > /mnt/chroot.sh
arch-chroot /mnt bash chroot.sh
rm /mnt/chroot.sh
echo "Eject CD/ROM? [y/N]"
read yn
case $yn in
[Yy]* ) eject ;;
[yes]* ) eject ;;
[Yes]* ) eject ;;
esac
echo "Reboot now? [y/N]"
read yn
case $yn in
[Yy]* ) reboot ;;
[yes]* ) reboot ;;
[Yes]* ) reboot ;;
esac
echo "Return to chroot environment?"
read yn
case $yn in
[Yy]* ) arch-chroot /mnt ;;
[yes]* ) arch-chroot /mnt ;;
[Yes]* ) arch-chroot /mnt ;;
esac

44
root.sh Normal file
View File

@ -0,0 +1,44 @@
#!/bin/bash
pacman -S --noconfirm dialog
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
#printf "This should have ${BLUE}Blue\n${NC} and ${RED}Red${NC} text."
#printf "\n${BLUE}Now installing main programs...\n${NC}\n"
dialog --title "Welcome!" --msgbox "Welcome to Luke's Auto-Rice Bootstrapping Script!\n\nThis script will automatically install a fully-featured i3wm Arch Linux desktop, which I use as my main machine.\n\n-Luke" 10 60
dialog --no-cancel --inputbox "First, please enter a name for the user account." 10 60 2> name
clear
dialog --no-cancel --passwordbox "Enter a password for that user." 10 60 2> pass1
dialog --no-cancel --passwordbox "Reype password." 10 60 2> pass2
while [ $(cat pass1) != $(cat pass2) ]
do
dialog --no-cancel --passwordbox "Passwords do not match.\n\nEnter password again." 10 60 2> pass1
dialog --no-cancel --passwordbox "Reype password." 10 60 2> pass2
done
USER=$(cat name)
rm name
useradd -m -g wheel -s /bin/bash $USER
echo "$USER:$(cat pass1)" | chpasswd
#I shred the password for safety's sake.
shred -u pass1
shred -u pass2
printf "${BLUE}Now installing main programs.\n${NC}"
pacman --noconfirm --needed -S base-devel xorg-xinit xorg-server rxvt-unicode feh ffmpeg pulseaudio pulseaudio-alsa arandr pavucontrol pamixer mpv wget rofi vim w3m ranger mediainfo poppler highlight tmux calcurse htop newsbeuter mpd mpc ncmpcpp network-manager-applet networkmanager qutebrowser imagemagick transmission-cli atool libcaca compton transset-df blender gimp texlive-most texlive-lang markdown mupdf evince rsync git youtube-dl youtube-viewer noto-fonts-cjk noto-fonts-emoji cups screenfetch scrot unzip unrar biber ntfs-3g offlineimap msmtp notmuch notmuch-mutt dosfstools fzf r
printf "${BLUE}Enabling Network Manager...\n${NC}"
systemctl enable NetworkManager
systemctl start NetworkManager
printf "${BLUE}Downloading next portion of script...\n${NC}"
curl http://lukesmith.xyz/larbs/user.sh > /home/$USER/user.sh
printf "${BLUE}Running script as new user $USER...\n${NC}"
cp /etc/sudoers /etc/sudoers.prelarbs
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
sudo -u $USER bash /home/$USER/user.sh
curl http://lukesmith.xyz/larbs/sudoers > /etc/sudoers
dialog --title "All done!" --msgbox "Congrats! Provided there were no hidden errors, the script completed successfully and all the programs and configuration files should be in place.\n\nTo run the new graphical environment, log out and log back in as your new user, then run the command \"startx\" to start the graphical environment.\n\n-Luke" 10 60

34
user.sh Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
printf "${BLUE}Changing directory to /home/$USER...\n${NC}"
cd /home/$USER
printf "${BLUE}Activating Pulseaudio if not already active...\n${NC}"
pulseaudio --start
printf "${BLUE}Installing packer as an AUR manager...\n${NC}"
wget https://aur.archlinux.org/cgit/aur.git/snapshot/packer.tar.gz
tar -xvzf packer.tar.gz
cd packer
makepkg --noconfirm -si
cd ..
rm -rf packer/
rm packer.tar.gz
printf "${BLUE}Installing AUR programs...\n${NC}"
printf "${BLUE}(May take some time.)\n${NC}"
packer --noconfirm -S cli-visualizer i3-gaps vim-pathogen vim-live-latex-preview neofetch i3lock tamzen-font-git speedometer neomutt transmission-remote-cli-git ncpamixer-git unclutter-xfixes-git urxvt-resize-font-git ttf-ancient-fonts polybar-git python-pywal xfce-theme-blackbird
printf "${BLUE}Downloading config files...\n${NC}"
git clone https://github.com/lukesmithxyz/voidrice.git
rsync -va --delete-after voidrice/ /home/$USER
git clone https://github.com/lukesmithxyz/latex-templates.git
mkdir -p /home/$USER/Documents/LaTeX
rsync -va --delete-after latex-templates /home/$USER/Documents/LaTeX
sudo rm -rf voidrice
sudo rm -rf latex-templates
printf "${BLUE}Generating bash/ranger/qutebrowser shortcuts...\n${NC}"
python ~/.config/Scripts/shortcuts.py