85 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
exit 0 # FIXME wip
 | 
						|
 | 
						|
function do_debian_stretch_setup {
 | 
						|
    # FIXME assumes amd64
 | 
						|
    export DEBIAN_FRONTEND=noninteractive
 | 
						|
 | 
						|
    export PACKAGES="
 | 
						|
        byobu
 | 
						|
        command-not-found
 | 
						|
        dnsutils
 | 
						|
        inetutils-ping
 | 
						|
        man-db
 | 
						|
        mosh
 | 
						|
        nmap
 | 
						|
        runit
 | 
						|
        runit-systemd
 | 
						|
        wget
 | 
						|
    "
 | 
						|
 | 
						|
    sudo apt update
 | 
						|
    sudo apt install -y $PACKAGES
 | 
						|
 | 
						|
    if ! which docker 2>&1 >/dev/null ;then
 | 
						|
        sudo apt -y install \
 | 
						|
            apt-transport-https \
 | 
						|
            ca-certificates \
 | 
						|
            curl \
 | 
						|
            gnupg2 \
 | 
						|
            software-properties-common
 | 
						|
        curl -fsSL https://download.docker.com/linux/debian/gpg |
 | 
						|
            sudo apt-key add -
 | 
						|
        sudo add-apt-repository \
 | 
						|
            "deb [arch=amd64] https://download.docker.com/linux/debian \
 | 
						|
            $(lsb_release -cs) \
 | 
						|
            stable"
 | 
						|
        sudo apt update
 | 
						|
        sudo apt install -y docker-ce
 | 
						|
    fi
 | 
						|
}
 | 
						|
 | 
						|
function do_osx_setup {
 | 
						|
    cc
 | 
						|
 | 
						|
    if [[ ! -d "$HOME/tmp" ]]; then
 | 
						|
        mkdir "$HOME/tmp"
 | 
						|
    fi
 | 
						|
 | 
						|
    if [[ ! -d "$HOME/tmp/osximage" ]]; then
 | 
						|
        git clone https://github.com/sneak/osximage.git "$HOME/tmp/osximage.tmp" && \
 | 
						|
        mv "$HOME/tmp/osximage.tmp" "$HOME/tmp/osximage"
 | 
						|
    fi
 | 
						|
 | 
						|
    if [[ -d "$HOME/tmp/osximage" ]]; then
 | 
						|
        cd "$HOME/tmp/osximage/custompkg/root/etc/skel"
 | 
						|
        if [[ ! -d /etc/skel ]]; then
 | 
						|
	    sudo rsync -avP ./ /etc/skel/
 | 
						|
        fi
 | 
						|
        if [[ -d /etc/skel ]]; then
 | 
						|
	    rsync -avP /etc/skel/ "$HOME"
 | 
						|
        fi
 | 
						|
    fi
 | 
						|
 | 
						|
    for FN in $HOME/Library/user-setup/*.sh ; do
 | 
						|
        echo "new-user-setup: starting $(basename $FN)..."
 | 
						|
        bash "$FN" 2>&1 | tee -a $HOME/Library/Logs/user-setup.log
 | 
						|
        rm "$FN"
 | 
						|
        echo "new-user-setup: removed $(basename $FN)..."
 | 
						|
    done
 | 
						|
}
 | 
						|
 | 
						|
function do_setup {
 | 
						|
 | 
						|
    if [[ "$(lsb_release -c -s)" = "stretch" ]]; then
 | 
						|
        do_debian_stretch_setup
 | 
						|
    fi
 | 
						|
 | 
						|
    if [[ "$(uname)" = "Darwin" ]]; then
 | 
						|
        if [[ ! -e "$HOME/Library/profile.d" ]]; then
 | 
						|
            do_osx_setup
 | 
						|
        fi
 | 
						|
    fi
 | 
						|
}
 |