2024-09-23 13:22:40 +08:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
declare path
|
|
|
|
|
echo "请输入脚本的安装位置"
|
|
|
|
|
read -p "默认 /var/script:" path
|
|
|
|
|
if [[ -z $path ]];then
|
|
|
|
|
path="/var/script"
|
|
|
|
|
fi
|
2024-09-23 15:02:29 +08:00
|
|
|
|
echo "软件正在安装中"
|
2024-09-23 13:22:40 +08:00
|
|
|
|
|
2024-09-23 13:27:20 +08:00
|
|
|
|
mkdir -p "$path"
|
2024-09-23 17:07:33 +08:00
|
|
|
|
rm -rf "$path/linuxtool"
|
2024-09-23 13:22:40 +08:00
|
|
|
|
|
2024-09-23 17:21:02 +08:00
|
|
|
|
wget https://g.lsy22.com/lsy/linuxtool/archive/master.tar.gz -O "${path}/aa" &> /dev/null
|
2024-09-23 14:57:22 +08:00
|
|
|
|
|
|
|
|
|
if [[ -d "${path}/aa" ]];then
|
|
|
|
|
echo "脚本下载失败"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
tar -zxf "$path/aa" -C $path &> /dev/null
|
2024-09-23 13:22:40 +08:00
|
|
|
|
rm "$path/aa"
|
2024-09-23 14:57:22 +08:00
|
|
|
|
chmod +x "$path/linuxtool/Run.sh" &> /dev/null
|
2024-09-23 13:22:40 +08:00
|
|
|
|
|
2024-09-23 13:34:53 +08:00
|
|
|
|
sed -i '/alias tool.*/d' "${HOME}/.bashrc"
|
2024-09-23 13:43:09 +08:00
|
|
|
|
echo "alias tool='$path/linuxtool/Run.sh'" | cat >> "${HOME}/.bashrc"
|
|
|
|
|
source "${HOME}/.bashrc"
|
2024-09-23 17:02:52 +08:00
|
|
|
|
|
|
|
|
|
sed -i '/alias tool.*/d' "${HOME}/.profile"
|
|
|
|
|
echo "alias tool='$path/linuxtool/Run.sh'" | cat >> "${HOME}/.profile"
|
|
|
|
|
source "${HOME}/.profile"
|
|
|
|
|
|
2024-09-23 13:43:09 +08:00
|
|
|
|
echo "工具箱已经安装成功"
|
|
|
|
|
echo "位置:${path}/linuxtool"
|
|
|
|
|
echo "命令:tool"
|