Preparing for archlinux

This commit is contained in:
Thomas Forgione 2025-05-02 22:07:00 +02:00
parent 8d1a0e9557
commit 178ba8ae8f
3 changed files with 67 additions and 3 deletions

View File

@ -1,3 +1,4 @@
# Test on debian
FROM debian:11 AS debian-user FROM debian:11 AS debian-user
RUN \ RUN \
@ -13,3 +14,22 @@ COPY ./tforgione.sh /home/tester/tforgione.sh
RUN echo "cat tforgione.sh | bash" > /home/tester/.bash_history RUN echo "cat tforgione.sh | bash" > /home/tester/.bash_history
CMD ["bash"] CMD ["bash"]
# Test on archlinux
FROM archlinux AS archlinux-user
RUN \
pacman -Sy curl --noconfirm && \
groupadd sudo && \
mkdir /etc/sudoers.d && \
echo "%sudo ALL=(ALL:ALL) ALL" > /etc/sudoers.d/sudoers && \
useradd -m tester && \
echo tester:tester | chpasswd && \
usermod -aG sudo tester
USER tester
WORKDIR /home/tester
COPY ./tforgione.sh /home/tester/tforgione.sh
RUN echo "cat tforgione.sh | bash" > /home/tester/.bash_history
CMD ["bash"]

View File

@ -5,4 +5,9 @@ debian() {
docker container run -it debian-user bash docker container run -it debian-user bash
} }
archlinux() {
docker build . --tag archlinux-user --debug
docker container run -it archlinux-user bash
}
"$@" "$@"

View File

@ -51,6 +51,8 @@ yes_no_ask() {
fi fi
} }
has_apt=0
has_pacman=0
should_install_git=0 should_install_git=0
should_install_zsh=0 should_install_zsh=0
should_install_dotfiles=0 should_install_dotfiles=0
@ -61,6 +63,25 @@ should_install_nodejs=0
should_install_python=0 should_install_python=0
should_install_hyrpland=0 should_install_hyrpland=0
find_os() {
apt --version > /dev/null 2>&1
if [ $? -eq 0 ]; then
has_apt=1
return
fi
pacman --version > /dev/null 2>&1
if [ $? -eq 0 ]; then
has_pacman=1
return
fi
error_n "os not supported"
exit 1
}
ask_for_dotfiles() { ask_for_dotfiles() {
yes_no_ask "do you wish to install and configure dotfiles?" yes_no_ask "do you wish to install and configure dotfiles?"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -135,6 +156,11 @@ ask_for_nodejs() {
} }
ask_for_hyprland() { ask_for_hyprland() {
if [ $has_pacman -ne 1 ]; then
warn_n "tforgione's installer does not support this os for setting up hyprland"
return
fi
yes_no_ask "do you wish to install and configure hyprland?" yes_no_ask "do you wish to install and configure hyprland?"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -179,7 +205,7 @@ debug() {
} }
run() { run() {
packages=() packags=()
python_packages=() python_packages=()
if [ $should_install_git -eq 1 ]; then if [ $should_install_git -eq 1 ]; then
@ -206,7 +232,14 @@ run() {
fi fi
if [ $should_install_python ]; then if [ $should_install_python ]; then
packages+=(python)
if [ $has_apt -eq 1 ]; then
packages+=(python3)
packages+=(python-is-python3)
packages+=(python3-pip)
elif [ $has_pacman ]; then
packages+=(python)
fi
fi fi
if [ $should_instlal_hyprland -eq 1 ]; then if [ $should_instlal_hyprland -eq 1 ]; then
@ -223,7 +256,12 @@ run() {
python_packages+=(psutil) python_packages+=(psutil)
fi fi
sudo apt install -y ${packages[@]}
if [ $has_apt -eq 1 ]; then
sudo apt install -y ${packages[@]}
elif [ $has_pacman -eq 1 ]; then
sudo pacman -Sy ${packages[@]} --noconfirm
fi
if [ $should_install_dotfiles -eq 1 ]; then if [ $should_install_dotfiles -eq 1 ]; then
if [ ! -d $HOME/.config/ohmyzsh ]; then if [ ! -d $HOME/.config/ohmyzsh ]; then
@ -295,6 +333,7 @@ banner() {
main() { main() {
banner banner
find_os
info "before anything, i need to know if your user can use sudo" info "before anything, i need to know if your user can use sudo"
yes_no_ask "can your user use sudo?" yes_no_ask "can your user use sudo?"