1 Star 0 Fork 0

Damon Kwok/oh-my-env

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
INSTALL 19.89 KB
一键复制 编辑 原始数据 按行查看 历史
Damon Kwok 提交于 2023-09-26 13:36 . Added env checker
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
#!/usr/bin/env sh
# set -o errexit
set -o nounset
set -o pipefail
readp() {
local str=$1
read -p "$(tput setaf 14)$str$(tput sgr0)(Y/n)" input
if [ "$input" == "y" ] || [ "$input" == "Y" ] || [ "$input" == "" ]; then
return $(( 1 ));
elif [ "$input" == "n" ] || [ "$input" == "N" ]; then
return $(( 0 ));
else
echo "invalid input:$input"
readp "$1"
fi
}
title() {
echo -e $(tput setaf 6)"\n<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>"$(tput sgr0)
echo -e $(tput setaf 6)"<>\t\t\t\t"$(tput sgr0)"$1"
echo -e $(tput setaf 6)"<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>"\
$(tput sgr0)
}
tip() {
echo -e "$(tput setaf 6)\n<><><> "$(tput sgr0)"$1"$(tput setaf 6)" >"$(tput sgr0)
}
find_str() {
local str=$1
local file=$2
grep $str $file >/dev/null
if [ $? -eq 0 ]; then
# echo "found:$str"
return $(( 1 ));
else
# echo "not found:$str"
return $(( 0 ));
fi
}
host_upgrade() {
local ip=$1
local name=$2
if [ "$OME_OS" = "$OS_MSYS2" ]; then
local hostfile=/c/Windows/System32/drivers/etc/hosts
elif [ "$OME_OS" = "$OS_CYGWIN" ]; then
local hostfile=/cygdrive/c/Windows/System32/drivers/etc/hosts
else
local hostfile=/etc/hosts
fi
find_str $name $hostfile
if [ $? -eq 0 ]; then
echo "Add '$ip $name' to $hostfile"
if [ "$OME_OS" = "$OS_CYGWIN" ] || [ "$OME_OS" = "$OS_MSYS2" ]; then
echo '$ip $name' >> /etc/hosts
else
sudo sh -c "echo '$ip $name' >> /etc/hosts"
fi
#else
# echo "'$ip $name' is exist in $hostfile"
fi
}
get_os_type() {
if [ $OS_UNKNOW == $OME_OS ]; then
# $OS_UNKNOW) os_choose;;
tip "please choose your os:"
echo " 1) macOS"
echo " -------------------------"
echo " 2) Cygwin"
echo " 3) MSYS2"
echo " -------------------------"
echo " 4) ArchLinux"
echo " 5) Debian"
echo " 6) Ubuntu/LinuxMint/ElementaryOS"
echo " 7) Redhat/CentOS(yum)"
echo " 8) Fedora22+(dnf)"
echo " -------------------------"
echo " 9) FreeBSD"
echo " -------------------------"
echo " q) quit"
read -p "please enter your choice:" item
case "$item" in
"1") export OME_OS=$OS_MACOS;;
"2") export OME_OS=$OS_CYGWIN;;
"3") export OME_OS=$OS_MSYS2;;
"4") export OME_OS=$OS_ARCH;;
"5") export OME_OS=$OS_DEBIAN;;
"6") export OME_OS=$OS_UBUNTU;;
"7") export OME_OS=$OS_REDHAT;;
"8") export OME_OS=$OS_FEDORA;;
"9") export OME_OS=$OS_FREEBSD;;
esac
fi
}
ome_write_env_to_dotfile() {
local dotfile=$1
if [ -f $dotfile ]; then
find_str "oh-my-env" $dotfile
if [ $? -eq 0 ]; then
echo "" >> $dotfile
echo "# oh-my-env" >> $dotfile
echo '. $HOME/.oh-my-env/env' >> $dotfile
. $dotfile
fi
fi
}
###############################################################################
title "env loading"
# OSlist: https://git-scm.com/download/linux
# Linux
export OS_DEBIAN="Debian"
export OS_UBUNTU="Ubuntu"
export OS_REDHAT="RedHat" # Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.
export OS_FEDORA="Fedora"
export OS_ARCH="ArchLinux"
export OS_GENTOO="Gentoo"
export OS_FUNTOO="Funtoo"
export OS_EXHERBO="Exherbo"
export OS_SUSE="openSUSE"
export OS_SLACKWARE="Slackware"
export OS_NIXOS="NixOS"
export OS_ALPINE="Alpine" # musl libc| busybox https://www.linuxprobe.com/alpine-linux-released.html
export OS_VOID="VoidLinux"
export OS_MAGEIA="Mageia" # Mandriva Linux
export OS_SLITAZ="Slitaz" # busybox
export OS_GUIXSD="GuixSD"
# Unix
export OS_MACOS="macOS"
export OS_AIX="AIX"
export OS_SOLARIS="Solaris" #OpenCSW illumos(kernel):OpenIndiana SmartOS DogeOS
export OS_FREEBSD="FreeBSD"
export OS_OPENBSD="OpenBSD"
export OS_NETBSD="NetBSD"
export OS_DFBSD="DragonflyBSD"
export OS_TRUEOS="TrueOS"
# Windows
export OS_CYGWIN="Cygwin"
export OS_MSYS2="MSYS2"
# Other
export OS_ANDROID="Android"
export OS_UNKNOW="Unknow"
# PKG-list: Yum APT SUSE AUR
# Arch-list:
#https://github.com/llvm-mirror/llvm/blob/a1cdcbb384fcf1a0332b3d8b7a9240e5c3ca5a14/docs/GettingStarted.rst#local-llvm-configuration
# AArch64, AMDGPU, ARM, BPF, CppBackend, Hexagon, Mips, MSP430, NVPTX, PowerPC, Sparc, SystemZ X86, XCore
export OME_ARCH="`uname -m`"
# export OME_SHELL="`ps | grep $$ | awk '{print $4}'`"
export OME_SHELL="`basename $SHELL`"
# case "`uname -o`" in
case "`uname -s`" in
"GNU/Linux" | "Linux")
if [ "$(uname -o)" = Android ]; then
export OME_OS=$OS_ANDROID
elif [ "`command -v zypper`" != "" ]; then
export OME_OS=$OS_SUSE
elif [ "`command -v yum`" != "" ]; then
os=`cat /etc/system-release | head -n 1 | cut -d ' ' -f 1`
if [ "$os" = "CentOS" ] || [ "$os" = "RedHat" ]; then
export OME_OS=$OS_REDHAT
else
export OME_OS=$OS_FEDORA
fi
# elif [ "`command -v yum`" != "" ]; then
elif [ "`command -v nix`" != "" ]; then
export OME_OS=$OS_NIXOS
elif [ "`command -v guix`" != "" ]; then
export OME_OS=$OS_GUIXSD
elif [ "lsb_release" != "" ]; then
case "`lsb_release -is`" in
"Debian")
export OME_OS=$OS_DEBIAN;;
"Ubuntu"|"elementary"|"LinuxMint")
export OME_OS="$OS_UBUNTU";;
"ManjaroLinux"|"Arch")
export OME_OS=$OS_ARCH;;
*)
export OME_OS="`lsb_release -is`";;
esac
else
export OME_OS=$OS_UNKNOW
fi
;;
CYGWIN*) export OME_OS=$OS_CYGWIN;;
MINGW* | MSYS*) export OME_OS=$OS_MSYS2;;
FreeBSD) export OME_OS=$OS_FREEBSD;;
DragonFly) export OME_OS=$OS_DFBSD;;
NetBSD) export OME_OS=$OS_NETBSD;;
Darwin) export OME_OS=$OS_MACOS;;
*) export OME_OS=$OS_UNKNOW;;
esac
###############################################################################
title "deps init"
get_os_type
case $OME_OS in
# Linux
# $OS_DEBIAN) ;;
# $OS_UBUNTU) ;;
$OS_DEBIAN|$OS_UBUNTU)
# https://github.com/AndyYoungDev/ubuntu-aliyun-sources"
tip "use aliyun source:"
sudo curl -L https://github.com/AndyYoungDev/ubuntu-aliyun-sources/releases/download/shell/change.sh | bash
# if [ ! -f /etc/apt/sources.list.d/ubuntu-elisp-ubuntu-ppa-xenial.list ]; then
# tip "add ppa:emacs"
# sudo add-apt-repository -y ppa:ubuntu-elisp
# fi
readp "update system?"
if [ $? -eq 1 ]; then
sudo apt update
sudo apt dist-upgrade -y
fi
tip "install base tool"
sudo apt install -y git subversion wget curl make \
tar zip unzip rlwrap coreutils findutils diffutils \
net-tools ethtool ttf-bitstream-vera
readp "X mode?"
if [ $? -eq 1 ]; then
sudo apt install -y software-properties-gtk emacs
else
sudo apt install -y emacs-nox
fi
;;
# $OS_REDHAT) ;;
# $OS_FEDORA) ;;
$OS_REDHAT|$OS_FEDORA)
if [ "$OME_OS" = "$OS_REDHAT" ]; then
# RHEL 8 or compatible like CentOS
sudo dnf install -y --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf install -y --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
sudo dnf install -y --nogpgcheck https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
readp "enable raven repo?"
if [ $? -eq 1 ]; then
sudo dnf -y install https://pkgs.dyn.su/el8/base/x86_64/raven-release-1.0-1.el8.noarch.rpm
sudo dnf -y install raven-release
sudo dnf -y --enablerepo=raven-extras install tcp_wrappers-devel
fi
readp "centos:y REHL:n"
if [ $? -eq 1 ]; then
# CentOS 8 required additional step
sudo dnf config-manager --enable PowerTools
else
# RHEL 8 required additional step
sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-*-rpms"
fi
fi
readp "update system?"
if [ $? -eq 1 ]; then
sudo dnf -y update
fi
sudo dnf install -y git subversion wget curl make \
tar zip unzip rlwrap coreutils findutils diffutils \
net-tools ethtool \
emacs gnome-tweaks # wntp http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm
# sudo ln -s /usr/local/bin/ntpdate /usr/bin/ntpdate
;;
$OS_ARCH)
readp "update system?"
# if [ -n "$1" ]; then
if [ $? -eq 1 ]; then
# sudo pacman-mirrors -g
readp "pacman: use china mirror?"
if [ $? -eq 1 ]; then
sudo pacman-mirrors -c China
fi
sudo pacman -Syyu
sudo pacman -S trizen
fi
#sudo pacman -Sy opendesktop-fonts
#sudo pacman -Sy firefox
sudo pacman -Sy git subversion wget curl make \
tar zip unzip rlwrap coreutils findutils diffutils \
net-tools ethtool ttf-bitstream-vera emacs
;;
$OS_GENTOO) ;;
$OS_SUSE)
readp "SUSE: use china mirror?"
if [ $? -eq 1 ]; then
# disable old source
sudo zypper mr -da
# use new source
readp "Tumbleweed?"
if [ $? -eq 1 ]; then
# sudo zypper ar -f http://mirrors.aliyun.com/opensuse/tumbleweed/ openSUSE-Aliyun-UPDATE
sudo zypper ar http://mirrors.aliyun.com/opensuse/tumbleweed/repo/oss/ openSUSE-Aliyun-OSS
sudo zypper ar http://mirrors.aliyun.com/opensuse/tumbleweed/repo/non-oss/ openSUSE-Aliyun-NON-OSS
# sudo zypper ar -f http://mirrors.aliyun.com/opensuse/tumbleweed/repo/src-oss/ openSUSE-Aliyun-SRC-OSS
# sudo zypper ar -f http://mirrors.aliyun.com/opensuse/tumbleweed/repo/src-non-oss/ openSUSE-Aliyun-SRC-NON-OSS
# sudo zypper ar -f http://mirrors.aliyun.com/opensuse/tumbleweed/repo/debug/ aliyun-debug.repo
sudo zypper ar https://mirrors.ustc.edu.cn/packman/suse/openSUSE_Tumbleweed/ USTC:42.3:PACKMAN
else
sudo zypper ar https://mirrors.aliyun.com/opensuse/distribution/leap/\$releasever/repo/oss openSUSE-Aliyun-OSS
sudo zypper ar https://mirrors.aliyun.com/opensuse/distribution/leap/\$releasever/repo/non-oss openSUSE-Aliyun-NON-OSS
sudo zypper ar https://mirrors.aliyun.com/opensuse/update/leap/\$releasever/oss openSUSE-Aliyun-UPDATE-OSS
sudo zypper ar https://mirrors.aliyun.com/opensuse/update/leap/\$releasever/non-oss openSUSE-Aliyun-UPDATE-NON-OSS
sudo zypper ar https://mirrors.ustc.edu.cn/packman/suse/openSUSE_Leap_\$releasever/ USTC:42.3:PACKMAN
fi
fi
readp "SUSE: use 3rd repos?"
if [ $? -eq 1 ]; then
readp "Tumbleweed?"
if [ $? -eq 1 ]; then
sudo zypper addrepo https://download.nvidia.com/opensuse/tumbleweed/ nvidia
tip "add http servers repo:"
sudo zypper ar http://download.opensuse.org/repositories/server:/http/openSUSE_Tumbleweed/ http-server
tip "add database servers repo:"
sudo zypper ar http://download.opensuse.org/repositories/server:/database/openSUSE_Tumbleweed/ db-server
tip "add games repo:"
sudo zypper ar http://download.opensuse.org/repositories/games/openSUSE_Tumbleweed/ games
tip "add wine repo:"
sudo zypper ar http://download.opensuse.org/repositories/Emulators:/Wine/openSUSE_Tumbleweed/ wine
tip "add science repo:"
sudo zypper ar http://download.opensuse.org/repositories/science/openSUSE_Tumbleweed/ science
tip "add mozilla repo:"
sudo zypper ar http://download.opensuse.org/repositories/mozilla/openSUSE_Tumbleweed/ mozilla
else
tip "add http servers repo:"
sudo zypper ar http://download.opensuse.org/repositories/server:/http/openSUSE_Leap_\$releasever/ http-server
tip "add database servers repo:"
sudo zypper ar http://download.opensuse.org/repositories/server:/database/openSUSE_Leap_\$releasever/ db-server
tip "add games repo:"
sudo zypper ar http://download.opensuse.org/repositories/games/openSUSE_Leap_\$releasever/ games
tip "add wine repo:"
sudo zypper ar http://download.opensuse.org/repositories/Emulators:/Wine/openSUSE_Leap_\$releasever/ wine
tip "add science repo:"
sudo zypper ar http://download.opensuse.org/repositories/science/openSUSE_Leap_\$releasever/ science
tip "add mozilla repo:"
sudo zypper ar http://download.opensuse.org/repositories/mozilla/openSUSE_Leap_\$releasever/ mozilla
fi
fi
readp "update system?"
if [ $? -eq 1 ]; then
sudo zypper refresh
sudo zypper dup --no-allow-vendor-change
fi
sudo zypper install git subversion wget curl make \
tar zip unzip rlwrap coreutils findutils diffutils \
net-tools net-tools-lang net-tools-deprecated ethtool \
bitstream-vera-fonts emacs opi
;;
$OS_SLACKWARE) ;;
# install slapt-get
# use 163 mirror:http://mirrors.163.com/.help/slackware.html
$OS_NIXOS) ;;
$OS_VOID) ;;
$OS_ALPINE) ;;
$OS_MAGEIA) ;;
$OS_SLITAZ) ;;
$OS_GENTOO)
readp "Gentoo: select mirrors?"
if [ $? -eq 1 ]; then
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
fi
emerge --sync
emerge layman
layman -S
layman -a gentoo-zh
emerge --sync
emerge -auvDN @world
etc-update --automode -3
emerge --depclean
perl-cleaner --all
;;
$OS_FUNTOO)
readp "Funtoo: use china mirror repos?"
if [ $? -eq 1 ]; then
# echo "meta_repo_path = /var/git/meta-repo" >> /etc/ego.conf
# echo "repos_conf_path = /var/git/meta-repo" >> /etc/portage/repos.conf
if ! grep -q "sync_base_url" /etc/ego.conf; then
echo "sync_base_url = https://gitee.com/funtoo/{repo}" >> /etc/ego.conf
fi
fi
ego sync
emerge -auvDN @world
perl-cleaner --all
emerge --depclean
etc-update --automode -3
;;
$OS_EXHERBO)
cave sync
cave resolve world -c
perl-cleaner --all
etc-update --automode -3
;;
# Unix
$OS_MACOS)
echo "Install Homebrew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
# echo "Install wget & coreutils findutils"
# brew install wget
# brew install coreutils findutils
brew install git subversion wget curl make \
tar zip unzip rlwrap coreutils findutils diffutils
echo "Install font-bitstream-vera"
brew tap homebrew/cask-fonts
brew cask install font-bitstream-vera
echo "Install Emacs"
brew tap railwaycat/emacsmacport
brew cask install emacs-mac
;;
$OS_AIX) ;;
$OS_SOLARIS) ;;
$OS_FREEBSD)
tip "update pkg mirror"
mkdir -p /usr/local/etc/pkg/repos/
echo 'FreeBSD: {' > /usr/local/etc/pkg/repos/FreeBSD.conf
read -p "Are you using FreeBSD-CURRENT? [y/N]: " changed
if echo "$changed" | grep -iq "^y"; then
echo ' url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/latest",' >> /usr/local/etc/pkg/repos/FreeBSD.conf
else
echo ' url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",' >> /usr/local/etc/pkg/repos/FreeBSD.conf
fi
echo '}' >> /usr/local/etc/pkg/repos/FreeBSD.conf
pkg update -f
pkg upgrade
tip "update ports mirror"
echo "MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/\${DIST_SUBDIR}/" >> /etc/make.conf
freebsd-update fetch
freebsd-update install
pkg install git subversion wget curl gmake \
bash zip unzip rlwrap coreutils findutils diffutils \
zh-font-std bitstream-vera emacs
# tip "install mate desktop"
# sudo pkg install xorg slime mate
# sudo sh -c 'echo "moused_enable=\"YES\"" >> /etc/rc.conf'
# sudo sh -c 'echo "dbus_enable=\"YES\"" >> /etc/rc.conf'
# sudo sh -c 'echo "hald_enable=\"YES\"" >> /etc/rc.conf'
# sudo sh -c 'echo "slim_enable=\"YES\"" >> /etc/rc.conf'
# sh -c 'echo "exec mate-session" >> ~/.xinit'
# sudo user:
# /usr/local/etc/soduers
# tip "su Sorry"
# cat /etc/group
# wheel:*:0:root
# wheel:*:0:root,damon
;;
$OS_OPENBSD) ;;
$OS_NETBSD) ;;
$OS_DFBSD)
readp "update system?"
if [ $? -eq 1 ]; then
# pkg:
echo "# China, Shanghai" > /usr/local/etc/pkg/repos/sjtug.conf
echo "SJTUG: {" >> /usr/local/etc/pkg/repos/sjtug.conf
echo " url: https://mirror.sjtu.edu.cn/dragonflybsd/dports/${ABI}/LATEST," >> /usr/local/etc/pkg/repos/sjtug.conf
echo " priority: 10," >> /usr/local/etc/pkg/repos/sjtug.conf
echo " enabled: yes" >> /usr/local/etc/pkg/repos/sjtug.conf
echo '}' >> /usr/local/etc/pkg/repos/sjtug.conf
fi
sudo pkg update -f
sudo pkg upgrade
;;
# Windows
$OS_CYGWIN)
readp "upgrade apt-cyg tools?"
if [ $? -eq 1 ]; then
# 1. wget
# rm -rf /usr/bin/apt-cyg
# cd /usr/bin/
# wget https://raw.githubusercontent.com/kou1okada/apt-cyg/master/apt-cyg
# perl -pi -e 's|http://ftp.jaist.ac.jp/pub/cygwin|http://mirrors.163.com/cygwin|g' /usr/bin/apt-cyg
# cp -rf /usr/bin/apt-cyg /usr/bin/apt
# chmod +x /usr/bin/apt-cyg
# chmod +x /usr/bin/apt
# 2. git 1:
# cd $OME_PREFIX
# git clone https://github.com/kou1okada/apt-cyg.git
# ln -s "$(realpath apt-cyg/apt-cyg)" /usr/local/bin/
# cp /usr/local/bin/apt-cyg /usr/local/bin/apt
# 3. git 2:
github_upgrade kou1okada/apt-cyg $OME_PREFIX/apt-cyg
if [ ! -f "/usr/local/bin/apt-cyg" ]; then
ln -s $OME_PREFIX/apt-cyg/apt-cyg /usr/local/bin/
fi
fi
apt install python ctags git subversion wget curl make \
tar zip unzip rlwrap coreutils findutils diffutils \
xdg-utils chere emacs-w32
;;
$OS_MSYS2)
#readp "msys2: use china morrir?"
#if [ $? -eq 1 ]; then
# cp -f $OME_ROOT/conf/msys2/* /etc/pacman.d/
#fi
#readp "update system?"
#if [ $? -eq 1 ]; then
# pacman -Syyu
#fi
# pacman -Sy pacman-mirrors
#find_str "tuna.tsinghua.edu.cn" /etc/pacman.d/mirrorlist.mingw32
#if [ $? -eq 0 ]; then
# tip "mirrorlist fix"
# echo "Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686" >> /etc/pacman.d/mirrorlist.mingw32
# echo "Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64" >> /etc/pacman.d/mirrorlist.mingw64
# echo 'Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch' >> /etc/pacman.d/mirrorlist.msys
#echo "Server = https://mirrors.ustc.edu.cn/msys2/mingw/i686" >> /etc/pacman.d/mirrorlist.mingw32
# echo "Server = https://mirrors.ustc.edu.cn/msys2/mingw/x86_64" >> /etc/pacman.d/mirrorlist.mingw64
# echo 'Server = https://mirrors.ustc.edu.cn/msys2/msys/$arch' >> /etc/pacman.d/mirrorlist.msys
#else
# tip "mirrorlist is already fix"
#fi
pacman -Sy cygutils python ctags git subversion wget curl make \
tar zip unzip rlwrap coreutils findutils diffutils \
mingw-w64-x86_64-jq mingw-w64-x86_64-emacs
;;
# Other
$OS_UNKNOW) ;;
esac
###############################################################################
title "git config"
git_editor=${EDITOR:-emacs}
git config --global init.defaultBranch main
git config --global core.editor $git_editor
git config --global core.autocrlf false
git config --global core.safecrlf false
git config --global core.safecrlf warn
git config --global user.email "[email protected]"
git config --global user.name "damon-kwok"
# git config --global credential.helper 'cache --timeout=36000'
git config --global credential.helper store
git config --global color.ui true
git config --global merge.tool emacs_merge
git config --global mergetool.diffmerge.cmd "emacs_merge \$LOCAL \$BASE \$REMOTE \$MERGED"
git config --global mergetool.keepBackup false
git config --global diff.tool emacs_diff
git config --global difftool.emacs_diff.cmd "emacs_diff \"\$LOCAL\" \"\$REMOTE\""
git config --global difftool.prompt false
###############################################################################
title "OME INSTALL"
if [ ! -f "$HOME/.oh-my-env/.git/index" ]; then
read -p "Are you living in China? [y/N]: " changed
if echo "$changed" | grep -iq "^y"; then
git clone https://gitee.com/damon-kwok/oh-my-env $HOME/.oh-my-env --depth=1
git clone https://gitee.com/damon-kwok/oh-my-emacs $HOME/.oh-my-emacs --depth=1
else
git clone https://github.com/damon-kwok/oh-my-env $HOME/.oh-my-env --depth=1
git clone https://github.com/damon-kwok/oh-my-emacs $HOME/.oh-my-emacs --depth=1
fi
else
cd $HOME/.oh-my-env
git pull
fi
ome_write_env_to_dotfile $HOME/.shrc
ome_write_env_to_dotfile $HOME/.bashrc
ome_write_env_to_dotfile $HOME/.zshrc
$HOME/.oh-my-env/bin/ome pull
if [ "`uname -s`" = "GNU/Linux" ] || [ "`uname -s`" = "Linux" ]; then
sudo cp -f $HOME/.oh-my-env/conf/xsessions/* /usr/share/xsessions/
fi
bash
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/damon-kwok/oh-my-env.git
[email protected]:damon-kwok/oh-my-env.git
damon-kwok
oh-my-env
oh-my-env
main

搜索帮助