This commit is contained in:
xiongdian.me 2022-12-03 20:28:16 +08:00
parent cefba82f1c
commit 4ab0472846
5 changed files with 26 additions and 18 deletions

View File

@ -149,7 +149,8 @@ uninstall_symlink()
done
}
install_crontab(){
install_crontab()
{
if [[ -x $(command -v crontab) ]]; then
fmt_note "installing \"$CRON_JOB\" to crontab ..."
( crontab -l | grep -vxF "${CRON_JOB}" | grep -v "no crontab for"; echo "$CRON_JOB" ) | crontab -
@ -158,7 +159,8 @@ install_crontab(){
fi
}
uninstall_crontab(){
uninstall_crontab()
{
if [[ -x $(command -v crontab) ]]; then
fmt_note "removing \"$CRON_JOB\" from crontab ..."
( crontab -l | grep -vxF "$CRON_JOB" ) | crontab -
@ -167,7 +169,8 @@ uninstall_crontab(){
fi
}
install_tmux_tpm(){
install_tmux_tpm()
{
TMUX_TPM="$HOME/.tmux/plugins/tpm"
if [[ -x $(command -v tmux) && ! -d "$TMUX_TPM" ]]; then
fmt_note "installing tmux tpm ..."
@ -186,7 +189,8 @@ install_tmux_tpm(){
fi
}
install_vim_vundle(){
install_vim_vundle()
{
VIM_VUNDLE="$HOME/.vim/bundle/Vundle.vim"
if [[ -x $(command -v vim) && ! -d "$VIM_VUNDLE" ]]; then
fmt_note "installing vim vundle ..."
@ -196,7 +200,8 @@ install_vim_vundle(){
fi
}
install_update(){
install_update()
{
fmt_note "installing update.sh ..."
cp "${DOTFILES}/.update.sh" "${DOTFILES}/update.sh"
chmod +x "${DOTFILES}/update.sh"
@ -208,12 +213,14 @@ install_update(){
fi
}
uninstall_update(){
uninstall_update()
{
fmt_note "removing update.sh ..."
rm "${DOTFILES}/update.sh"
}
install(){
install()
{
if [[ "$INSTALL_DEP" == "1" ]]; then install_dependencies; fi
install_update
preinstall_check
@ -227,7 +234,8 @@ install(){
fmt_note "done installing!"
}
uninstall(){
uninstall()
{
ask_for_yN "do you really want to uninstall?"
if [[ $? != 1 ]]; then
fmt_error "aborting this job ..."

View File

@ -1,20 +1,19 @@
#!/bin/bash
set -e
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
source "$THIS_DIR/common.sh"
set_mirror()
{
MIRROR=${1:-"mirrors.tuna.tsinghua.edu.cn"}
sed -i "s@dl-cdn.alpinelinux.org@$MIRROR@g" /etc/apk/repositories
sed -i "s@dl-cdn.alpinelinux.org@${MIRROR}@g" /etc/apk/repositories
}
apk_add()
{
apk update
# lite
apk add zsh bash git tmux vim curl fzf iputils coreutils util-linux
# full
if [[ -z "$DFS_LITE" ]]; then
apk add wget python3 py3-pip htop gcc g++ cmake make perl linux-headers bind-tools man-db

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
source "$THIS_DIR/common.sh"
brew_install()
{

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
source "$THIS_DIR/common.sh"
set_mirror()
{

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
source "$THIS_DIR/common.sh"
set_mirror()
{
@ -12,10 +13,8 @@ set_mirror()
apt_install()
{
apt-get update -y
# lite
apt-get install -y git zsh bash tmux vim curl inetutils-ping less bsdmainutils ca-certificates
apt-get install -y git zsh bash tmux vim curl inetutils-ping less bsdmainutils
# full
if [[ -z "$DFS_LITE" ]]; then
apt-get install wget dialog net-tools dnsutils netcat traceroute sudo python3 python3-pip cron openssh-client openssh-server htop gcc g++ cmake make zip