[Share Experiences] 【deepin 20.5】我的 Deepin 初始化脚本(持续更新)
Experiences and Insight 2254 views · 33 replies
Tofloor
poster avatar
deepin-superuser
deepin
2021-12-08 03:04
Author

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

最后更新时间:2022-04-02

目前进度:

任务 进度
卸载安装常用软件 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-高度增加

gsettings set com.deepin.dde.dock.module.multitasking enable false  # dock-禁用多任务窗口插件(待调整为只关闭,不禁用)
gsettings set com.deepin.dde.dock.module.show-desktop enable 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  #连接电源-进入待机模式 从不

#添加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'

#添加Typora源到source.list.d
wget -q -O - https://typora.io/linux/public-key.asc | sudo apt-key add -
sudo sh -c 'echo "deb https://typora.io/linux ./" > /etc/apt/sources.list.d/typora.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'

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

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

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

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

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

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

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

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

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

#安装任务栏显卡驱动切换插件
wget -t 3 -T 15 https://github.com/zty199/dde-dock-switch_graphics_card/releases/download/v1.8.4-1/dde-dock-graphics-plugin_1.8.4-1_amd64.deb
sudo apt-get install -y ./dde-dock-graphics-plugin_1.8.4-1_amd64.deb

#用于编译fcitx5-rime
sudo apt-get install -y libecm-dev
sudo apt-get install -y libfcitx5core-dev
sudo apt-get install -y fcitx5-modules-dev
sudo apt-get install -y librime-dev
sudo apt-get install -y appstream
sudo apt-get install -y gettext

#隐藏启动器中 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图标美化
#wget -t 3 -T 15 https://raw.githubusercontent.com/kt286/deepin-init/master/assets/pinyin.svg
#sudo cp pinyin.svg /usr/share/icons/bloom/apps/64/org.fcitx.Fcitx5.svg
#sudo cp pinyin.svg /usr/share/icons/bloom/apps/64/org.fcitx.Fcitx5.fcitx-pinyin.svg
#sudo cp pinyin.svg /usr/share/icons/bloom/status/48/fcitx-pinyin.svg

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

#fcitx5词库
mkdir -p ~/.local/share/fcitx5/pinyin/dictionaries
wget -t 3 -T 15 https://github.com/felixonmars/fcitx5-pinyin-zhwiki/releases/download/0.2.3/zhwiki-20220226.dict
sudo cp zhwiki-20220226.dict ~/.local/share/fcitx5/pinyin/dictionaries/fcitx5-pinyin-zhwiki.dict

#fcitx5皮肤
mkdir -p ~/.local/share/fcitx5/themes/Material-Color
git clone https://github.com/hosxy/Fcitx5-Material-Color.git ~/.local/share/fcitx5/themes/Material-Color
ln -s ~/.local/share/fcitx5/themes/Material-Color/theme-blue.conf ~/.local/share/fcitx5/themes/Material-Color/theme.conf

#编译fcitx5-rime
mkdir -p ~/workspace/fcitx5-rime
git clone https://github.com/fcitx/fcitx5-rime.git ~/workspace/fcitx5-rime
mkdir -p ~/workspace/fcitx5-rime/build
cd ~/workspace/fcitx5-rime/build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make -j4
sudo make install

#返回用户下载目录
cd ~/Downloads

#使用自己编译的深度音乐
wget -t 3 -T 15 https://raw.githubusercontent.com/kt286/deepin-init/master/assets/deepin-music
sudo cp deepin-music /usr/bin/deepin-music

#更新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-get autoremove -y --purge
Reply Favorite View the author
All Replies
jjcui8595
deepin
2021-12-08 03:13
#1

厉害!

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

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

Reply View the author
木一明
deepin
2021-12-08 03:33
#3

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

Reply View the author
deepin-superuser
deepin
2021-12-08 03:42
#4
木一明

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

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

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

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

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

Reply View the author
DebuggerX
deepin
2021-12-08 04:13
#6
木一明

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

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

sudo bash deepin-init.sh
Reply View the author
babyfengfjx
deepin testing team
2021-12-08 05:43
#7
木一明

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

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

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

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

大佬牛皮!!joy

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

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

Reply View the author
deepin-superuser
deepin
2021-12-08 06: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 06: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-08 14:02
#12

一次性执行完,会卡吗

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

一次性执行完,会卡吗

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

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

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

好想法,收藏了

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

太依赖网络了

Reply View the author
木一明
deepin
2021-12-14 01:35
#16

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

Reply View the author
deepin-superuser
deepin
2021-12-14 01:39
#17
木一明

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

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

Reply View the author
木一明
deepin
2021-12-14 02:33
#18
deepin-superuser

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

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

image.png

请问知道该如何处理不?

Reply View the author
deepin-superuser
deepin
2021-12-14 02:49
#19
木一明

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

image.png

请问知道该如何处理不?

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

Reply View the author
deepin-superuser
deepin
2021-12-14 02: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
Use Markdown Editor
Loading