Created
June 20, 2015 06:36
-
-
Save anonymous/30a64d4259c0b863b195 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This script is best used if modified for each person | |
#The install can quickly completed if there is a local mirror. | |
#on an existing arch install, run: darkhttpd /var/cache/pacman/pkg/ | |
#then set LOCALMIRROR to point to that machine | |
#It's okay if errors come up, pacman will resolve them. | |
export LOCALMIRROR="Server = http://192.168.1.1:8080" | |
export MIRRORLIST="/etc/pacman.d/mirrorlist" | |
echo -e ""$LOCALMIRROR"\n$(cat $MIRRORLIST)" > $MIRRORLIST | |
export rootPass="password" | |
export userName="username" | |
export hostName="hostname" | |
#rewritefs settings | |
#export rwfsconfig="/home/rewritedir/$userName/.config/rewritefs" | |
#export rwfssettings="allow_other,default_permissions,auto_unmount" | |
#,uid=$(id -u $userName),gid=$(id -g $userName)" | |
#partition the drive with btrfs | |
arch_partition(){ | |
parted /dev/sdb -s "mktable gpt" | |
parted /dev/sdb -s "mkpart primary ext4 0% 8M" | |
parted /dev/sdb -s "mkpart primary ext4 9M 99%" | |
parted /dev/sdb -s "set 1 bios_grub on" | |
mkfs.btrfs -L "mainfs" /dev/sdb2 | |
mount /dev/sdb2 /mnt | |
echo "run: arch_install" | |
} | |
#install the base system | |
arch_install(){ | |
pacstrap /mnt base base-devel btrfs-progs | |
cp install.sh /mnt/root/ | |
genfstab -U -p /mnt >> /mnt/etc/fstab | |
arch-chroot /mnt /bin/bash -si << ENDCMD | |
source /root/install.sh | |
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen | |
locale-gen | |
echo LANG=en_US.UTF-8 > /etc/locale.conf | |
export LANG=en_US.UTF-8; | |
ln -s /usr/share/zoneinfo/CST6CDT /etc/localtime; | |
#RNDSUF=$(head -c3 /dev/urandom | base64 | tr "/" "0" | tr "+" "0") | |
#echo "arch-user-$RNDSUF" > /etc/hostname | |
echo "$hostName" > /etc/hostname | |
systemctl enable dhcpcd.service | |
mkinitcpio -p linux | |
pacman --noconfirm -S grub | |
grub-install --target=i386-pc --recheck --debug /dev/sdb | |
grub-mkconfig -o /boot/grub/grub.cfg | |
echo "root:$rootPass" | chpasswd | |
groupadd sudo | |
arch_install_basic | |
echo "%sudo ALL=(ALL) ALL" >> /etc/sudoers | |
useradd -m "$userName" | |
systemctl enable sshd.service | |
usermod -a -G sudo "$userName" | |
ENDCMD | |
#DO NOT INDENT, DOES NOT WORK IF INDENTED | |
} | |
#the awesome aur.sh script, check the wiki. Hard coded for security purposes. | |
#slight modifications were made for automated package installation. | |
aursh(){ | |
d=${BUILDDIR:-$PWD} | |
for p in ${@##-*}; do | |
cd "$d" | |
curl "https://aur.archlinux.org/packages/${p:0:2}/$p/$p.tar.gz"|tar xz | |
cd "$p" | |
makepkg --asroot --noconfirm -si ${@##[^\-]*} | |
done | |
} | |
#install packages from an array | |
install_from_list(){ | |
pacman --noconfirm -S $@ | |
} | |
#install packages that are needed, but not in base group | |
arch_install_basic(){ | |
packageList=( | |
sudo | |
wget | |
bash-completion | |
openssh | |
traceroute | |
yajl | |
openssl | |
expac | |
vim | |
fuse | |
pcre | |
git | |
cloc | |
zip | |
unzip | |
tmux | |
xdg-user-dirs | |
perl | |
python | |
python2 | |
iptables | |
nmap | |
dnsutils | |
ntp | |
xz | |
htop | |
irssi | |
mc | |
ncdu | |
cpio | |
atool | |
bc | |
base-devel | |
time | |
tcpdump | |
tree | |
rsync | |
aspell | |
words | |
lsof | |
whois | |
mtr | |
gnu-netcat | |
wireshark-cli | |
iperf | |
pkgfile | |
rxvt-unicode | |
) | |
packageString=$(echo ${packageList[*]}) | |
install_from_list "$packageString" | |
} | |
arch_install_perlsetup(){ | |
cd /tmp | |
wget http://search.cpan.org/CPAN/authors/id/H/HA/HAARG/local-lib-2.000012.tar.gz | |
tar -xf local-lib-2.000012.tar.gz | |
cd local-lib-2.000012/ | |
perl Makefile.PL --bootstrap=~/.perl | |
make test && make install | |
echo '[ $SHLVL -eq 1 ] && eval "$(perl -I$HOME/.perl/lib/perl5 -Mlocal::lib=$HOME/.perl)"' >> ~/.bashrc | |
source ~/.bashrc | |
curl -L http://cpanmin.us | perl - App::cpanminus | |
} | |
#install gui related packages | |
arch_install_gui(){ | |
packageList=( | |
firefox | |
transmission-cli | |
transmission-remote-cli | |
virtualbox | |
keepass | |
vlc | |
youtube-dl | |
zathura | |
xchm | |
feh | |
sxiv | |
rxvt-unicode | |
mpv | |
) | |
packageString=$(echo ${packageList[*]}) | |
install_from_list "${packageString[*]}" | |
} | |
#sets up a normal user with rewritefs | |
#this is intended to be run after first boot on root account | |
arch_user_setup(){ | |
useradd -m "$userName" | |
usermod -a -G sudo "$userName" | |
runuser -l "$userName" -c "xdg-user-dirs-update" | |
# mkdir -p /home/rewritedir | |
# mv /home/"$userName" /home/rewritedir/ | |
# cat > /home/rewritedir/"$userName"/.config/rewritefs << EOF | |
#m#^(?!\.)# . | |
#m#^\.(cache|config|local)# . | |
#m#^\.# .config/ | |
#EOF | |
# echo "user_allow_other" >> /etc/fuse.conf | |
# mkdir -p /home/"$userName" | |
# rewritefs -o config="$rwfsconfig","$rwfssettings" \ | |
# /home/rewritedir/"$userName" /home/"$userName" | |
# | |
## rewritefs -o \ | |
## config=/home/rewritedir/"$userName"/.config/rewritefs,allow_other,default_permissions,auto_unmount,uid=$(id -u $userName),gid=$(id -g $userName) \ | |
## /home/rewritedir/"$userName" \ | |
## /home/"$userName" | |
# echo "rewritefs#/home/rewritedir/"$userName" /home/"$userName" fuse config=/home/rewritedir/"$userName"/.config/rewritefs,allow_other,default_permissions,auto_unmount,uid=$(id -u $userName),gid=$(id -g $userName) 0 0" >> /etc/fstab | |
} | |
#Install basic and essential packages. Some are less essential than others, | |
# but are nice to have in any case. | |
#To use SELinux, the AUR or kernel recompile is suggested. | |
#This tries to install ntpd, but the service must be mnaually enabled. | |
#No cron is installed as systemd include cron functionality. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment