diff --git a/install.sh b/install.sh index d6e8b37..b0a0ab4 100755 --- a/install.sh +++ b/install.sh @@ -10,6 +10,7 @@ welcome () { echo "" } +# 显示结束语 theend () { echo "" echo "==感谢使用machete_installer==" @@ -19,6 +20,20 @@ theend () { echo "" } +# 获取用户桌面绝对路径 +getHomePath () { + cd ~/ + path=`pwd` + cd - + echo $path +} + +# 获取本地局域网ip地址 +getLocalIp () { + ipstr=`ifconfig -a | grep -v grep | grep '192.168'` + echo "${ipstr}" | cut -d ' ' -f 2 +} + # 获取mac mini的cpu芯片型号信息 getCpuInfo () { cpu_info=`sysctl -n machdep.cpu.brand_string` @@ -123,7 +138,8 @@ dockerStartAlbumContainer () { album_name="machete_album" fi if [ -z "${album_path}" ]; then - album_path="~/Desktop/Album_by_filesite" + homePath=`getHomePath` + album_path="${homePath}/Album_by_filesite" fi docker run --name "${album_name}" \ @@ -143,7 +159,8 @@ dockerStartVideoContainer () { blog_name="machete_videos" fi if [ -z "${blog_path}" ]; then - blog_path="~/Desktop/Videos_by_filesite" + homePath=`getHomePath` + blog_path="${homePath}/Videos_by_filesite" fi docker run --name "${blog_name}" \ @@ -209,12 +226,6 @@ downloadDockerDesktop () { open "${link}" } -# 获取本地局域网ip地址 -getLocalIp () { - ipstr=`ifconfig -a | grep -v grep | grep '192.168'` - echo "${ipstr}" | cut -d ' ' -f 2 -} - # 创建桌面快捷方式 createShortcuts () { ip=`getLocalIp` @@ -316,9 +327,10 @@ containerName="machete_album" detectDockerContainerExists "${containerName}" containerExist=$? if [ $containerExist -eq 0 ]; then - read -p "请输入相册保存路径后回车(默认保存到桌面~/Desktop/Album_by_filesite): " album_path + read -p "请输入相册保存绝对路径后回车(默认保存到桌面Album_by_filesite): " album_path if [ -z "${album_path}" ]; then - album_path="~/Desktop/Album_by_filesite" + homePath=`getHomePath` + album_path="${homePath}/Album_by_filesite" fi if [ ! -d "${album_path}" ]; then @@ -350,9 +362,10 @@ containerName="machete_vlog" detectDockerContainerExists "${containerName}" containerExist=$? if [ $containerExist -eq 0 ]; then - read -p "请输入视频保存路径后回车(默认保存到桌面~/Desktop/Videos_by_filesite): " vlog_path + read -p "请输入视频保存绝对路径后回车(默认保存到桌面Videos_by_filesite): " vlog_path if [ -z "${vlog_path}" ]; then - vlog_path="~/Desktop/Videos_by_filesite" + homePath=`getHomePath` + vlog_path="${homePath}/Videos_by_filesite" fi if [ ! -d "${vlog_path}" ]; then