Skip to content

Commit 7442e43

Browse files
authored
Linux64 new login shell
1 parent a051841 commit 7442e43

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# 使用 lsb_release 获取系统信息
4+
os_name=$(lsb_release -si)
5+
os_version=$(lsb_release -sr)
6+
7+
# 提取主版本号副版本号
8+
major_version=$(echo $os_version | cut -d'.' -f1)
9+
minor_version=$(echo $os_version | cut -d'.' -f2)
10+
11+
# 检查是否为Ubuntu且版本大于等于24.04
12+
if [ "$os_name" == "Ubuntu" ] && [ "$major_version" -gt 24 ] || { [ "$major_version" -eq 24 ]; }; then
13+
# 要检查的文件路径
14+
file_path="./EasySpider/chrome-sandbox"
15+
16+
# 检查文件是否存在
17+
if [ ! -e "$file_path" ]; then
18+
echo "File Not Exist!"
19+
exit 1
20+
fi
21+
22+
# 获取文件的拥有者
23+
owner=$(stat -c %U "$file_path")
24+
25+
# 获取文件的权限
26+
permissions=$(stat -c %a "$file_path")
27+
28+
# 检查拥有者是否为root且权限是否为4755
29+
if [ "$owner" != "root" ] || [ "$permissions" != "4755" ]; then
30+
echo "这是你第一次在该Ubuntu系统上使用EasySpider,请在下方输入密码来调整文件权限以使用EasySpider:"
31+
echo "This is the first time you use EasySpider in this Ubuntu system, please change your permission of the software by input your password below (should have root/sudo permission):"
32+
sudo chown root:root "$file_path"
33+
sudo chmod 4755 "$file_path"
34+
sudo chown root:root "./EasySpider/resources/app/chrome_linux64/chrome-sandbox"
35+
sudo chmod 4755 "./EasySpider/resources/app/chrome_linux64/chrome-sandbox"
36+
fi
37+
else
38+
echo "如果报错“The SUID sandbox helper binary was found, but is not configured correctly”,请尝试执行以下命令后再次运行EasySpider:"
39+
echo "If you encounter the error message “The SUID sandbox helper binary was found, but is not configured correctly”, please try run the following commands and run EasySpider again:"
40+
echo ""
41+
echo "sudo chown root:root ./EasySpider/chrome-sandbox"
42+
echo "sudo chmod 4755 ./EasySpider/chrome-sandbox"
43+
echo "sudo chown root:root ./EasySpider/resources/app/chrome_linux64/chrome-sandbox"
44+
echo "sudo chmod 4755 ./EasySpider/resources/app/chrome_linux64/chrome-sandbox"
45+
echo ""
46+
echo ""
47+
fi
48+
49+
50+
./EasySpider/EasySpider

0 commit comments

Comments
 (0)