[Share Experiences] 【脚本】我的Deepin装机初始化脚本
Tofloor
poster avatar
ThinkYoung
deepin
2022-08-04 21:23
Author

【V23】版重新上线,这回增加 可使用选项安装


前人种树,后人乘凉,借鉴学习了大神们的帖子:

木一明 《我的deepin变形记》

deepin-superuser 【deepin 20.5】我的 Deepin 初始化脚本(持续更新)

结合自己的习惯,写了自己用的nightly的简单粗暴版的初始化脚本,

【照搬有风险,翻车如翻书,仅供阅读参考】

初始化脚本我觉得大致分几块:

源,alias ,内核 ,加速,驱动 ,软件,美化,配置

==================================================================

#!/bin/bash
#version:v23.04.14
# cd ~ &&  wget -O  init.sh  https://gitee.com/thinkyoung/deepin.store/raw/master/deepin/pool/main/i/init/init.sh  &&  sudo bash init.sh

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8



# 安装自定义alias
Alias(){
cd ~ 
sudo wget -O .bash_aliases https://gitee.com/thinkyoung/deepin.store/raw/master/deepin/pool/main/a/alias/.bash_aliases  
source  ~/.bash_aliases

echo -e "\033[33m $FUNCNAME \033[0m" 
}

# 添加自定义源
Source(){
# 添加自定义源:国内debian源
sudo wget -O debian.list https://gitee.com/thinkyoung/deepin.store/raw/master/deepin/pool/main/s/source/debian11/debian.list  
sudo  mv ./debian.list /etc/apt/sources.list.d/debian.list



echo -e "\033[33m $FUNCNAME \033[0m" 
}

# 更换自定义第三方优化内核
Kernel(){

sudo apt install console-setup
echo 'deb http://deb.xanmod.org releases main' | sudo tee /etc/apt/sources.list.d/xanmod-kernel.list
wget -qO - https://dl.xanmod.org/gpg.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/xanmod-kernel.gpg add -
sudo apt update && sudo apt install linux-xanmod

echo -e "\033[33m $FUNCNAME \033[0m" 
}



# 修改Grub
Grub(){
# 需要修改grub-cfg开机时间 以及 #自主降频
# 本脚本用来修改引导界面
#取消延时
sudo sed -i 's/GRUB_TIMEOUT=1/GRUB_TIMEOUT=0/g' /etc/default/grub
#取消主题
#sudo sed -i 's/GRUB_THEME/\#GRUB_THEME/g' /etc/default/grub #注释掉
sudo sed -i '/GRUB_BACKGROUND/d' /etc/default/grub #删除
sudo sed -i '/GRUB_THEME/d' /etc/default/grub #删除
#更新grub
sudo update-grub

echo -e "\033[33m $FUNCNAME \033[0m" 
}

# 安装驱动
Driver(){
#开启32位
#sudo dpkg --add-architecture i386
# sudo apt update
# sudo apt install  libdbus-glib-1-2
# sudo apt-get install libdbus-glib-1-2:i386

# 硬件信息
sudo apt install inxi

# 安装intel集成显卡
sudo  apt  install  libgl1-mesa-dri    mesa-vulkan-drivers    libvulkan1   vulkan-tools  vulkan-validationlayers
# sudo  apt  install  libgl1-mesa-dri:i386 mesa-vulkan-drivers:i386 libvulkan1:i386
echo -e "\033[33m $FUNCNAME \033[0m" 
}

