You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
147 lines
8.0 KiB
147 lines
8.0 KiB
#! /bin/bash |
|
|
|
#dialog installer that explains what will happen & create $USER, with option to cancel |
|
|
|
#some constant values used by the dialog screens to make them more legible |
|
BACK="--colors --backtitle" |
|
TITLE="\Z7Pyrenee Conversion Utility" |
|
MSG='--yes-label "OK" --msgbox' |
|
SIZE="10 75" |
|
SIZE2="20 75" |
|
|
|
dialog $BACK "$TITLE" --title "WELCOME!" $MSG "Welcome to the Pyrenee Conversion Utility.\n\nThis utility will make a number of (mostly reversible) changes to your system. It should be run directly after installing Alpine Linux 3.15, which will setup the foundation we build upon." $SIZE |
|
|
|
dialog $BACK "$TITLE" --form "Please supply the required information:\n(username can only contain small letters)" $SIZE 3 "Full Name:" 1 0 "" 1 11 60 0 " username:" 2 0 "" 2 11 60 0 2>input && FULLNAME=$(sed -n '1p' input) && USER=$(sed -n '2p' input | sed 's/[A-Z]/\L&/g') && rm -f input |
|
#Return status of non-zero indicates cancel |
|
if [ "$?" != "0" ] || [ "$USER" = "" ] || [ "$FULLNAME" = "" ] |
|
then |
|
dialog $BACK "$TITLE" $MSG "Pyrenee Conversion was canceled at your request or either field was empty.\n\nPlease restart the Pyrenee Conversion Utility." $SIZE && clear |
|
else |
|
|
|
dialog $BACK "$TITLE" --insecure --title "Password Provider" --passwordbox "Provide a password for $FULLNAME" $SIZE 2>password && PASSWORD1=$(sed -n '1p' password) && rm -f password |
|
#Return status of non-zero indicates cancel |
|
if [ "$?" != "0" ] || [ "$PASSWORD1" = "" ] |
|
then |
|
dialog $BACK "$TITLE" $MSG "Pyrenee Conversion was canceled at your request or input field was empty.\n\nPlease restart the Pyrenee Conversion Utility." $SIZE && clear |
|
else |
|
|
|
dialog $BACK "$TITLE" --insecure --title "Password Provider" --passwordbox "Confirm password for $FULLNAME" $SIZE 2>password && PASSWORD2=$(sed -n '1p' password) && rm -f password |
|
#Return status of non-zero indicates cancel |
|
if [ "$?" != "0" ] || [ "$PASSWORD2" = "" ] |
|
then |
|
dialog $BACK "$TITLE" $MSG "Pyrenee Conversion was canceled at your request or input field was empty.\n\nPlease restart the Pyrenee Conversion Utility." $SIZE && clear |
|
else |
|
|
|
if [ "$PASSWORD1" != "$PASSWORD2" ] |
|
then |
|
dialog $BACK "$TITLE" $MSG "Pyrenee Conversion was canceled because the provided passwords didn't match.\n\nPlease restart the Pyrenee Conversion Utility." $SIZE && clear |
|
else |
|
dialog $BACK "$TITLE" --title "Confirmation" --yes-label "Enter" --no-label "Esc" --yesno "This is the last opportunity to cancel the conversion.\n\nPlease press <Enter> to start conversion or <Esc> to cancel." $SIZE |
|
|
|
#Return status of non-zero indicates cancel |
|
if [ "$?" != "0" ] |
|
then |
|
dialog $BACK "$TITLE" $MSG "Pyrenee Conversion was canceled at your request." $SIZE && clear |
|
else |
|
#backup rc.conf & enable rc_parallel |
|
cp /etc/rc.conf /etc/rc.conf.bak |
|
sed -i 's/\#rc\_parallel\=\"NO\"/rc\_parallel\=\"YES\"/g' /etc/rc.conf |
|
|
|
#backup & switch repositories config file to https connection. enable community repo. |
|
cp /etc/apk/repositories /etc/apk/repositories.bak |
|
sed -i 's/http/https/g' /etc/apk/repositories |
|
sed -i 's/\# //g' /etc/apk/repositories |
|
|
|
#backup original useradd config file & switch default shell from ash to bash. |
|
# cp /etc/default/useradd /etc/default/useradd.bak |
|
# sed -i 's/ash/bash' /etc/default/useradd |
|
#add aliases to bash to ease transition to doas & make 'rm' always interactive. |
|
echo -e '#! /bin/bash\n\nalias sudo="doas"\nalias rm="rm -i"' > /etc/profile.d/aliases.sh |
|
|
|
adduser -D -g "$FULLNAME" $USER -s /bin/bash |
|
echo -e "$PASSWORD1\n$PASSWORD2" | passwd $USER |
|
|
|
apk upgrade | dialog $BACK "$TITLE" --progressbox $SIZE2 |
|
setup-xorg-base | dialog $BACK "$TITLE" --progressbox $SIZE2 |
|
apk add doas htop nano falkon flatpak plasma kde-applications-base kde-applications-accessibility pm-utils | dialog $BACK "$TITLE" --progressbox $SIZE2 |
|
#backup original doas.conf and permit group wheel and add some persistence |
|
cp /etc/doas.d/doas.conf /etc/doas.d/doas.conf.bak |
|
echo -e "permit :wheel\npermit persist :wheel" >> /etc/doas.d/doas.conf |
|
#add video driver for QEMU |
|
apk add xf86-video-modesetting xf86-video-intel | dialog $BACK "$TITLE" --progressbox $SIZE |
|
# apk add xf86-video-qxl | dialog $BACK "$TITLE" --progressbox $SIZE |
|
# echo -e 'Section "Device"\n Identifier "qxl"\n Driver "qxl"\n Option "ENABLE_SURFACES" "False"\nEndSection' > /etc/X11/xorg.conf |
|
#backup nanorc & change nanorc settings to be a bit more advanced |
|
cp /etc/nanorc /etc/nanorc.bak |
|
sed -i 's/# set atblanks/set atblanks/g' /etc/nanorc |
|
sed -i 's/# set autoindent/set autoindent/g' /etc/nanorc |
|
sed -i 's/# set indicator/set indicator/g' /etc/nanorc |
|
sed -i 's/# set jumpyscrolling/set jumpyscrolling/g' /etc/nanorc |
|
sed -i 's/# set linenumbers/set linenumbers/g' /etc/nanorc |
|
sed -i 's/# set mouse/set mouse/g' /etc/nanorc |
|
sed -i 's/# set smarthome/set smarthome/g' /etc/nanorc |
|
sed -i 's/# set softwrap/set softwrap/g' /etc/nanorc |
|
sed -i 's/# set tabsize 8/set tabsize 2/g' /etc/nanorc |
|
sed -i 's/# set tabstospaces/set tabstospaces/g' /etc/nanorc |
|
sed -i 's/# set wordbounds/set wordbounds/g' /etc/nanorc |
|
sed -i 's/# set zap/set zap/g' /etc/nanorc |
|
#set prompt colors in nano |
|
sed -i 's/# set titlecolor/set titlecolor/g' /etc/nanorc |
|
sed -i 's/# set promptcolor/set promptcolor/g' /etc/nanorc |
|
sed -i 's/# set statuscolor/set statuscolor/g' /etc/nanorc |
|
sed -i 's/# set errorcolor/set errorcolor/g' /etc/nanorc |
|
sed -i 's/# set spotlightcolor/set spotlightcolor/g' /etc/nanorc |
|
sed -i 's/# set selectedcolor/set selectedcolor/g' /etc/nanorc |
|
sed -i 's/# set stripecolor/set stripecolor/g' /etc/nanorc |
|
sed -i 's/# set scrollercolor/set scrollercolor/g' /etc/nanorc |
|
sed -i 's/# set numbercolor/set numbercolor/g' /etc/nanorc |
|
sed -i 's/# set keycolor/set keycolor/g' /etc/nanorc |
|
sed -i 's/# set functioncolor/set functioncolor/g' /etc/nanorc |
|
|
|
sed -i 's/# include \"\/usr\/share\/nano\/\*\.nanorc/include \"\/usr\/share\/nano\/\*\.nanorc/g' /etc/nanorc |
|
|
|
#add & enable Internet Wireless Device (iwd) |
|
apk add iwd |
|
rc-service iwd start |
|
cp /etc/NetworkManager/NetworkManager.conf /etc/NetworkManager/NetworkManager.conf.bak |
|
echo -e "\n[device]\nwifi.backend=iwd" >> /etc/NetworkManager/NetworkManager.conf |
|
<<COMMENT |
|
#add pipewire and its plumbing |
|
#https://wiki.alpinelinux.org/wiki/PipeWire |
|
apk add pipewire wireplumber pipewire-pulse pipewire-jack pipewire-spa-bluez |
|
mkdir /etc/pipewire |
|
cp /usr/share/pipewire/pipewire.conf /etc/pipewire/ |
|
echo '{ path = "wireplumber" args = "" }' >> /etc/pipewire/pipewire.conf |
|
modprobe snd_seq |
|
echo snd_seq >> /etc/modules |
|
COMMENT |
|
#enable Suspend on LID close |
|
mkdir /etc/acpi/LID |
|
touch /etc/acpi/LID/00000080 |
|
echo -e "#!/bin/sh\n\nexec pm-suspend" >/etc/acpi/LID/00000080 |
|
chmod +x /etc/acpi/LID/00000080 |
|
|
|
#add user to relevant groups |
|
adduser $USER audio |
|
adduser $USER disk |
|
adduser $USER flatpak |
|
adduser $USER input |
|
adduser $USER video |
|
adduser $USER wheel |
|
#add Flathub to Flatpak and install Flatseal to graphically edit permissions |
|
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo |
|
flatpak install com.github.tchx84.Flatseal -y |
|
#add sddm to OpenRC to automatically start it at boot |
|
rc-update add sddm |
|
dialog $BACK "$TITLE" --title "Finished!" --yes-label "Enter" --no-label "Esc" --yesno "Conversion was completed, it is recommended to reboot to finish your new Desktop experience!\n\nPlease press <Enter> to reboot or <Esc> to continue your current session." $SIZE |
|
if [ "$?" != "0" ] |
|
then |
|
clear |
|
else |
|
reboot now |
|
fi |
|
fi |
|
fi |
|
fi |
|
fi |
|
fi
|
|
|