[Share Experiences] 【deepin 20.6】我的 Deepin 初始化脚本(持续更新)
Tofloor
poster avatar
deepin-superuser
deepin
2021-12-08 19:04
Author

最近经常折腾系统,有时候会把系统搞崩溃,重装完成后需要进行大量设置,费时费力。这个脚本的目的是一键进行设置,解放双手,欢迎大家添砖加瓦

最后更新时间:2022-06-07

目前进度:

任务 进度
卸载安装常用软件 100%
系统配置(控制中心设置) 70%
系统应用配置(文件管理器、编辑器等) 0%
用户应用配置(Chrome、VSCode等) 0%

未来期望:开发一款初始化脚本生成工具,人人都可以定制自己个人的初始化脚本,不像这个一样,太个性化

食用方法(搭配 《我的deepin变形记》 食用效果更佳)

wget https://raw.githubusercontent.com/kt286/deepin-init/master/deepin-init.sh
chmod +x deepin-init.sh
sh deepin-init.sh

以下为脚本原文及注释

#!/bin/bash

#先进到用户下载目录
cd ~/Downloads

# 关闭控制中心自动更新
busctl call com.deepin.lastore /com/deepin/lastore com.deepin.lastore.Updater SetAutoCheckUpdates b 0
busctl call com.deepin.lastore /com/deepin/lastore com.deepin.lastore.Updater SetAutoDownloadUpdates b 0
busctl call com.deepin.lastore /com/deepin/lastore com.deepin.lastore.Updater SetUpdateNotify b 0
busctl call com.deepin.lastore /com/deepin/lastore com.deepin.lastore.Manager SetAutoClean b 0

# 系统设置
gsettings set com.deepin.xsettings dtk-window-radius 8  # 窗口圆角-中

gsettings set com.deepin.dde.dock display-mode 'efficient'  # dock-高效模式
gsettings set com.deepin.dde.dock window-size-efficient 46  # dock-高度增加

busctl --user call com.deepin.dde.Dock /com/deepin/dde/Dock com.deepin.dde.Dock setPluginVisible sb '显示桌面' false  # dock-禁用显示桌面插件
busctl --user call com.deepin.dde.Dock /com/deepin/dde/Dock com.deepin.dde.Dock setPluginVisible sb '屏幕键盘' false  # dock-禁用屏幕键盘插件
busctl --user call com.deepin.dde.Dock /com/deepin/dde/Dock com.deepin.dde.Dock setPluginVisible sb '多任务视图' false  # dock-禁用多任务窗口插件
busctl --user call com.deepin.dde.Dock /com/deepin/dde/Dock com.deepin.dde.Dock setPluginVisible sb '通知中心' false  # dock-禁用通知中心插件
busctl --user call com.deepin.dde.Dock /com/deepin/dde/Dock com.deepin.dde.Dock setPluginVisible sb '全局搜索' false  # dock-禁用全局搜索插件
busctl --user call com.deepin.dde.Dock /com/deepin/dde/Dock com.deepin.dde.Dock setPluginVisible sb '截图录屏' false  # dock-禁用截图录屏插件

gsettings set com.deepin.dde.mouse disable-touchpad true  #插入鼠标时禁用触控板

gsettings set com.deepin.dde.power battery-lid-closed-action 'turnOffScreen' #使用电池-笔记本合盖时-关闭屏幕
gsettings set com.deepin.dde.power battery-press-power-button 'showSessionUI' #使用电池-按电源按钮时-不做任何操作
gsettings set com.deepin.dde.power battery-lock-delay 0  #使用电池-自动锁屏 从不
gsettings set com.deepin.dde.power battery-screen-black-delay 300  #使用电池-关闭显示器 5分钟
gsettings set com.deepin.dde.power battery-sleep-delay 0  #使用电池-进入待机模式 从不

gsettings set com.deepin.dde.power line-power-lid-closed-action 'turnOffScreen' #连接电源-笔记本合盖时-关闭屏幕
gsettings set com.deepin.dde.power line-power-press-power-button 'showSessionUI' #连接电源-按电源按钮时-不做任何操作
gsettings set com.deepin.dde.power line-power-lock-delay 0  #连接电源-自动锁屏 从不
gsettings set com.deepin.dde.power line-power-screen-black-delay 900  #连接电源-关闭显示器 15分钟
gsettings set com.deepin.dde.power line-power-sleep-delay 0  #连接电源-进入待机模式 从不

