# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "generic/fedora30"
  config.vm.network "private_network", ip: "192.168.50.10", virtualbox__intnet: false

 if Vagrant.has_plugin? "vagrant-vbguest"
  config.vbguest.no_install  = true
  config.vbguest.auto_update = false
  config.vbguest.no_remote   = true
end
  config.hostmanager.enabled = true
  config.hostmanager.manage_host = false
  config.hostmanager.manage_guest = true
  config.hostmanager.ignore_private_ip = false
  config.hostmanager.include_offline = true

  config.vm.network "public_network"
  config.vm.hostname = 'fedora-generic'
  config.hostmanager.aliases = %w(fedora-generic.localdomain fedora-generic.local fcg.local)

  config.vm.synced_folder ".", "/data"

  config.vm.provider "virtualbox" do |vb|
     vb.name="fedora-generic"
     vb.gui = false
     vb.memory = "3036"
     vb.cpus = 4
  end

  config.vm.provision "shell", inline: <<-SHELL
     echo "secret" | sudo passwd --stdin root
     echo "secret" | sudo passwd --stdin vagrant
     sudo cp -pr ~vagrant/.ssh /root
     sudo chown -R root.root  /root/.ssh

     sudo dnf -y update
    sudo dnf -y install telnet vim-enhanced net-tools git python python2-pip python34-PyYAML moreutils net-tools python-psutil perl-WWW-Mechanize-GZip  perl-App-cpanminus perl-List-MoreUtils  vim-enhanced unzip zip jq youtube-dl ffmpeg make mariadb psmisc PyYAML tofrodos python3 chromedriver wget
    sudo dnf -y install python34-pip moreutils net-tools python-psutil perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils  vim-enhanced unzip zip jq youtube-dl ffmpeg make mariadb psmisc PyYAML tofrodos python3 wget python-beautifulsoup4 npm rclone golang yum-utils device-mapper-persistent-data lvm2 docker

    echo "alias h='function hdi(){ howdoi \$* -c -n 5; }; hdi'" >> /tmp/util.sh
    echo "alias s=sudo" >> /tmp/util.sh
    echo "alias h=history" >> /tmp/util.sh
    echo "alias hserver='python -m http.server 8000'" >> /tmp/util.sh
    sudo cp /tmp/util.sh /etc/profile.d
    cat /tmp/util.sh

    sudo dnf install -y yum-utils device-mapper-persistent-data lvm2
    sudo dnf -y install dnf-plugins-core
    sudo dnf config-manager \
    --add-repo \
    https://download.docker.com/linux/fedora/docker-ce.repo

    sudo dnf -y install docker-ce docker-ce-cli containerd.io
    dnf list docker-ce  --showduplicates | sort -r

    sudo systemctl start docker
    sudo systemctl enable docker
    sudo usermod -aG docker vagrant
    sudo systemctl daemon-reload

    true

##########################################
# Install container
    sudo systemctl restart docker
SHELL
  config.vm.provision :hostmanager
end

