Preparing for archlinux
This commit is contained in:
		
							parent
							
								
									8d1a0e9557
								
							
						
					
					
						commit
						178ba8ae8f
					
				
							
								
								
									
										20
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								Dockerfile
									
									
									
									
									
								
							@ -1,3 +1,4 @@
 | 
			
		||||
# Test on debian
 | 
			
		||||
FROM debian:11 AS debian-user
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
@ -13,3 +14,22 @@ COPY ./tforgione.sh /home/tester/tforgione.sh
 | 
			
		||||
RUN echo "cat tforgione.sh | bash" > /home/tester/.bash_history
 | 
			
		||||
 | 
			
		||||
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"]
 | 
			
		||||
 | 
			
		||||
@ -5,4 +5,9 @@ debian() {
 | 
			
		||||
    docker container run -it debian-user bash
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
archlinux() {
 | 
			
		||||
    docker build . --tag archlinux-user --debug
 | 
			
		||||
    docker container run -it archlinux-user bash
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
"$@"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										45
									
								
								tforgione.sh
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								tforgione.sh
									
									
									
									
									
								
							@ -51,6 +51,8 @@ yes_no_ask() {
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
has_apt=0
 | 
			
		||||
has_pacman=0
 | 
			
		||||
should_install_git=0
 | 
			
		||||
should_install_zsh=0
 | 
			
		||||
should_install_dotfiles=0
 | 
			
		||||
@ -61,6 +63,25 @@ should_install_nodejs=0
 | 
			
		||||
should_install_python=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() {
 | 
			
		||||
    yes_no_ask "do you wish to install and configure dotfiles?"
 | 
			
		||||
    if [ $? -ne 0 ]; then
 | 
			
		||||
@ -135,6 +156,11 @@ ask_for_nodejs() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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?"
 | 
			
		||||
 | 
			
		||||
    if [ $? -ne 0 ]; then
 | 
			
		||||
@ -179,7 +205,7 @@ debug() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
run() {
 | 
			
		||||
    packages=()
 | 
			
		||||
    packags=()
 | 
			
		||||
    python_packages=()
 | 
			
		||||
 | 
			
		||||
    if [ $should_install_git -eq 1 ]; then
 | 
			
		||||
@ -206,7 +232,14 @@ run() {
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
    if [ $should_instlal_hyprland -eq 1 ]; then
 | 
			
		||||
@ -223,7 +256,12 @@ run() {
 | 
			
		||||
        python_packages+=(psutil)
 | 
			
		||||
    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 [ ! -d $HOME/.config/ohmyzsh ]; then
 | 
			
		||||
@ -295,6 +333,7 @@ banner() {
 | 
			
		||||
 | 
			
		||||
main() {
 | 
			
		||||
    banner
 | 
			
		||||
    find_os
 | 
			
		||||
 | 
			
		||||
    info "before anything, i need to know if your user can use sudo"
 | 
			
		||||
    yes_no_ask "can your user use sudo?"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user