#grub 主题美化
sudo busctl call com.deepin.daemon.Grub2 /com/deepin/daemon/Grub2/Theme com.deepin.daemon.Grub2.Theme SetBackgroundSourceFile s '/usr/share/wallpapers/deepin/mike-yukhtenko-a2kD4b0KK4s-unsplash.jpg'
sudo sed -i 's/deepin-fallback/deepin/g' /etc/default/grub
sudo update-grub2 

#添加Chrome源到source.list.d
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list'

#添加VSCode源到source.list.d
wget -q -O - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

#添加Docker源到source.list.d
wget -q -O - https://mirrors.cloud.tencent.com/docker-ce/linux/debian/gpg | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://mirrors.cloud.tencent.com/docker-ce/linux/debian buster stable" > /etc/apt/sources.list.d/docker.list'

#添加Beyond Compare源到source.list.d
wget -q -O - https://www.scootersoftware.com/RPM-GPG-KEY-scootersoftware | sudo apt-key add -
sudo sh -c 'echo "deb https://www.scootersoftware.com/ bcompare4 non-free" > /etc/apt/sources.list.d/scootersoftware.list'
sudo sh -c 'echo "Package: bcompare\nPin: origin www.scootersoftware.com\nPin-Priority: 600" > /etc/apt/preferences.d/scootersoftware'

#添加nodejs源到source.list.d
wget -q -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo sh -c 'echo "deb https://deb.nodesource.com/node_16.x buster main" > /etc/apt/sources.list.d/nodesource.list'

#添加内测源到source.list.d
sudo sh -c 'echo "deb [trusted=yes] https://proposed-packages.deepin.com/dde-apricot unstable main contrib non-free" > /etc/apt/sources.list.d/deepin-unstable.list'

#添加better-dde源到source.list.d
wget -q -O - https://better-dde.github.io/ppa/better-dde.gpg | sudo apt-key add -
sudo sh -c 'echo "deb https://better-dde.github.io/ppa/ ./" > /etc/apt/sources.list.d/better-dde.list'

#卸载系统自带Flash
sudo apt purge -y libflashplugin-pepper
rm -rf ~/.config/google-chrome/PepperFlash/

#卸载深度帮助手册和深度欢迎两个没用还占地方的东西(会同时卸载dde,貌似没啥问题)
sudo apt purge -y deepin-manual
sudo apt purge -y dde-manual-content
sudo apt purge -y dde-introduction

#卸载自己不需要的软件
sudo apt purge -y deepin-feedback
sudo apt purge -y deepin-app-store
sudo apt purge -y deepin-deepinid-client
sudo apt purge -y deepin-calculator
sudo apt purge -y deepin-draw
sudo apt purge -y deepin-voice-note
sudo apt purge -y deepin-album
sudo apt purge -y deepin-camera
sudo apt purge -y deepin-mail
sudo apt purge -y deepin-screensaver*
sudo apt purge -y deepin-clone
sudo apt purge -y deepin-recovery-plugin
sudo apt purge -y deepin-ab-recovery
sudo apt purge -y deepin-boot-maker
sudo apt purge -y gnome-theme*
sudo apt purge -y libreoffice*
sudo apt purge -y simple-scan
sudo apt purge -y printer-driver-deepin-cloud-print
sudo apt purge -y org.deepin.browser
sudo apt purge -y org.deepin.downloader
sudo apt purge -y deepin-deb-installer
sudo apt purge -y uos-release-note
sudo apt purge -y deepin-forum
sudo apt purge -y fcitx*
sudo apt purge -y nano

#更新20.4后,卸载这个会导致无法右键跳转到设置,酌情卸载
#sudo apt purge -y onboard-common

#这个是用来开关机画面的,我个人喜欢看开机输出文字信息,所以卸载
sudo apt purge -y plymouth*

#这几个是系统自带小游戏(五子棋和连连看)
sudo apt purge -y com.deepin*

#清理一下
sudo apt autoremove -y --purge

#安装软件
sudo apt update && sudo apt dist-upgrade -y
sudo apt install -y curl
sudo apt install -y git
sudo apt install -y console-setup
sudo apt install -y cmake-extras
sudo apt install -y extra-cmake-modules
sudo apt install -y build-essential
sudo apt install -y code
sudo apt install -y google-chrome-stable
sudo apt install -y com.qq.office.deepin
sudo apt install -y com.qq.weixin.deepin
sudo apt install -y com.oray.sunlogin.client
sudo apt install -y cn.wps.wps-office
sudo apt install -y docker-ce
sudo apt install -y fcitx5-chinese-addons
sudo apt install -y fcitx5-material-color
sudo apt install -y fcitx5-pinyin-zhwiki
sudo apt install -y fcitx5-flypy
sudo apt install -y bcompare
sudo apt install -y nodejs
sudo apt install -y remmina

