-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
leleliu008
committed
Oct 17, 2019
1 parent
cb16add
commit db7de80
Showing
25 changed files
with
1,425 additions
and
1,019 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,68 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
[ `whoami` == "root" ] || role=sudo | ||
[ "$(whoami)" = "root" ] || sudo=sudo | ||
|
||
Color_Purple='\033[0;35m' # Purple | ||
Color_Off='\033[0m' # Reset | ||
|
||
msg() { | ||
printf "%b\n" "$1" | ||
} | ||
|
||
info() { | ||
msg "${Color_Purple}[❉]${Color_Off} $1$2" | ||
} | ||
|
||
# GNUstep的v1版(不支持Objectie-C 2.0) | ||
function installViaApt() { | ||
$role apt-get -y update && \ | ||
$role apt-get -y install make gobjc gnustep gnustep-devel && \ | ||
$role bash /usr/share/GNUstep/Makefiles/GNUstep.sh | ||
installViaApt() { | ||
$sudo apt-get -y update && | ||
$sudo apt-get -y install bash make gobjc gnustep gnustep-devel && | ||
$sudo sh /usr/share/GNUstep/Makefiles/GNUstep.sh | ||
} | ||
|
||
URL=http://ftpmain.gnustep.org/pub/gnustep/core/gnustep-startup-0.32.0.tar.gz | ||
FILENAME=$(basename "$URL") | ||
|
||
downloadIfNeed() { | ||
[ -f "$FILENAME" ] && tar -tf "$FILENAME" > /dev/null 2>&1 && return 0 | ||
info "Downloading $URL" | ||
curl -C - -LO "$URL" | ||
} | ||
|
||
setEnv() { | ||
str=". /usr/GNUstep/System/Library/Makefiles/GNUstep.sh" | ||
[ -f "$1" ] && grep "$str" "$1" || return 0 | ||
printf "%s\n" "$str" "$1" | ||
} | ||
|
||
# GNUstep的v1版(不支持Objectie-C 2.0) | ||
function installViaYum() { | ||
$role yum -y update && \ | ||
$role yum -y install make gcc gcc-objc libobjc libjpeg libjpeg-devel libpng libpng-devel libtiff libtiff-devel libxml2 libxml2-devel libX11-devel libXt-devel libxslt libxslt-devel libicu libicu-devel gnutls gnutls-devel | ||
curl -C - -L -O http://ftpmain.gnustep.org/pub/gnustep/core/gnustep-startup-0.32.0.tar.gz && \ | ||
tar zvxf gnustep-startup-0.32.0.tar.gz && \ | ||
cd gnustep-startup-0.32.0 && \ | ||
./configure && \ | ||
echo -e "\n" | make && \ | ||
$role bash /usr/GNUstep/System/Library/Makefiles/GNUstep.sh | ||
installViaYum() { | ||
$sudo yum -y update && | ||
$sudo yum -y install bash which make gcc gcc-objc libobjc libjpeg libjpeg-devel libpng libpng-devel libtiff libtiff-devel libxml2 libxml2-devel libX11-devel libXt-devel libxslt libxslt-devel libicu libicu-devel gnutls gnutls-devel libffi-devel | ||
downloadIfNeed && | ||
tar zvxf "$FILENAME" && | ||
cd "$(basename "$FILENAME" .tar.gz)" && | ||
info "Installing ..." && | ||
./configure && | ||
printf "\n\n" | make && | ||
$sudo sh /usr/GNUstep/System/Library/Makefiles/GNUstep.sh | ||
setEnv "$HOME/.bashrc" | ||
setEnv "$HOME/.zshrc" | ||
} | ||
|
||
function main() { | ||
[ "`uname -s`" == "Darwin" ] && { | ||
echo "your os is Darwin, not GNU/Linux"; | ||
exit 1 | ||
main() { | ||
command -v apt-get > /dev/null && { | ||
installViaApt | ||
exit | ||
} | ||
|
||
command -v apt-get &> /dev/null && (installViaApt; exit) | ||
|
||
command -v yum &> /dev/null && (installViaYum; exit) | ||
command -v yum > /dev/null && { | ||
installViaYum | ||
exit | ||
} | ||
|
||
info "not support your os."; | ||
exit 1 | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.