Working
This commit is contained in:
		
							parent
							
								
									235e2b7402
								
							
						
					
					
						commit
						70838875e6
					
				
							
								
								
									
										17
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								Dockerfile
									
									
									
									
									
								
							@ -15,6 +15,23 @@ RUN echo "cat tforgione.sh | bash" > /home/tester/.bash_history
 | 
			
		||||
 | 
			
		||||
CMD ["bash"]
 | 
			
		||||
 | 
			
		||||
# Test on ubuntu
 | 
			
		||||
FROM ubuntu:24.04 AS ubuntu-user
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
    apt update -y && \
 | 
			
		||||
    apt install sudo curl -y && \
 | 
			
		||||
    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"]
 | 
			
		||||
 | 
			
		||||
# Test on archlinux
 | 
			
		||||
FROM archlinux AS archlinux-user
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,6 +5,11 @@ debian() {
 | 
			
		||||
    docker container run -it debian-user bash
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ubuntu() {
 | 
			
		||||
    docker build . --tag ubuntu-user --target ubuntu-user --debug
 | 
			
		||||
    docker container run -it ubuntu-user bash
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
archlinux() {
 | 
			
		||||
    docker build . --tag archlinux-user --target archlinux-user --debug
 | 
			
		||||
    docker container run -it archlinux-user bash
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										100
									
								
								tforgione.sh
									
									
									
									
									
								
							
							
						
						
									
										100
									
								
								tforgione.sh
									
									
									
									
									
								
							@ -61,7 +61,7 @@ should_install_neovim=0
 | 
			
		||||
should_install_rust=0
 | 
			
		||||
should_install_nodejs=0
 | 
			
		||||
should_install_python=0
 | 
			
		||||
should_install_hyrpland=0
 | 
			
		||||
should_install_hyprland=0
 | 
			
		||||
 | 
			
		||||
find_os() {
 | 
			
		||||
    apt --version > /dev/null 2>&1
 | 
			
		||||
@ -205,9 +205,8 @@ debug() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
run() {
 | 
			
		||||
    packags=()
 | 
			
		||||
    python_packages=(pip)
 | 
			
		||||
    python_packages+=(venv)
 | 
			
		||||
    packages=()
 | 
			
		||||
    python_packages=()
 | 
			
		||||
 | 
			
		||||
    if [ $should_install_git -eq 1 ]; then
 | 
			
		||||
        packages+=(git)
 | 
			
		||||
@ -217,28 +216,22 @@ run() {
 | 
			
		||||
        packages+=(zsh)
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [ $should_install_dotfiles -eq 1 ]; then
 | 
			
		||||
        packages+=(neovim)
 | 
			
		||||
    if [ $should_install_neovim -eq 1 ]; then
 | 
			
		||||
        if [ $has_pacman -eq 1 ]; then
 | 
			
		||||
            packages+=(neovim)
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [ $should_install_nodejs -eq 1 ]; then
 | 
			
		||||
        packages+=(nodejs)
 | 
			
		||||
        packages+=(npm)
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [ $should_install_rust -eq 1 ]; then
 | 
			
		||||
        if [ $has_apt -eq 1 ]; then
 | 
			
		||||
            packages+=(build-essential)
 | 
			
		||||
            packages+=(pkg-config)
 | 
			
		||||
            packages+=(libssl-dev)
 | 
			
		||||
        elif [ $has_pacman -eq 1 ]; then
 | 
			
		||||
            packages+=(base)
 | 
			
		||||
            packages+=(base-devel)
 | 
			
		||||
        if [ $has_pacman -eq 1 ]; then
 | 
			
		||||
            packages+=(npm)
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [ $should_install_python ]; then
 | 
			
		||||
 | 
			
		||||
        # Install python
 | 
			
		||||
        if [ $has_apt -eq 1 ]; then
 | 
			
		||||
            packages+=(python3)
 | 
			
		||||
            packages+=(python-is-python3)
 | 
			
		||||
@ -246,9 +239,13 @@ run() {
 | 
			
		||||
            packages+=(python3-venv)
 | 
			
		||||
        elif [ $has_pacman -eq 1 ]; then
 | 
			
		||||
            packages+=(python)
 | 
			
		||||
            packages+=(python-venv)
 | 
			
		||||
        fi
 | 
			
		||||
 | 
			
		||||
        # Install some python plugins that work well with neovim if necessary
 | 
			
		||||
        if [ $should_install_neovim -eq 1 ]; then
 | 
			
		||||
            python_packages+=(pycodestyle)
 | 
			
		||||
            python_packages+=("python-lsp-server[all]")
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [ $should_install_hyprland -eq 1 ]; then
 | 
			
		||||
@ -265,13 +262,35 @@ run() {
 | 
			
		||||
        python_packages+=(psutil)
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Add apt repository for recent nodejs for debian
 | 
			
		||||
    if [ $should_install_nodejs -eq 1 ] && [ $has_apt -eq 1 ]; then
 | 
			
		||||
        curl -fsSL https://deb.nodesource.com/setup_current.x | sudo bash
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [ $has_apt -eq 1 ]; then
 | 
			
		||||
        sudo apt install -y ${packages[@]}
 | 
			
		||||
 | 
			
		||||
        if [ $should_install_neovim ]; then
 | 
			
		||||
            # Install neovim from github to get latest version
 | 
			
		||||
            curl -L https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.tar.gz -o tmp.tar.gz
 | 
			
		||||
            sudo tar xf tmp.tar.gz -C / --strip-components=1
 | 
			
		||||
            rm tmp.tar.gz
 | 
			
		||||
        fi
 | 
			
		||||
    elif [ $has_pacman -eq 1 ]; then
 | 
			
		||||
        sudo pacman -Sy ${packages[@]} --noconfirm
 | 
			
		||||
        sudo pacman -Sy ${packages[@]} --noconfirm --needed
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [ $should_install_dotfiles ]; then
 | 
			
		||||
        sudo chsh $USER -s /bin/zsh
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Prepare venv for python
 | 
			
		||||
    if [ $should_install_python -eq 1 ]; then
 | 
			
		||||
        python -m venv $HOME/.venv
 | 
			
		||||
        VIRTUAL_ENV=$HOME/.venv $HOME/.venv/bin/pip install ${python_packages[@]}
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Configure dotfiles
 | 
			
		||||
    if [ $should_install_dotfiles -eq 1 ]; then
 | 
			
		||||
        if [ ! -d $HOME/.config/ohmyzsh ]; then
 | 
			
		||||
            git clone https://github.com/ohmyzsh/ohmyzsh $HOME/.config/ohmyzsh
 | 
			
		||||
@ -279,11 +298,9 @@ run() {
 | 
			
		||||
        if [ ! -d $HOME/.config/dotfiles ]; then
 | 
			
		||||
            git clone https://gitea.tforgione.fr/tforgione/dotfiles $HOME/.config/dotfiles
 | 
			
		||||
        fi
 | 
			
		||||
        sudo chsh $USER -s /bin/zsh
 | 
			
		||||
 | 
			
		||||
        ln -s $HOME/.config/dotfiles/zshrc $HOME/.zshrc
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        if [ $should_install_update_remainder -eq 1 ]; then
 | 
			
		||||
 | 
			
		||||
            echo "# Checks that the update is done weekly, if its not done, prints a nice message" >> $HOME/.config/dotfiles/zsh/extraconfig.zsh
 | 
			
		||||
@ -295,14 +312,16 @@ run() {
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [ $should_install_nodejs -eq 1 ]; then
 | 
			
		||||
        mkdir -p $HOME/.npmbin
 | 
			
		||||
        npm config set prefix $HOME/.npmbin
 | 
			
		||||
        npm install -g npm
 | 
			
		||||
        sudo apt purge npm -y
 | 
			
		||||
        sudo apt autoremove -y
 | 
			
		||||
    # Configure hyprland
 | 
			
		||||
    if [ $should_install_hyprland -eq 1 ]; then
 | 
			
		||||
        ln -s $HOME/.config/dotfiles/hypr $HOME/.config/hypr
 | 
			
		||||
        ln -s $HOME/.config/dotfiles/hypr/waybar $HOME/.config/waybar
 | 
			
		||||
 | 
			
		||||
        touch $HOME/.config/dotfiles/hypr/exec-once.conf
 | 
			
		||||
        touch $HOME/.config/dotfiles/hypr/monitors.conf
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Configure neovim
 | 
			
		||||
    if [ $should_install_neovim -eq 1 ]; then
 | 
			
		||||
        # Create config files an directories
 | 
			
		||||
        mkdir -p $HOME/.nvim/backups $HOME/.nvim/swp $HOME/.nvim/undo
 | 
			
		||||
@ -317,11 +336,18 @@ run() {
 | 
			
		||||
        nvim +PlugInstall +qa
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Configure nodejs
 | 
			
		||||
    if [ $should_install_nodejs -eq 1 ]; then
 | 
			
		||||
        mkdir -p $HOME/.npmbin
 | 
			
		||||
        npm config set prefix $HOME/.npmbin
 | 
			
		||||
        npm install -g npm
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Configure rust
 | 
			
		||||
    if [ $should_install_rust -eq 1 ]; then
 | 
			
		||||
        curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path -y
 | 
			
		||||
        export PATH=$HOME/.cargo/bin:$PATH
 | 
			
		||||
        rustup component add rust-analyzer
 | 
			
		||||
        cargo install cargo-update
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -340,6 +366,21 @@ banner() {
 | 
			
		||||
    echo -e "└───────────────────────────────────────────────────────────────────────────────────────────┘\x1b[0m"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ending_banner() {
 | 
			
		||||
    echo -e "\x1b[32;1m┌───────────────────────────────────────────────────────────────────────────────────────────┐"
 | 
			
		||||
    echo "│    _    __                _                  _       _           _        _ _             │"
 | 
			
		||||
    echo "│   | |  / _|              (_)                ( )     (_)         | |      | | |            │"
 | 
			
		||||
    echo "│   | |_| |_ ___  _ __ __ _ _  ___  _ __   ___|/ ___   _ _ __  ___| |_ __ _| | | ___ _ __   │"
 | 
			
		||||
    echo "│   | __|  _/ _ \| '__/ _\` | |/ _ \| '_ \ / _ \ / __| | | '_ \/ __| __/ _\` | | |/ _ \ '__|  │"
 | 
			
		||||
    echo "│   | |_| || (_) | | | (_| | | (_) | | | |  __/ \__ \ | | | | \__ \ || (_| | | |  __/ |     │"
 | 
			
		||||
    echo "│    \__|_| \___/|_|  \__, |_|\___/|_| |_|\___| |___/ |_|_| |_|___/\__\__,_|_|_|\___|_|     │"
 | 
			
		||||
    echo "│                      __/ |                                                                │"
 | 
			
		||||
    echo "│                     |___/                                                                 │"
 | 
			
		||||
    echo "├───────────────────────────────────────────────────────────────────────────────────────────┤"
 | 
			
		||||
    echo "│                      TFORGIONE'S DOTFILES INSTALLED! HAVE A GREAT DAY!                    │"
 | 
			
		||||
    echo -e "└───────────────────────────────────────────────────────────────────────────────────────────┘\x1b[0m"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
main() {
 | 
			
		||||
    banner
 | 
			
		||||
    find_os
 | 
			
		||||
@ -351,11 +392,14 @@ main() {
 | 
			
		||||
    ask_for_dotfiles
 | 
			
		||||
    ask_for_neovim
 | 
			
		||||
    ask_for_rust
 | 
			
		||||
    ask_for_python
 | 
			
		||||
    ask_for_nodejs
 | 
			
		||||
    ask_for_hyprland
 | 
			
		||||
 | 
			
		||||
    debug
 | 
			
		||||
    run
 | 
			
		||||
 | 
			
		||||
    ending_banner
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
main < /dev/tty
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user