#安装nvidia闭源驱动
sudo apt install -y nvidia-detect
nvidia-detect | awk 'match($0, /nvidia-.*/, a) {print a[0]}' | xargs sudo apt -y install

#安装任务栏显卡驱动切换插件
sudo apt install -y dde-dock-graphics-plugin

#隐藏启动器中 fcitx5配置、键盘布局查看工具
sudo sed -i '$a\NoDisplay=true' /usr/share/applications/fcitx5-configtool.desktop 
sudo sed -i '$a\NoDisplay=true' /usr/share/applications/kbd-layout-viewer5.desktop

#修复命令行安装TIM、微信、向日葵、WPS,启动器中没有图标
mkdir -p ~/.local/share/applications/

cp -r /opt/apps/com.qq.office.deepin/entries/icons/* ~/.local/share/icons/
cp -r /opt/apps/com.qq.office.deepin/entries/applications/* ~/.local/share/applications/

cp -r /opt/apps/com.qq.weixin.deepin/entries/icons/* ~/.local/share/icons/
cp -r /opt/apps/com.qq.weixin.deepin/entries/applications/* ~/.local/share/applications/

cp -r /opt/apps/com.oray.sunlogin.client/entries/icons/* ~/.local/share/icons/
cp -r /opt/apps/com.oray.sunlogin.client/entries/applications/* ~/.local/share/applications/

cp -r /opt/apps/cn.wps.wps-office/entries/icons/* ~/.local/share/icons/
cp -r /opt/apps/cn.wps.wps-office/entries/applications/* ~/.local/share/applications/

#修复安装VSCode后,Win + E 打开的是VSCode
xdg-mime default dde-file-manager.desktop inode/directory

#删除Chrome推荐设置
sudo rm /etc/opt/chrome/policies/recommended/*.json

#fcitx5开机自启动
mkdir -p ~/.config/autostart
sudo cp /usr/share/applications/org.fcitx.Fcitx5.desktop ~/.config/autostart/org.fcitx.Fcitx5.desktop

#fcitx5图标美化
sudo mv /usr/share/icons/bloom/actions/24/input-keyboard-symbolic.svg /usr/share/icons/bloom/actions/24/input-keyboard-symbolic.svg.bak
sudo ln -s /usr/share/icons/bloom/status/20/keyboard-symbolic.svg /usr/share/icons/bloom/status/20/input-keyboard-symbolic.svg

#更新TIM到最新版本
sh -c  '/opt/apps/com.qq.office.deepin/files/run.sh -c'
export WINEPREFIX=$HOME/.deepinwine/Deepin-TIM
rm TIM3.3.9.22051.exe
wget -t 3 -T 15 https://dldir1.qq.com/qqfile/qq/TIM3.3.9/TIM3.3.9.22051.exe
deepin-wine6-stable TIM3.3.9.22051.exe

#更新微信到最新版本
sh -c  '/opt/apps/com.qq.weixin.deepin/files/run.sh -c'
export WINEPREFIX=$HOME/.deepinwine/Deepin-WeChat
rm WeChatSetup.exe
wget -t 3 -T 15 https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe
deepin-wine6-stable WeChatSetup.exe

#大幅降低微信内存占用(牺牲小程序和公众号,慎用)
rm -rf ~/.deepinwine/Deepin-WeChat/drive_c/users/$(whoami)/Application\ Data/Tencent/WeChat/XPlugin/Plugins/XWeb/
touch ~/.deepinwine/Deepin-WeChat/drive_c/users/$(whoami)/Application\ Data/Tencent/WeChat/XPlugin/Plugins/XWeb
chmod 000 ~/.deepinwine/Deepin-WeChat/drive_c/users/$(whoami)/Application\ Data/Tencent/WeChat/XPlugin/Plugins/XWeb 

#清理一下
sudo apt autoremove -y --purge
Reply Favorite View the author
All Replies
1 / 2
To page
jjcui8595
deepin
2021-12-08 19:13
#1

厉害!

Reply View the author
186******75
deepin
2021-12-08 19:21
#2

希望做出一个软件或脚本。我也常常把系统弄坏,所以我给电脑上安装了三个uos和三个不同版本的deepin,还安装一个不常用的win7,在虚拟机中还安装了两个win7和两个win10,所以无论那个玩坏了,不会影响心情,还可以玩下去。

Reply View the author
liwl
deepin
2021-12-08 19:33
#3

厉害了,脚本里面涉及到sudo的密码,把sudo配置为免密码,添加到init脚本里面,会更爽,全程免交互

Reply View the author
deepin-superuser
deepin
2021-12-08 19:42
#4
liwl

厉害了,脚本里面涉及到sudo的密码,把sudo配置为免密码,添加到init脚本里面,会更爽,全程免交互

还是得交互的 更新TIM、微信的时候得点安装和下一步

Reply View the author
deepin-superuser
deepin
2021-12-08 19:45
#5
186******75

希望做出一个软件或脚本。我也常常把系统弄坏,所以我给电脑上安装了三个uos和三个不同版本的deepin,还安装一个不常用的win7,在虚拟机中还安装了两个win7和两个win10,所以无论那个玩坏了,不会影响心情,还可以玩下去。

文章里边的就是脚本,未来的目标是写一个初始化脚本生成工具,每人都可以根据自己的喜好定制生成自己专属的脚本,不过这个flag估计得很久后才能实现了

Reply View the author
DebuggerX
deepin
2021-12-08 20:13
#6
liwl

厉害了,脚本里面涉及到sudo的密码,把sudo配置为免密码,添加到init脚本里面,会更爽,全程免交互

配置免密不安全的,而且完全没必要,只要执行脚本的时候前面套个sudo,输入一次密码即可:

sudo bash deepin-init.sh
Reply View the author
babyfengfjx
Super Moderator
CQA
2021-12-08 21:43
#7
liwl

厉害了,脚本里面涉及到sudo的密码,把sudo配置为免密码,添加到init脚本里面,会更爽,全程免交互

貌似可以直接加在脚本里头不需要手动输入也阔以:

平常就这么干,也不晓得有啥副作用没得😂

userpasswd='XXX'
echo $userpasswd | sudo -S XXXX
Reply View the author
niu0518
deepin
2021-12-08 22:27
#8

大佬牛皮!!joy

Reply View the author
186******75
deepin
2021-12-08 22:27
#9

删除了很多不用东西,遗憾的是没有deepin的开机和关机画面。

Reply View the author
deepin-superuser
deepin
2021-12-08 22:33
#10
186******75

删除了很多不用东西,遗憾的是没有deepin的开机和关机画面。

故意的 想要保留的话 去掉 sudo apt-get purge -y plymouth* 这句,如果已经删除 可以 sudo apt-get install plymouth-theme-deepin-logo 恢复

Reply View the author
186******75
deepin
2021-12-08 22:58
#11
deepin-superuser

故意的 想要保留的话 去掉 sudo apt-get purge -y plymouth* 这句,如果已经删除 可以 sudo apt-get install plymouth-theme-deepin-logo 恢复

谢谢!

Reply View the author
weilai00
deepin
2021-12-09 06:02
#12

一次性执行完,会卡吗

Reply View the author
deepin-superuser
deepin
2021-12-09 16:13
#13
weilai00

一次性执行完,会卡吗

有可能下载更新时间太长 sudo 密码过期会提示重新输入密码

再就是更新qq和微信的时候要手动点击下一步,暂时没做到无人值守

Reply View the author
cloudseasail
deepin
2021-12-09 19:23
#14

好想法,收藏了

Reply View the author
waittingsummer
deepin
2021-12-09 23:20
#15

太依赖网络了

Reply View the author
liwl
deepin
2021-12-14 17:35
#16

更新微信到最新版本的话,微信的会有什么问题吗

Reply View the author
deepin-superuser
deepin
2021-12-14 17:39
#17
liwl

更新微信到最新版本的话,微信的会有什么问题吗

目前发现 每次登录后会弹一个 WeChatApp 崩溃的框 关闭以后不影响聊天功能,但小程序用不了

Reply View the author
liwl
deepin
2021-12-14 18:33
#18
deepin-superuser

目前发现 每次登录后会弹一个 WeChatApp 崩溃的框 关闭以后不影响聊天功能,但小程序用不了

强行更新,翻车了。然后我已经purge 微信了,但是留下2个快捷方式,没法删除

image.png

请问知道该如何处理不?

Reply View the author
deepin-superuser
deepin
2021-12-14 18:49
#19
liwl

强行更新,翻车了。然后我已经purge 微信了,但是留下2个快捷方式,没法删除

image.png

请问知道该如何处理不?

这两个图标在 ~/.local/share/applications 下

Reply View the author
deepin-superuser
deepin
2021-12-14 18:51
#20
deepin-superuser

这两个图标在 ~/.local/share/applications 下

sh -c '/opt/apps/com.qq.weixin.deepin/files/run.sh -c'

你是不是这句也执行了?这句是初装系统的时候还没有初始化,才需要

普通更新只需要下边几句就可以了

Reply View the author
1 / 2
To page