2011-01-26 166 views
2

我剛剛在linux(ubuntu)開發了一個opengl遊戲..現在我想編寫一個安裝腳本,它將安裝遊戲直接安裝到apt使用命令..如何爲ubuntu編寫安裝腳本

sudo apt-get install ... 

這樣它就可以從整個linux的任何地方運行而不必進入指定的遊戲文件夾。任何人都知道如何做到這一點?

回答

0
#!/bin/bash 

    set -eu -o pipefail # fail on error , debug all lines 

    sudo -n true 
    test $? -eq 0 || exit 1 "you should have sudo priveledge to run this script" 

    echo installing the must-have pre-requisites 
    while read -r p ; do sudo apt-get install -y $p ; done < <(cat << "EOF" 
     perl 
     zip unzip 
     exuberant-ctags 
     mutt 
     libxml-atom-perl 
     postgresql-9.6 
     libdbd-pgsql 
     curl 
     wget 
     libwww-curl-perl 
    EOF 
    ) 

    echo installing the nice-to-have pre-requisites 
    echo you have 5 seconds to proceed ... 
    echo or 
    echo hit Ctrl+C to quit 
    echo -e "\n" 
    sleep 6 

    sudo apt-get install -y tig