4 Star 2 Fork 0

Gitee 极速下载/emojicode

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/emojicode/emojicode
克隆/下载
install.sh 2.29 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env bash
n=$(tput sgr0)
cyan=$(tput setaf 6)
bold=$(tput bold)
r=$(tput setaf 1)
binaries=${1:-"/usr/local/bin"}
packages=${2:-"/usr/local/EmojicodePackages"}
include=${3:-"/usr/local/include/emojicode"}
self=$0
magicsudod=$4
if [[ "$magicsudod" == "magicsudod" ]]; then
echo "I’ve super user privileges now and will try to perform the installation."
else
echo "👨‍💻 Hi, I’m the Emojicode Installer!"
echo
echo "${bold}I’ll copy the ${cyan}Emojicode Compiler${n}${bold} to ${binaries}.${n}"
echo "${bold}Then I’ll copy the default packages to ${packages}.${n}"
echo "${bold}Finally, I’ll copy the Emojicode API headers to ${include}.${n}"
echo "If you prefer different locations you can rerun me and provide me with other locations like so:"
echo -e "\t ${0} [binary location] [packages location] [include location]\n"
fi
function offerSudo {
if [[ "$magicsudod" == "magicsudod" ]]; then
exit 1
fi
if [ "$EUID" -eq 0 ]; then
exit 1
fi
echo "I can try to rerun myself with sudo."
read -p "If you wish me to do so type y. ➡️ " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo ""
sudo "$self" "$binaries" "$packages" "$include" magicsudod
exit $?
fi
exit 1
}
read -p "If you want to proceed type y. ➡️ " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo
if [[ ! -w $binaries ]] ; then
echo "${r}${binaries} is not writeable from this user.${n}"
offerSudo
fi
if [[ ! -w $packages ]] ; then
pp=$(dirname "$packages")
if [[ ! -w $pp ]] ; then
echo "${r}${pp} is not writeable from this user.${n}"
offerSudo
else
if [[ ! -d $packages ]] ; then
echo "Setting up packages directory in ${packages}${n}"
mkdir -p "$packages"
else
echo "${r}${packages} is not writeable from this user.${n}"
offerSudo
fi
fi
fi
(
set -e
echo "Copying builds${n}"
cp emojicodec "$binaries/emojicodec"
chmod 755 "$binaries/emojicodec"
echo "Copying packages${n}"
rsync -rl packages/ "$packages"
rsync -rl include/ "$include"
chmod -R 755 "$packages"
)
if [ $? = 0 ]
then
tput setaf 2
echo "✅ Emojicode was successfully installed.${n}"
else
echo "${r}Installation failed. Please refer to the error above.${n}"
exit 1
fi
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/mirrors/emojicode.git
git@gitee.com:mirrors/emojicode.git
mirrors
emojicode
emojicode
master

搜索帮助