#!/bin/sh # 引入公用方法 . ./funs.sh # ===== 安装docker desktop和machete ===== welcome detectDockerInstalled docker_installed=$? if [ $docker_installed -eq 0 ]; then getCpuInfo detect_domain='desktop.docker.com' echo "正在检测是否能连接[${detect_domain}],请稍后..." detectDomainCanConnect "${detect_domain}" connect_res=$? if [ $connect_res -eq 0 ]; then echo "⚠️⚠️" echo "当前网络无法连接[${detect_domain}],即将从备用网址下载docker desktop,预计耗时 30 分钟" echo "如果你已经下载过docker desktop,请复制到当前电脑直接安装" read -p "确认继续下载?(Y/N): " confirm if [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]]; then link=`getDockerDesktopDownloadUrl $connect_res` downloadDockerDesktop "${link}" fi fi echo "" echo "如果你已经安装完成,请按Y继续安装machete镜像" read -p "docker desktop已安装,继续?(Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1 detectDockerInstalled docker_installed=$? if [ $docker_installed -eq 0 ]; then echo "⚠️⚠️⚠️" echo "命令行检测不到docker,请确认docker desktop已经安装" echo "如果docker desktop已经安装,请关闭当前termina窗口重新打开命令行终端窗口,重新执行此安装脚本" echo "" exit 1 fi fi detectDockerStarted docker_started=$? if [ $docker_started -eq 0 ]; then echo "⚠️⚠️" echo "请双击docker图标启动docker desktop,再继续下一步" read -p "已经启动docker desktop,继续安装?(Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1 fi echo "" echo "正在为你安装machete镜像..." echo "" detectDockerImageExists "filesite/machete" imgExist=$? if [ $imgExist -eq 0 ]; then if [ ! -f ./machete.tar ]; then echo "下载machete的docker镜像,文件大小89M,预计需要 5 - 10 分钟..." curl -o machete.tar "https://static.jialuoma.cn/docker_images/machete.tar" fi if [ -f ./machete.tar ]; then sumok="eacbdfb33873e79d1eccca7fa2d0706a" checkRes=`md5 machete.tar | grep -v grep | grep "${sumok}" | wc -l` if [ $checkRes -gt 0 ]; then echo "machete的docker镜像下载完成,即将导入docker" docker image load --input machete.tar # 再次确认image下载成功 detectDockerImageExists "filesite/machete" imgExist=$? if [ $imgExist -eq 0 ]; then echo "⚠️⚠️" echo "machete的docker镜像导入失败,请检查网络后重试" echo "" exit 1 else echo "machete的docker镜像导入完成,即将开始安装相册和视频系统" fi fi fi fi echo "" echo "开始安装相册系统..." containerName="machete_album" detectDockerContainerExists "${containerName}" containerExist=$? if [ $containerExist -eq 0 ]; then read -p "请输入相册保存绝对路径后回车(默认保存到桌面Album_by_filesite): " album_path if [ -z "${album_path}" ]; then homePath=`getHomePath` album_path="${homePath}/Desktop/Album_by_filesite" fi if [ ! -d "${album_path}" ]; then read -p "目录【${album_path}】不存在,确认创建此目录继续安装吗?(Y/N): " confirm if [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]]; then mkdir -p "${album_path}" echo "目录【${album_path}】不存在,已帮你创建" else echo "⚠️⚠️" echo "安装已取消,如需继续安装,请重新执行本安装脚本" echo "" exit 1 fi fi echo "启动相册容器中..." dockerStartAlbumContainer "${containerName}" "${album_path}" docker ps | grep "${containerName}" echo "升级系统到最新版..." upgradeMacheteInContainers "album" downloadSamplesPhotos "${album_path}" createShortcuts "album" ip=`getLocalIp` echo "✅✅" echo "相册系统已成功安装,并在桌面创建了相册系统的快捷方式,可双击打开" echo "还可以在浏览器输入:http://${ip}:8181/ 打开" fi theend