SpectreOS-old/arch-graphical-install-auto

949 lines
25 KiB
Text
Raw Permalink Normal View History

2018-02-26 02:41:29 +01:00
#!/bin/bash
#
set -ex
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
2018-04-07 19:07:06 +02:00
sudo "$0" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
2018-02-26 02:41:29 +01:00
exit 0
fi
echo "Als root Angemeldet"
#
2018-09-03 01:54:46 +02:00
#VERSION_ID=$(cat /etc/os-release | grep "ID")
2018-02-26 02:41:29 +01:00
RCLOCAL='/etc/rc.local'
2018-05-05 00:41:23 +02:00
RCLOCALSHUTDOWN='/etc/rc.local.shutdown'
2018-02-26 02:41:29 +01:00
SYSCTL='/etc/sysctl.conf'
2018-07-05 15:45:24 +02:00
WEBADDRESS="ssh://git@5.83.162.84:22/home/git/SpectreOS"
WEBADDRESS1="ssh://git@5.83.162.84:22/home/git/shell-scripte"
2018-02-26 02:41:29 +01:00
SUDOERS="/etc/sudoers"
repo="SpectreOS"
repo1="shell-scripte"
version="$1"
username="$2"
userpass="$3"
2018-06-05 00:20:35 +02:00
skip="$4"
2018-07-08 23:31:48 +02:00
packageupdate="$5"
2018-02-26 02:41:29 +01:00
2018-04-08 20:07:02 +02:00
hostname="$(cat /etc/hostname)"
2018-04-20 23:03:47 +02:00
[[ -z "${version}" ]] && version="${hostname#*-}"
2018-02-26 02:41:29 +01:00
[[ -z "${username}" ]] && username="user1"
[[ -z "${userpass}" ]] && userpass="user1"
function gitclone() {
2018-06-19 12:04:07 +02:00
git config --global core.editor "nano"
git config --global user.email "user1@spectreos.de"
git config --global user.name "user1"
git config --global push.default simple
2018-06-17 20:58:31 +02:00
if ! [ -f "/root/.ssh/id_rsa.pub" ]; then
ssh-keygen -b 4096
rootrechte
cat /root/.ssh/id_rsa.pub
echo "Bitte tragen sie den neuen Key in den GIT-Server ein!!!"
echo "Sie haben 60 Sekunden Zeit!!!"
sleep 60
fi
2018-03-10 22:17:49 +01:00
if [ -d "/opt/${repo}" ]; then
2018-02-26 02:41:29 +01:00
echo "${repo} existiert bereits!!!"
2018-03-10 22:13:56 +01:00
cd /opt/${repo}
2018-08-13 15:02:34 +02:00
git reset --hard
2018-03-10 22:13:56 +01:00
git pull
else
2018-03-10 22:17:49 +01:00
git clone ${WEBADDRESS} /opt/${repo}
2018-02-26 02:41:29 +01:00
fi
2018-03-10 22:17:49 +01:00
if [ -d "/opt/${repo1}" ]; then
2018-02-26 02:41:29 +01:00
echo "${repo1} existiert bereits!!!"
2018-03-10 22:13:56 +01:00
cd /opt/${repo1}
2018-08-13 15:02:34 +02:00
git reset --hard
2018-03-10 22:13:56 +01:00
git pull
else
2018-03-10 22:17:49 +01:00
git clone ${WEBADDRESS1} /opt/${repo1}
2018-02-26 02:41:29 +01:00
fi
cd /
}
2018-03-18 18:15:27 +01:00
function yaourtmanagerinstall() {
2018-03-18 18:18:51 +01:00
2018-03-18 18:38:59 +01:00
cd /home/"$username"/
pwd
su "$username" -c "curl -O https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz"
pwd
su "$username" -c "tar -xvzf package-query.tar.gz"
pwd
cd package-query
pwd
2018-03-18 18:41:14 +01:00
su "$username" -c "makepkg -si --skipchecksums --skippgpcheck --nocheck --noconfirm --install --needed"
pwd
cd ..
pwd
su "$username" -c "curl -O https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz"
pwd
su "$username" -c "tar -xvzf yaourt.tar.gz"
pwd
cd yaourt
pwd
su "$username" -c "makepkg -si --skipchecksums --skippgpcheck --nocheck --noconfirm --install --needed"
pwd
cd /
2018-03-18 18:15:27 +01:00
}
function pacaurmanagerinstall() {
2018-03-18 18:41:14 +01:00
cd /home/"$username"/
pwd
2018-03-18 18:55:46 +01:00
if [ -d /home/"$username"/cower ];then
echo "Bereits vorhanden!!!"
cd /home/"$username"/cower
su "$username" -c "git pull"
cd ..
else
su "$username" -c "git clone https://aur.archlinux.org/cower.git"
fi
2018-03-18 18:41:14 +01:00
pwd
cd cower
pwd
su "$username" -c "makepkg -si --skipchecksums --skippgpcheck --nocheck --noconfirm --install --needed"
pwd
cd ..
pwd
2018-03-18 18:55:46 +01:00
if [ -d /home/"$username"/pacaur ];then
echo "Bereits vorhanden!!!"
cd /home/"$username"/pacaur
su "$username" -c "git pull"
cd ..
else
su "$username" -c "git clone https://aur.archlinux.org/pacaur.git"
fi
2018-03-18 18:41:14 +01:00
pwd
cd pacaur
pwd
su "$username" -c "makepkg -si --skipchecksums --skippgpcheck --nocheck --noconfirm --install --needed"
pwd
cd /
2018-03-18 18:15:27 +01:00
}
2018-04-01 14:13:01 +02:00
function aurmanagerinstall() {
cd /home/"$username"/
pwd
if [ -d /home/"$username"/aurman ];then
echo "Bereits vorhanden!!!"
cd /home/"$username"/aurman
su "$username" -c "git pull"
cd ..
else
su "$username" -c "git clone https://aur.archlinux.org/aurman.git"
fi
pwd
cd aurman
pwd
su "$username" -c "makepkg -si --skipchecksums --skippgpcheck --nocheck --noconfirm --install --needed"
pwd
cd /
}
2018-02-26 02:41:29 +01:00
function yaourtinstall() {
su "$username" -c "yaourt -S $1 --needed --noconfirm"
}
2018-04-01 14:13:01 +02:00
function aurinstall() {
su "$username" -c "aurman -S $1 --needed --noconfirm --noedit"
2018-03-18 18:15:27 +01:00
}
2018-02-26 02:41:29 +01:00
function standartinstallation() {
2018-02-27 23:03:01 +01:00
pacman -Syu $(cat /opt/${repo}/packages_${version}.txt) --needed --noconfirm
2018-02-26 02:41:29 +01:00
}
function ldconfigcache() {
rm /etc/ld.so.cache
ldconfig
}
2018-03-18 18:24:31 +01:00
function addusers() {
2018-09-03 01:58:07 +02:00
if ! cat /etc/group | grep users; then
2018-09-03 02:08:19 +02:00
groupadd users
2018-09-03 01:58:07 +02:00
fi
if ! cat /etc/group | grep wheel; then
2018-09-03 02:08:19 +02:00
groupadd wheel
2018-09-03 01:58:07 +02:00
fi
if ! cat /etc/group | grep audio; then
2018-09-03 02:08:19 +02:00
groupadd audio
2018-09-03 01:58:07 +02:00
fi
if ! cat /etc/group | grep video; then
2018-09-03 02:08:19 +02:00
groupadd video
2018-09-03 01:58:07 +02:00
fi
if ! cat /etc/group | grep optical; then
2018-09-03 02:08:19 +02:00
groupadd optical
2018-09-03 01:58:07 +02:00
fi
2018-09-03 02:18:54 +02:00
if ! cat /etc/group | grep adm; then
groupadd adm
fi
useradd -m -g users -G wheel,audio,video,sys,optical,adm -s /bin/bash $username
2018-02-26 02:41:29 +01:00
passwd ${username} <<EOT
${userpass}
${userpass}
EOT
mkdir -p /home/"$username"/
userrechte
2018-05-27 02:51:22 +02:00
# sudoers/wheel
echo "Lege $SUDOERS neu an!!!"
echo "root ALL=(ALL) NOPASSWD: ALL" > $SUDOERS
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> $SUDOERS
2018-02-26 02:41:29 +01:00
}
function copyconfig() {
2018-06-05 00:06:11 +02:00
if [ -d /home/"$username"/.config ]; then
2018-08-26 21:41:36 +02:00
rm -Rv /home/"$username"/.config
2018-06-05 00:06:11 +02:00
fi
2018-02-26 02:41:29 +01:00
cp -aRv /root/. /home/"$username"/
#links
links
userrechte
2018-03-28 07:33:47 +02:00
rootrechte
2018-02-26 02:41:29 +01:00
}
function userrechte() {
#user
chown -cR -v "$username":users /home/"$username"
chmod 750 -Rv /home/"$username"
#ssh
2018-07-16 21:47:06 +02:00
if ! [ -d /home/"$username"/.ssh ]; then
mkdir -p /home/"$username"/.ssh
2018-02-26 02:41:29 +01:00
fi
2018-07-16 21:47:06 +02:00
chmod 700 /home/"$username"/.ssh
2018-02-26 02:41:29 +01:00
if [ -f /home/"$username"/.ssh/id_rsa ]; then
chmod 600 /home/"$username"/.ssh/id_rsa
fi
2018-07-16 21:47:06 +02:00
if ! [ -f /home/"$username"/.ssh/authorized_keys ]; then
touch /home/"$username"/.ssh/authorized_keys
2018-02-26 02:41:29 +01:00
fi
2018-07-16 21:47:06 +02:00
chmod 600 /home/"$username"/.ssh/authorized_keys
2018-02-26 02:41:29 +01:00
2018-03-28 07:33:47 +02:00
}
function rootrechte() {
2018-02-26 02:41:29 +01:00
#root
chmod 750 -Rv /root
#ssh-root
2018-07-16 21:47:06 +02:00
if ! [ -d /root/.ssh ]; then
mkdir -p /root/.ssh
2018-02-26 02:41:29 +01:00
fi
2018-07-16 21:47:06 +02:00
chmod 700 /root/.ssh
2018-02-26 02:41:29 +01:00
if [ -f /root/.ssh/id_rsa ]; then
chmod 600 /root/.ssh/id_rsa
fi
2018-07-16 21:47:06 +02:00
if ! [ -f /root/.ssh/authorized_key ]; then
touch /root/.ssh/authorized_keys
2018-02-26 02:41:29 +01:00
fi
2018-07-16 21:47:06 +02:00
chmod 600 /root/.ssh/authorized_keys
2018-02-26 02:41:29 +01:00
}
function links() {
#
mkdir -p /home/"$username"/Schreibtisch/
if [ -f "/usr/share/applications/arch-install.desktop" ]; then
if [ -f "/home/"$username"/Schreibtisch/arch-install.desktop" ]; then
echo "datei existiert bereits!"
else
ln -s /usr/share/applications/arch-install.desktop /home/"$username"/Schreibtisch/arch-install.desktop
fi
#chmod +x /home/"$username"/Schreibtisch/arch-install.desktop
fi
#
mkdir -p /root/Schreibtisch/
if [ -f "/usr/share/applications/arch-install.desktop" ]; then
if [ -f "/root/Schreibtisch/arch-install.desktop" ]; then
echo "datei existiert bereits!"
else
ln -s /usr/share/applications/arch-install.desktop /root/Schreibtisch/arch-install.desktop
fi
#chmod +x /root/Schreibtisch/arch-install.desktop
fi
#
mkdir -p /home/"$username"/Desktop/
if [ -f "/usr/share/applications/arch-install.desktop" ]; then
if [ -f "/home/"$username"/Desktop/arch-install.desktop" ]; then
echo "datei existiert bereits!"
else
ln -s /usr/share/applications/arch-install.desktop /home/"$username"/Desktop/arch-install.desktop
fi
#chmod +x /home/"$username"/Desktop/arch-install.desktop
fi
#
mkdir -p /root/Desktop/
if [ -f "/usr/share/applications/arch-install.desktop" ]; then
if [ -f "/root/Desktop/arch-install.desktop" ]; then
echo "datei existiert bereits!"
else
ln -s /usr/share/applications/arch-install.desktop /root/Desktop/arch-install.desktop
fi
#chmod +x /root/Desktop/arch-install.desktop
fi
}
function gnomeconfig() {
mkdir -p /root/.config/gtk-3.0/
echo "[Settings]" > /root/.config/gtk-3.0/settings.ini
echo "gtk-theme-name = Adwaita" >> /root/.config/gtk-3.0/settings.ini
echo "# next option is applicable only if selected theme supports it" >> /root/.config/gtk-3.0/settings.ini
echo "gtk-application-prefer-dark-theme = true" >> /root/.config/gtk-3.0/settings.ini
echo "# set font name and dimension" >> /root/.config/gtk-3.0/settings.ini
echo "gtk-font-name = Sans 10" >> /root/.config/gtk-3.0/settings.ini
2018-04-25 11:05:20 +02:00
gsettings set org.gnome.desktop.media-handling automount 'false'
gsettings set org.gnome.desktop.media-handling automount-open 'false'
2018-02-26 02:41:29 +01:00
}
#
if [ "$1" == "adduser" ]
then
2018-05-27 02:48:44 +02:00
username="$2"
userpass="$3"
2018-03-18 18:24:31 +01:00
addusers
2018-02-26 02:41:29 +01:00
exit 0
fi
if cat /etc/passwd | grep ${username} > /dev/null; then
2018-03-18 18:38:59 +01:00
echo "${username} existiert bereits!!!"
2018-02-26 02:41:29 +01:00
else
2018-03-18 18:38:59 +01:00
addusers
2018-02-26 02:41:29 +01:00
fi
if [ "$erstellen" == "exit" ]
then
exit 0
fi
2018-04-08 19:00:20 +02:00
# grundinstallation
gitclone
2018-02-26 02:41:29 +01:00
# Your commands
# startup
2018-02-27 22:53:24 +01:00
cp /opt/${repo}/startup /usr/bin/
2018-02-26 02:41:29 +01:00
chmod 755 /usr/bin/startup
2018-09-03 02:08:19 +02:00
if ! [ "${version}" == "libre-xfce4-openrc" ]; then
cp /opt/${repo}/startup.service /etc/systemd/system/
chmod 644 /etc/systemd/system/startup.service
systemctl enable startup.service
fi
2018-02-26 02:41:29 +01:00
# pacman-config
2018-09-03 01:21:45 +02:00
if [ "${version%-*-*}" == "libre" ]; then
2018-02-27 22:53:24 +01:00
cp /opt/${repo}/pacman.conf_libre /etc/pacman.conf
2018-09-03 01:21:45 +02:00
elif [ "${version%-*-*}" == "manjaro" ]; then
2018-05-02 21:19:28 +02:00
cp /opt/${repo}/pacman.conf_manjaro /etc/pacman.conf
2018-09-03 01:21:45 +02:00
elif [ "${version%-*-*}" == "pi" ]; then
2018-06-04 21:35:02 +02:00
cp /opt/${repo}/pacman.conf_pi /etc/pacman.conf
2018-02-26 02:41:29 +01:00
else
2018-02-27 22:53:24 +01:00
cp /opt/${repo}/pacman.conf /etc/pacman.conf
2018-02-26 02:41:29 +01:00
fi
2018-05-02 21:19:28 +02:00
# mirrorlist
cp /opt/${repo}/mirrorlist* /etc/pacman.d/
2018-02-26 02:41:29 +01:00
if [ -f /var/lib/pacman/db.lck ];then
rm /var/lib/pacman/db.lck
fi
2018-04-08 19:27:24 +02:00
# vollinstallation
2018-09-03 01:21:45 +02:00
if [ "${version%-*-*}" != "lite" ] && [ "${packageupdate}" != "skip" ]; then
2018-08-26 21:41:36 +02:00
standartinstallation
2018-04-08 19:27:24 +02:00
fi
2018-02-26 02:41:29 +01:00
echo "Packetliste2 Ende"
echo "Beginne mit dem Konfigurieren des Systems :D"
2018-04-07 20:24:24 +02:00
2018-02-26 02:41:29 +01:00
# set desktop
echo "set desktop"
#
2018-09-03 01:21:45 +02:00
if [ "${version%-*-*}" != "lite" ]; then
2018-08-26 21:41:36 +02:00
if [ -f "/opt/${repo}/xinitrc_${version}.txt" ]; then
cp /opt/${repo}/xinitrc_${version}.txt /etc/X11/xinit/xinitrc
else
cp /opt/${repo}/xinitrc_special.txt /etc/X11/xinit/xinitrc
fi
2018-04-25 10:40:51 +02:00
fi
2018-02-26 02:41:29 +01:00
#
echo "Systemsprache und dienste werden erstellt!"
mkdir -p /etc/X11/xorg.conf.d/
# localectl set-x11-keymap de pc105 nodeadkeys
echo "Section \"InputClass\"" > /etc/X11/xorg.conf.d/20-keyboard.conf
echo " Identifier \"Keyboard0\"" >> /etc/X11/xorg.conf.d/20-keyboard.conf
echo " MatchIsKeyboard \"yes\"" >> /etc/X11/xorg.conf.d/20-keyboard.conf
echo " Option \"XkbLayout\" \"de\"" >> /etc/X11/xorg.conf.d/20-keyboard.conf
echo " Option \"XkbModel\" \"pc105\"" >> /etc/X11/xorg.conf.d/20-keyboard.conf
echo " Option \"XkbVariant\" \"nodeadkeys\"" >> /etc/X11/xorg.conf.d/20-keyboard.conf
echo "EndSection" >> /etc/X11/xorg.conf.d/20-keyboard.conf
#xset m 2/1 0
echo "Section \"InputClass\"" > /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
echo " Identifier \"Mouse0\"" >> /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
echo " MatchIsPointer \"yes\"" >> /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
echo "# set the following to 1 1 0 respectively to disable acceleration." >> /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
echo " Option \"AccelerationNumerator\" \"2\"" >> /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
echo " Option \"AccelerationDenominator\" \"1\"" >> /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
echo " Option \"AccelerationThreshold\" \"4\"" >> /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
echo "EndSection" >> /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
2018-07-14 20:24:27 +02:00
# import compress script
# compress-script
cp /opt/${repo}/compress.sh /usr/bin/compress
chmod 755 /usr/bin/compress
2018-07-14 17:54:19 +02:00
# set config direction
if [ -d /root/.config ]; then
2018-08-26 21:41:36 +02:00
rm -Rv /root/.config
2018-07-14 17:54:19 +02:00
fi
mkdir -p /root/.config
compress restore /opt/${repo}/.config.tar.pxz /root/.config/
2018-07-26 02:17:07 +02:00
compress restore /opt/${repo}/.config-extra.tar.pxz /root/
2018-07-14 17:54:19 +02:00
gnomeconfig
2018-02-26 02:41:29 +01:00
# set system startup files
echo "System startup files"
start=getty
if [ "$start" == "getty" ]
then
echo "if [ \$(tty) = "/dev/tty1" ]; then" > /root/.bash_profile
echo "startx" >> /root/.bash_profile
echo "fi" >> /root/.bash_profile
#
echo "if [ \$(tty) = "/dev/tty1" ]; then" > /home/"$username"/.bash_profile
echo "startx" >> /home/"$username"/.bash_profile
echo "fi" >> /home/"$username"/.bash_profile
#
start=${username}
if [ "$start" == "root" ]
then
mkdir -p /etc/systemd/system/getty\@tty1.service.d
echo "[Service]" > /etc/systemd/system/getty\@tty1.service.d/autologin.conf
echo "ExecStart=" >> /etc/systemd/system/getty\@tty1.service.d/autologin.conf
2018-07-17 23:26:31 +02:00
echo "ExecStart=-/usr/bin/agetty --autologin root -s %I 115200,38400,9600 vt102" >> /etc/systemd/system/getty\@tty1.service.d/autologin.conf
2018-09-03 02:08:19 +02:00
if ! [ "${version}" == "libre-xfce4-openrc" ]; then
systemctl enable getty@tty1
fi
2018-02-26 02:41:29 +01:00
else
mkdir -p /etc/systemd/system/getty\@tty1.service.d
echo "[Service]" > /etc/systemd/system/getty\@tty1.service.d/autologin.conf
echo "ExecStart=" >> /etc/systemd/system/getty\@tty1.service.d/autologin.conf
2018-07-17 23:26:31 +02:00
echo "ExecStart=-/usr/bin/agetty --autologin $username -s %I 115200,38400,9600 vt102" >> /etc/systemd/system/getty\@tty1.service.d/autologin.conf
2018-09-03 02:08:19 +02:00
if ! [ "${version}" == "libre-xfce4-openrc" ]; then
systemctl enable getty@tty1
fi
2018-02-26 02:41:29 +01:00
fi
elif [ "$start" == "xdm" ]
then
systemctl enable xdm
elif [ "$start" == "lightdm" ]
then
systemctl enable lightdm.service
elif [ "$start" == "exit" ]
then
exit 0
else
echo "Kein Start gewählt!!!"
fi
2018-09-03 02:08:19 +02:00
if ! [ "${version}" == "libre-xfce4-openrc" ]; then
systemctl enable acpid
systemctl enable ntpd
systemctl enable avahi-daemon
systemctl enable org.cups.cupsd.service
systemctl enable sshd
systemctl enable cronie
systemctl enable systemd-timesyncd.service
echo "Bitte OpenVPN config in die /etc/openvpn/client/client.conf kopieren!!!"
if [ -f /lib/systemd/system/openvpn-client@client.service ]; then
echo "link vorhanden!"
else
ln /lib/systemd/system/openvpn-client@.service /lib/systemd/system/openvpn-client@client.service
fi
#Bei ausdokumentierung wird eine/die VPN automatisch aus der /etc/openvpn/client/client.conf gestartet!!!
#systemctl enable openvpn-client@client.service
systemctl enable fail2ban
systemctl disable dhcpcd
systemctl enable NetworkManager.service
systemctl enable bluetooth.service
systemctl enable httpd
2018-09-03 02:18:54 +02:00
else
2018-09-03 02:36:39 +02:00
rc-update add lvm boot
rc-update add dmcrypt boot
rc-update add dbus default
rc-update add alsasound default
rc-update add cronie default
rc-update add NetworkManager default
rc-update add xdm default
2018-09-03 02:33:37 +02:00
2018-09-03 02:36:39 +02:00
sed -i 's/DISPLAYMANAGER=.*$/DISPLAYMANAGER=\"lightdm\"/' /etc/conf.d/xdm
sed -i 's/keymap=.*$/keymap=\"de\"/' /etc/conf.d/keymaps
2018-09-03 02:33:37 +02:00
2018-09-03 02:57:22 +02:00
echo "agetty_options=\"--autologin user1 --noclear\"" > /etc/conf.d/agetty.tty1
2018-09-03 02:33:37 +02:00
2018-04-25 10:54:48 +02:00
fi
2018-02-26 02:41:29 +01:00
# set systemconfiguration
echo "systemconfiguration"
#
echo "LANG=de_DE.UTF-8" > /etc/locale.conf
echo "LC_COLLATE=C" >> /etc/locale.conf
echo "LANGUAGE=de_DE" >> /etc/locale.conf
#
echo "KEYMAP=de-latin1" > /etc/vconsole.conf
echo "FONT=lat9w-16" >> /etc/vconsole.conf
#
echo "de_DE.UTF-8 UTF-8" > /etc/locale.gen
echo "de_DE ISO-8859-1" >> /etc/locale.gen
echo "de_DE@euro ISO-8859-15" >> /etc/locale.gen
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
#
locale-gen
#
2018-09-03 02:18:54 +02:00
if [ -f /etc/localtime ]; then
2018-09-03 02:36:39 +02:00
rm /etc/localtime
2018-09-03 02:18:54 +02:00
fi
2018-02-26 02:41:29 +01:00
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
2018-04-25 10:54:48 +02:00
# iso_name
2018-09-03 02:18:54 +02:00
if ! [ "${version}" == "libre-xfce4-openrc" ]; then
2018-09-03 02:36:39 +02:00
echo "${repo}-${version}" > /etc/hostname
2018-09-03 02:18:54 +02:00
else
2018-09-03 02:57:22 +02:00
echo "hostname=\"${repo}-${version}\"" > /etc/conf.d/hostname
2018-09-03 02:18:54 +02:00
fi
2018-04-25 10:54:48 +02:00
# uefi-boot
cp /opt/${repo1}/uefi-boot.sh /usr/bin/uefi-boot
chmod 755 /usr/bin/uefi-boot
2018-05-12 07:11:57 +02:00
# youtube-dl
cp /opt/${repo1}/youtube-dl.sh /usr/bin/youtube-downloader
chmod 755 /usr/bin/youtube-downloader
# youtube
cp /opt/${repo1}/youtube.sh /usr/bin/youtube
chmod 755 /usr/bin/youtube
2018-08-06 14:41:51 +02:00
# youtube-pi
cp /opt/${repo1}/youtube-pi.sh /usr/bin/youtube-pi
chmod 755 /usr/bin/youtube-pi
2018-04-25 10:54:48 +02:00
# write-partitions manager
cp /opt/${repo}/write_cowspace /usr/bin/write_cowspace
chmod 755 /usr/bin/write_cowspace
# installer-/usr/bin/
cp /opt/${repo}/arch-install /usr/bin/arch-install
chmod 755 /usr/bin/arch-install
# bash.bashrc
sed "s|%OS_NAME%|${repo}|g;" /opt/${repo}/bash.bashrc > /etc/bash.bashrc
cp /opt/${repo}/.bashrc /root/
# config.fish
mkdir -p /root/.config/fish/
cp /opt/${repo}/config.fish /root/.config/fish/config.fish
# btrfs-swapfile
cp /opt/${repo}/btrfs-swapon.service /etc/systemd/system/
cp /opt/${repo}/btrfs-swapon /usr/bin/
chmod 755 /usr/bin/btrfs-swapon
cp /opt/${repo}/btrfs-swapoff /usr/bin/
chmod 755 /usr/bin/btrfs-swapoff
# ssh
cp /opt/${repo}/sshd_config /etc/ssh/sshd_config
# .Xmodmap
cp /opt/${repo}/.Xmodmap /root/
# packages
cp /opt/${repo}/packages* /etc/
# snapshot.sh
cp /opt/${repo}/snapshot.sh /usr/bin/snapshot
chmod 755 /usr/bin/snapshot
# .xscreensaver
cp /opt/${repo}/.xscreensaver /root/
# hosts
cp /opt/${repo}/hosts /etc/
# update-script
cp /opt/${repo}/update.sh /usr/bin/update-script
chmod 755 /usr/bin/update-script
# Verzeichnise
mkdir -p /root/Downloads
mkdir -p /root/Dokumente
mkdir -p /root/Bilder
mkdir -p /root/Musik
mkdir -p /root/Videos
# addusers.sh
cp /opt/${repo}/addusers.sh /usr/bin/addusers
chmod 755 /usr/bin/addusers
# shell-fish
chsh -s /usr/bin/fish root
chsh -s /usr/bin/fish ${username}
# XDG standard
cp /opt/${repo}/mimeapps.list /etc/xdg/mimeapps.list
2018-02-26 02:41:29 +01:00
2018-05-16 17:28:11 +02:00
# x11vnc-pass (password)
2018-07-10 16:19:34 +02:00
if ! [ -f "/etc/x11vnc.pass" ]; then
2018-08-26 21:41:36 +02:00
cp /opt/${repo}/x11vnc.pass /etc/x11vnc.pass
2018-07-10 16:19:34 +02:00
fi
2018-05-16 17:28:11 +02:00
2018-04-25 11:59:54 +02:00
# aurinstaller
cp /opt/${repo}/aurinstall.sh /usr/bin/aurinstaller
chmod +x /usr/bin/aurinstaller
2018-06-12 00:20:47 +02:00
cp /opt/${repo}/aurupdater.sh /usr/bin/aurupdater
chmod +x /usr/bin/aurupdater
2018-04-25 11:59:54 +02:00
2018-06-28 12:21:41 +02:00
# setcap-ping
setcap cap_net_raw+ep /bin/ping
2018-06-12 00:22:15 +02:00
2018-08-21 22:00:06 +02:00
# systemd-manjaro_update-bootloader
2018-08-22 00:33:30 +02:00
cp /opt/${repo}/update-bootloader /usr/bin/update-bootloader
2018-08-21 22:00:06 +02:00
chmod +x /usr/bin/update-bootloader
2018-08-22 00:33:30 +02:00
# update-packages
cp /opt/${repo}/update-packages /usr/bin/update-packages
chmod +x /usr/bin/update-packages
2018-08-21 22:00:06 +02:00
2018-08-24 23:54:19 +02:00
# pulseaudio
2018-08-24 23:57:06 +02:00
cp /opt/${repo}/default.pa /etc/pulse/default.pa
2018-08-24 23:54:19 +02:00
2018-08-21 22:00:06 +02:00
2018-08-26 21:41:36 +02:00
# x11vnc
if [ -f /usr/lib/systemd/system/x11vnc.service ]; then
rm /usr/lib/systemd/system/x11vnc.service
fi
if [ -f /etc/systemd/system/x11vnc.service ]; then
rm /etc/systemd/system/x11vnc.service
fi
cp /opt/${repo}/x11vnc.service /etc/systemd/system/x11vnc.service
chmod 644 /etc/systemd/system/x11vnc.service
2018-09-03 02:08:19 +02:00
if ! [ "${version}" == "libre-xfce4-openrc" ]; then
systemctl enable x11vnc.service
fi
2018-08-26 21:41:36 +02:00
# .Conky
compress restore /opt/${repo}/.Conky.tar.pxz /opt/
chmod 755 -Rv /opt/.Conky/
touch /root/notes.txt
# Vibrancy Colors
tar -vxJf /opt/${repo}/vibrancy-colors.tar.xz -C /usr/share/icons/
gtk-update-icon-cache /usr/share/icons/Vibrancy-Colors-Dark/
# santana
mkdir -p /usr/share/fonts/TTF/
tar -vxJf /opt/${repo}/santana.tar.xz -C /usr/share/fonts/TTF/
# installer
mkdir -p /usr/share/applications/
cp /opt/${repo}/arch-install.desktop /usr/share/applications/arch-install.desktop
# install-picture
mkdir -p /usr/share/pixmaps/
cp /opt/${repo}/install.png /usr/share/pixmaps/
# background
mkdir -p /usr/share/backgrounds/xfce/
cp /opt/${repo}/*.jpg /usr/share/backgrounds/xfce/
chmod 755 -Rv /usr/share/backgrounds/xfce/
# grub_background
mkdir -p /usr/share/grub/
cp /opt/${repo}/grub_background.png /usr/share/grub/background.png
2018-08-21 22:00:06 +02:00
2018-07-30 00:58:34 +02:00
# openvpn-reconnect
2018-07-31 10:54:32 +02:00
#cp /opt/${repo}/openvpn-reconnect /usr/bin/openvpn-reconnect
#chmod +x /usr/bin/openvpn-reconnect
#cp /opt/${repo}/openvpn-reconnect-systemd.sh /usr/lib/systemd/system-sleep/openvpn-reconnect-systemd.sh
#chmod +x /usr/lib/systemd/system-sleep/openvpn-reconnect-systemd.sh
2018-07-30 00:58:34 +02:00
2018-09-03 02:36:31 +02:00
if ! [ "${version}" == "libre-xfce4-openrc" ]; then
2018-09-03 02:36:39 +02:00
if [ "${version%-*-*}" != "manjaro" ]; then
su "$username" -c "aurinstaller "https://aur.archlinux.org/pamac-aur.git""
fi
if [ "${version%-*-*}" != "pi" ] && [ "${version%-*-*}" != "manjaro" ] && [ "$packageupdate" != "skip" ]; then
su "$username" -c "aurinstaller "https://aur.archlinux.org/plymouth.git""
su "$username" -c "aurinstaller "https://aur.archlinux.org/plymouth-theme-dark-arch.git""
plymouth-set-default-theme -R dark-arch
fi
su "$username" -c "aurinstaller "openvpn-reconnect""
2018-09-03 02:36:31 +02:00
fi
2018-04-25 11:59:54 +02:00
2018-02-26 02:41:29 +01:00
# nano
echo "include "/usr/share/nano/*.nanorc"" > /etc/nanorc
# htop
echo "fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=-1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
highlight_base_name=1
highlight_megabytes=1
highlight_threads=1
tree_view=1
header_margin=1
detailed_cpu_time=1
color_scheme=0
delay=15
left_meters=AllCPUs Memory Swap
left_meter_modes=1 1 1
right_meters=Tasks LoadAverage Uptime
right_meter_modes=2 2 2 " > /root/.htoprc
# ssh
mkdir -p /root/.ssh
echo "ServerAliveInterval 120" > ~/.ssh/config
echo "ServerAliveCountMax 15" >> ~/.ssh/config
2018-09-03 02:40:18 +02:00
if ! [ "${version}" == "libre-xfce4-openrc" ]; then
# Install rc.local
echo "[Unit]
2018-02-26 02:41:29 +01:00
Description=/etc/rc.local compatibility
[Service]
Type=oneshot
ExecStart=/etc/rc.local
RemainAfterExit=yes
[Install]
2018-09-03 02:40:18 +02:00
WantedBy=multi-user.target" > /etc/systemd/system/rc-local.service
touch $RCLOCAL
chmod +x $RCLOCAL
systemctl enable rc-local.service
if ! grep '#!' $RCLOCAL; then
echo "#!/bin/bash" > $RCLOCAL
fi
2018-02-26 02:41:29 +01:00
2018-09-03 02:40:18 +02:00
if ! grep 'setcap cap_net_raw+ep /bin/ping' $RCLOCAL; then
echo "setcap cap_net_raw+ep /bin/ping" >> $RCLOCAL
fi
2018-07-08 23:28:27 +02:00
2018-09-03 02:38:12 +02:00
# Install rc.shutdown
2018-05-05 00:20:09 +02:00
2018-09-03 02:38:12 +02:00
echo "[Unit]
2018-05-05 01:20:42 +02:00
Description=/etc/rc.local.shutdown Compatibility
ConditionFileIsExecutable=/etc/rc.local.shutdown
DefaultDependencies=no
After=basic.target
Before=shutdown.target
2018-05-05 00:36:28 +02:00
[Service]
Type=oneshot
ExecStart=/etc/rc.local.shutdown
2018-05-05 01:20:42 +02:00
StandardInput=tty
2018-05-05 00:36:28 +02:00
RemainAfterExit=yes
[Install]
2018-09-03 02:38:12 +02:00
WantedBy=multi-user.target" > /etc/systemd/system/rc-local-shutdown.service
touch $RCLOCALSHUTDOWN
chmod +x $RCLOCALSHUTDOWN
systemctl enable rc-local-shutdown.service
if ! grep '#!' $RCLOCALSHUTDOWN; then
echo "#!/bin/bash" > $RCLOCALSHUTDOWN
fi
2018-05-05 00:36:28 +02:00
fi
2018-09-03 02:38:12 +02:00
### custom-installer
2018-05-11 12:00:19 +02:00
2018-09-03 02:38:12 +02:00
## pip update
pip install --upgrade pip
2018-05-27 02:41:02 +02:00
2018-09-03 02:38:12 +02:00
## pip install beautysh
if [ -d /opt/beautysh ];then
echo "Bereits vorhanden!!!"
2018-04-25 11:15:02 +02:00
cd /opt/beautysh
2018-09-03 02:38:12 +02:00
git reset --hard
git pull
else
git clone https://github.com/bemeurer/beautysh /opt/beautysh
fi
cd /opt/beautysh
python ./setup.py install
if [ -f /usr/bin/beautysh ]; then
echo "Bereits vorhanden!!!"
else
ln -s /opt/beautysh/beautysh/beautysh.py /usr/bin/beautysh
fi
chmod +x /usr/bin/beautysh
cd /
2018-04-25 11:15:02 +02:00
2018-09-03 02:38:12 +02:00
pip install powerline-shell
2018-04-25 11:15:02 +02:00
2018-09-03 02:38:12 +02:00
## powerline-shell-fonts
if [ -d /opt/powerline-shell-fonts ];then
echo "Bereits vorhanden!!!"
2018-04-25 11:15:02 +02:00
cd /opt/powerline-shell-fonts
2018-09-03 02:38:12 +02:00
git reset --hard
git pull
else
git clone https://github.com/powerline/fonts.git /opt/powerline-shell-fonts
fi
cd /opt/powerline-shell-fonts
./install.sh
cd /
2018-04-25 11:15:02 +02:00
2018-09-03 02:38:12 +02:00
## uncrustify
if [ -d /opt/uncrustify ];then
echo "Bereits vorhanden!!!"
2018-04-25 11:15:02 +02:00
cd /opt/uncrustify
2018-09-03 02:38:12 +02:00
git reset --hard
git pull
else
git clone https://github.com/uncrustify/uncrustify.git /opt/uncrustify
fi
cd /opt/uncrustify
mkdir -p build
cd build
cmake ..
cmake --build .
if [ -f /usr/bin/uncrustify ]; then
echo "Bereits vorhanden!!!"
else
ln -s /opt/uncrustify/build/uncrustify /usr/bin/uncrustify
fi
chmod +x /usr/bin/uncrustify
cd /
2018-04-25 11:15:02 +02:00
2018-09-03 02:38:12 +02:00
## conky
if [ -d /opt/conky ];then
echo "Bereits vorhanden!!!"
2018-04-25 11:15:02 +02:00
cd /opt/conky
2018-09-03 02:38:12 +02:00
git reset --hard
git pull
else
git clone https://github.com/brndnmtthws/conky.git /opt/conky
fi
cd /opt/conky
cp cmake/ConkyBuildOptions.cmake .
2018-04-25 11:15:02 +02:00
2018-09-03 02:38:12 +02:00
sed "s|option(BUILD_LUA_CAIRO \"Build cairo bindings for Lua\" false)|option(BUILD_LUA_CAIRO \"Build cairo bindings for Lua\" true)|g;s|option(BUILD_LUA_IMLIB2 \"Build Imlib2 bindings for Lua\" false)|option(BUILD_LUA_IMLIB2 \"Build Imlib2 bindings for Lua\" true)|g;s|option(BUILD_LUA_RSVG \"Build rsvg bindings for Lua\" false)|option(BUILD_LUA_RSVG \"Build rsvg bindings for Lua\" true)|g" ConkyBuildOptions.cmake > cmake/ConkyBuildOptions.cmake
2018-04-25 11:15:02 +02:00
2018-09-03 02:38:12 +02:00
if [ -d build ];then
rm -Rv build
fi
mkdir -p build
cd build
cmake ..
make
make install
cd /
2018-09-03 02:39:30 +02:00
if [ "${version%-*-*}" != "lite" ] && [ "$skip" != "skip" ] && ! [ "${version}" == "libre-xfce4-openrc" ]; then
2018-04-25 11:15:02 +02:00
2018-09-03 01:21:45 +02:00
if [ "${version%-*-*}" != "pi" ] && [ "$packageupdate" != "skip" ]; then
2018-08-26 21:41:36 +02:00
# zusatzsoftware
su "$username" -c "aurinstaller "https://aur.archlinux.org/google-chrome.git""
su "$username" -c "aurinstaller spotify"
su "$username" -c "aurinstaller realvnc-vnc-viewer"
su "$username" -c "aurinstaller libbaseencode"
su "$username" -c "aurinstaller libcotp"
su "$username" -c "aurinstaller otpclient"
su "$username" -c "aurinstaller minecraft-launcher"
su "$username" -c "aurinstaller libc++"
su "$username" -c "aurinstaller discord"
2018-06-04 21:12:44 +02:00
fi
2018-05-15 12:40:00 +02:00
# install-firacode
# In download.sh
for type in Bold Light Medium Regular Retina; do
wget -O /usr/share/fonts/TTF/FiraCode-${type}.ttf \
2018-08-26 21:41:36 +02:00
"https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-${type}.ttf?raw=true";
2018-05-15 12:40:00 +02:00
done
2018-08-26 21:41:36 +02:00
echo "Kopiere Config zum User"
copyconfig
2018-05-04 22:04:58 +02:00
2018-04-25 11:15:02 +02:00
2018-08-26 21:41:36 +02:00
fi
2018-07-14 18:11:53 +02:00
2018-05-04 22:53:19 +02:00
if pacman -Qdtq; then
2018-08-26 21:41:36 +02:00
echo "Verwaiste Packete werden entfernt :)"
pacman -Rsn $(pacman -Qdtq) --noconfirm
2018-05-04 22:53:19 +02:00
else
2018-08-26 21:41:36 +02:00
echo "Es müssen keine verwaisten Packete entfernt werden :)"
2018-05-04 22:53:19 +02:00
fi
2018-07-08 23:31:48 +02:00
if [ "$packageupdate" != "skip" ]; then
2018-08-26 21:41:36 +02:00
pacman -Syu --needed --noconfirm
2018-07-08 23:31:48 +02:00
fi
2018-02-26 02:41:29 +01:00
2018-09-03 01:21:45 +02:00
if [ "${version%-*-*}" == "libre" ]; then
2018-02-26 02:41:29 +01:00
mkinitcpio -p linux-libre
else
2018-05-03 13:59:43 +02:00
mkinitcpio -P -c /etc/mkinitcpio.conf
2018-02-26 02:41:29 +01:00
fi
2018-06-04 23:33:36 +02:00
echo "Erstelle Packetverzeichnis!!!"
pacman -Qq > /pkglist.txt
echo "Aufräumen!!!"
sleep 5
pacman -Scc <<EOT
j
j
EOT
2018-02-26 02:41:29 +01:00
echo "Fertig!!!"
exit 0