# 一键安装 装机必备
Deb(){
# 一键装机必备
sudo mkdir /data
sudo mount /dev/nvme0n1p5 /data
echo '/dev/nvme0n1p5 /data ext4 defaults 0 0' | sudo tee -a  /etc/fstab
sudo apt install /data/packages/deepinstore/pool/deepinstore/*.deb

echo -e "\033[33m $FUNCNAME \033[0m" 
}

# MX Linux 安装
MX(){
  
# 添加自定义源:国内mxlinux源
#sudo wget -O mx.list https://gitee.com/thinkyoung/deepin.store/raw/master/deepin/pool/main/s/source/mxlinux/mx.list  
#sudo  mv ./mx.list /etc/apt/sources.list.d/mx.list

# 安装mx-apps
#sudo apt install mx-apps


echo -e "\033[33m $FUNCNAME \033[0m" 
}



Spark(){
# 安装星火商店 本地源里面已经有相同 省略
sudo apt install git qtbase5-dev debhelper pkg-config qtchooser libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5concurrent5 libdtkcore-dev libdtkgui-dev  libdtkwidget-dev qttools5-private-dev libnotify-dev qtwebengine5-dev

wget -O spark.deb https://gitee.com/deepin-community-store/spark-store/releases/download/txz/spark-store_3.3.3~test4_amd64.deb && sudo apt install ./spark.deb

echo -e "\033[33m $FUNCNAME \033[0m" 
}


# 优化开机加速,禁用服务:
Speed(){
sudo systemctl mask apt-daily.service
sudo systemctl mask apt-daily-upgrade.service
sudo systemctl mask nmbd.service
sudo systemctl mask plymouth-quit-wait.service
sudo systemctl mask NetworkManager-wait-online.service

# 关闭控制中心自动更新
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

echo -e "\033[33m $FUNCNAME \033[0m" 
}

Btf(){


# 设置自定义图标主题 Win11 本地源deb已经安装
wget -O deepinstore.win11.theme.deb https://gitee.com/thinkyoung/deepinstore.win11.icon.theme/releases/download/v22.10.01/deepinstore.win11.theme_22.10.01.deb && sudo apt install ./deepinstore.win11.theme.deb
gsettings set com.deepin.dde.appearance icon-theme Win11
gsettings set com.deepin.dde.dock display-mode 'efficient'  # dock-高效模式
gsettings set com.deepin.dde.dock window-size-efficient 42  # dock-高度增加

#sudo plymouth-set-default-theme win11 && sudo plymouth-set-default-theme -R win11


# 更换背景图片
dbus-send --session --print-reply=literal --dest=com.deepin.daemon.Appearance /com/deepin/daemon/Appearance   com.deepin.daemon.Appearance.SetMonitorBackground string:"DP-1" string:"file:///usr/share/wallpapers/deepin/mike-yukhtenko-a2kD4b0KK4s-unsplash.jpg"

echo -e "\033[33m $FUNCNAME \033[0m" 
}

Clean(){
#卸载旧内核
#sudo apt purge linux-headers-5.10.*-amd64-desktop ; linux-image-5.10.*-amd64-desktop
echo -e "\033[33m $FUNCNAME \033[0m" 
}

Help(){
cat << EOF
[0][list][列表]  
[1][alias][别名]
[2][source][软件源]
[3][kernel][第三方内核]
[4][grub][启动优化]
[5][speed][加速]
[6][upgrade][升级]
[7][driver][驱动]
[8][spark][星火商店]
[9][mx][MXLinux源]
[10][deb][安装]
[11][btf][美化]
[12][clean][清理]
[99][all][全部]
EOF
}

Install_Main(){

	startTime=`date +%s`
	echo $startTime ;
	Alias;
	Source;
	Kernel;
	Grub;
	Speed;
	# 全面更新升级命令
	full-upgrade;
	Driver;
	Spark
	#MX
	#Deb
	Btf;
	Clean;


}


reset 
echo "
+----------------------------------------------------------------------
| InitShell for Deepin
+----------------------------------------------------------------------
| Copyright © 2015-2099 ThinkYoung (https://gitee.com/thinkyoung) All rights reserved.
+----------------------------------------------------------------------
| shell run when installed.
+----------------------------------------------------------------------
"
while [ "$go" != 'y' ] && [ "$go" != 'n' ]
do
	read -p "Do you want to install InitShell for Deepin now ? (y/n): " go;
done

if [ "$go" == 'n' ];then
	exit;
fi
if [ "$go" == 'y' ];then
	echo 'start!!!';
fi


# 软件列表

while [ "$to" != 'exit' ] && [ "$to" != 'quit' ]
do
	Help;
	read -p "选择你要操作的命令(列表:输入list or 1  退出:输入exit or -1 ): " to;


if [ "$to" == '0' ]  || [  "$to" == 'list'  ];then
	Help;
fi

if [ "$to" == '1' ]  || [ "$to" == 'alias' ];then
	Alias;
fi

if [ "$to" == '2' ]  || [ "$to" == 'source' ];then
	Source;
fi

if [ "$to" == '3' ]  || [ "$to" == 'kernel' ];then
	Kernel;
fi

if [ "$to" == '4' ]  || [ "$to" == 'grub' ];then
	Grub;
fi

if [ "$to" == '5' ]  || [ "$to" == 'speed' ];then
	Speed;
fi

if [ "$to" == '6' ]  || [ "$to" == 'upgrade' ];then
	full-upgrade;
fi

if [ "$to" == '7' ]  || [ "$to" == 'driver' ];then
	Driver;
fi

if [ "$to" == '8' ]  || [ "$to" == 'spark' ];then
	Spark;
fi

if [ "$to" == '9' ]  || [ "$to" == 'mx' ];then
	MX;
fi

if [ "$to" == '10' ]  || [ "$to" == 'deb' ];then
	Deb;
fi

if [ "$to" == '11' ]  || [ "$to" == 'btf' ];then
	Btf;
fi

if [ "$to" == '12' ]  || [ "$to" == 'clean' ];then
	Clean;
fi
if [ "$to" == '99' ]  || [ "$to" == 'all' ];then
	Install_Main;
fi

if [ "$to" == '-1' ]  || [ "$to" == 'exit' ] || [ "$to" == 'quit' ];then
	exit;
fi



done
#read -s "for auto install,password?" PASSWORD;
#export PASSWORD;
#Install_Main

Reply Favorite View the author
All Replies
老咸鱼
deepin
2022-08-04 22:39
#1

V23nightly这个版本已经不维护了吧

想玩的建议换V23preview

Reply View the author
ThinkYoung
deepin
2022-08-04 22:47
#2
老咸鱼

V23nightly这个版本已经不维护了吧

想玩的建议换V23preview

嗯 等放出正式版就换换

Reply View the author
晚秋(lateautumn)
Moderator
2022-08-04 22:54
#3

一看版主也是一位坛神呀!我这个小白还不敢用V23呀

Reply View the author
安洛
deepin
2022-08-04 23:53
#4

为什么你们都那么喜欢用xanmod内核……它的提升真的那么大吗?

Reply View the author
ThinkYoung
deepin
2022-08-05 01:25
#5
安洛

为什么你们都那么喜欢用xanmod内核……它的提升真的那么大吗?

具体的也不知道,打steam游戏提升倒是真的,换核之后,deepin也能几乎达到manjaro arch上游戏效果水平,而源生核打csgo游戏一卡一卡的,卡顿明显,根本玩不了,我是反复安装测试比较出来的

xanmod能紧随kernel经常更新,现在更到了5.18.16,有时它还会更新linux-firmware固件,估计是外设驱动一些东东

缺点就是xanmod与deepin不能完全搭噶,有些安卓功能都不兼容,看个人需求吧

Reply View the author