#!/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 # 2024-09-06更新 sumok="b0e6ba7e8769ba0144d80035e0936a4c" 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 "请输入相册保存绝对路径后回车(默认保存到桌面machete家庭相册): " album_path if [ -z "${album_path}" ]; then homePath=`getHomePath` album_path="${homePath}/Desktop/machete家庭相册/" 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}" createShortcuts "album" ip=`getLocalIp` echo "✅✅" echo "相册系统已成功安装,并在桌面创建了相册系统的快捷方式,可双击打开" echo "还可以在浏览器输入:http://${ip}:8181/ 打开" echo "" read -p "如果是第一次安装,需要下载演示图片吗?(Y/N): " confirm if [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]]; then downloadSamplesPhotos "${album_path}" fi echo "" echo "升级系统到最新版..." echo "⚠️⚠️" echo "如果更新最新代码时长时间无法连接源码网址,可按ctrl+c取消下载,稍后手动执行./upgrade.sh更新" echo "" upgradeMacheteInContainers "album" fi theend