代码拉取完成,页面将自动刷新
#! /bin/sh
lmpath="$(cat /proc/cmdline | tr ' ' '\n' | grep live-media-path=)"
lmpath="${lmpath##live-media-path=}"
pdisk="$(findfs LABEL=persistence)"
pdisk="${pdisk##/dev/}"
if [ "${USER}" != root ] ; then
cat << EOF
Use sudo to run as root!
EOF
exit 29
elif ! mountpoint -q /media/${USER}/DEEPINOS ; then
cat << EOF
Insert and mount your USB as ${USER} first. Remove squashfs-root if you want to
start from unsquashing filesystem.squashfs.
EOF
exit 29
elif [ -n "${pdisk}" ] && [ ! -f /lib/live/mount/persistence/${pdisk}/${lmpath}/filesystem.squashfs ] ; then
cat << EOF
Block device with persistence label is not mounted at boot. Perhaps, you have
multiple persistence labeled partitions. Keep only the boot mounted persistence
partition connected to your computer. Force to update filesystem.squashfs at
/media/${USER}/DEEPINOS/live? (Enter "YES" to continue)
EOF
read FORCE
if [ "${FORCE}" != "YES" ] ; then
exit 29
fi
fi
if [ -z "${lmpath}" ] || [ -n "${FORCE}" ] ; then
fssqfspath="/media/${USER}/DEEPINOS/live"
else
fssqfspath="/lib/live/mount/persistence/${pdisk}/${lmpath}"
fi
if [ ! -d squashfs-root ] ; then
unsquashfs ${fssqfspath}/filesystem.squashfs
fi
tar cvf - -C /etc resolv.conf hosts | tar xf - -C squashfs-root/etc
mount --bind /dev squashfs-root/dev
mount -t proc none squashfs-root/proc
mount -t sysfs none squashfs-root/sys
mount -t devpts none squashfs-root/dev/pts
dbus-uuidgen > squashfs-root/var/lib/dbus/machine-id
env HOME=/root LC_ALL=C chroot squashfs-root dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true squashfs-root/sbin/initctl
# Add modules to initrd.lz
for i in zfs f2fs crc32_pclmul ; do
if ! grep -qs ${i} squashfs-root/etc/initramfs-tools/modules ; then
cat >> squashfs-root/etc/initramfs-tools/modules << EOF
${i}
EOF
fi
done
# Do not blacklist intel-microcode for i915/glk_dmc_ver1_04.bin to work
if [ -e squashfs-root/etc/modprobe.d/intel-microcode-blacklist.conf ] ; then
rm squashfs-root/etc/modprobe.d/intel-microcode-blacklist.conf
fi
sed -e 's|\(if \[ "${UNIONTYPE}" = "overlay" \]\)[^ ]*$|\1 \&\& [ -e "${source}/rw" ] |' -i"" squashfs-root/usr/lib/live/boot/9990-misc-helpers.sh
# Find out the ATTRS by udevadm info command
# e.g. udevadm info --attribute-walk --path=$(udevadm info --query path --name=/dev/sda)
if [ ! -e "squashfs-root/etc/udev/rules.d/99-trim-ssd-discard.rules" ] ; then
cat >> squashfs-root/etc/udev/rules.d/99-trim-ssd-discard.rules << EOF
ACTION=="add|change", ATTRS{idVendor}=="152d", ATTRS{idProduct}=="0580", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
ACTION=="add|change", ATTRS{idVendor}=="2109", ATTRS{idProduct}=="0715", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
ACTION=="add|change", ATTRS{idVendor}=="2537", ATTRS{idProduct}=="1068", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
ACTION=="add|change", ATTRS{idVendor}=="0000", ATTRS{idProduct}=="0000", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
ACTION=="add|change", ATTRS{subsystem_vendor}=="0x1000", ATTRS{subsystem_device}=="0x3010", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap",ATTR{manage_start_stop}="1"
EOF
fi
# PPA example (PPA user grabli66-r ; project eos ; pgp key ID df792eb1dc162b17ef394752f194e70076d3eb82)
#if [ ! "squashfs-root/etc/apt/sources.list.d/ppa.list" ] ; then
# cat > squashfs-root/etc/apt/sources.list.d/ppa.list << EOF
#deb http://ppa.launchpad.net/grabli66-r/eos/ubuntu xenial main
#EOF
# env HOME=/root LC_ALL=C chroot squashfs-root /usr/bin/apt-key adv --recv df792eb1dc162b17ef394752f194e70076d3eb82
#fi
# lion (Because dde is to be removed and re-installed, /deepin/ and /golang/ from apricot needs to pin with priority 1000)
if [ ! -e "squashfs-root/etc/apt/sources.list.d/lion.list" ] ; then
cat > squashfs-root/etc/apt/sources.list.d/lion.list << EOF
deb https://mirrors.huaweicloud.com/deepin lion main contrib non-free
EOF
fi
if [ ! -e "squashfs-root/etc/apt/preferences.d/lion.pref" ] ; then
cat > squashfs-root/etc/apt/preferences.d/lion.pref << EOF
Package: gcc-6-base gcc-6-doc gcc-doc-base gcc-doc jadetex lib32gfortran3 libgfortran3 libmpfr4 ttf-wps-fonts
Pin: release n=lion
Pin-Priority: 99
Package: /deepin/ /golang/ /dh-autoreconf/ /libcogl/
Pin: release n=apricot
Pin-Priority: 1000
EOF
fi
# deepin repo correction
grep -q pools.corp.deepin squashfs-root/etc/apt/sources.list && {
sed -e 's@http://pools.corp.deepin@https://community-packages.deepin@' -e '/ppa\/dde/ d' -i"" squashfs-root/etc/apt/sources.list
}
# printer repo correction
if ! grep -q chinauos squashfs-root/etc/apt/sources.list.d/printer.list ; then
sed -e 's/community-packages.deepin/packages.chinauos/' -i"" squashfs-root/etc/apt/sources.list.d/printer.list
fi
# deepin-app-store repo correction
if ! grep -q chinauos squashfs-root/etc/apt/sources.list.d/appstore.list ; then
sed -e 's/community-store-packages.deepin/home-store-packages.chinauos/' -e 's/eagle/apricot/' -i"" squashfs-root/etc/apt/sources.list.d/appstore.list
fi
# Apertium (currently does not support English<=>Russian)
if [ ! -e "squashfs-root/etc/apt/trusted.gpg.d/apertium.gpg" ] ; then
wget -q https://apertium.projectjj.com/apt/apertium-packaging.public.gpg -O squashfs-root/etc/apt/trusted.gpg.d/apertium.gpg
fi
if [ ! -e "squashfs-root/etc/apt/preferences.d/apertium.pref" ] ; then
wget -q https://apertium.projectjj.com/apt/apertium.pref -O squashfs-root/etc/apt/preferences.d/apertium.pref
fi
if [ ! -e "squashfs-root/etc/apt/sources.list.d/apertium.list" ] ; then
cat > squashfs-root/etc/apt/sources.list.d/apertium.list << EOF
deb https://apertium.projectjj.com/apt/release buster main
EOF
fi
# Element-desktop
if [ ! -e "squashfs-root/etc/apt/sources.list.d/element.list" ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root /usr/bin/apt-key adv --keyserver keyserver.ubuntu.com --recv D7B0B66941D01538
cat > squashfs-root/etc/apt/sources.list.d/element.list << EOF
deb https://packages.riot.im/debian/ default main
EOF
fi
# slack-desktop
if [ ! -e "squashfs-root/etc/apt/sources.list.d/slack.list" ] ; then
cat > squashfs-root/etc/apt/sources.list.d/slack.list << EOF
deb https://packagecloud.io/slacktechnologies/slack/debian jessie main
EOF
env HOME=/root LC_ALL=C chroot squashfs-root apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D938EC0D038651BD
env HOME=/root LC_ALL=C chroot squashfs-root apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C2E73424D59097AB
fi
# Speedtest
if [ ! -e "squashfs-root/etc/apt/sources.list.d/speedtest.list" ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61
cat > squashfs-root/etc/apt/sources.list.d/speedtest.list << EOF
deb https://ookla.bintray.com/debian buster main
EOF
fi
# Seafile
if [ ! -e "squashfs-root/etc/apt/sources.list.d/seafile.list" ] ; then
wget -O - https://linux-clients.seafile.com/seafile.asc | env HOME=/root LC_ALL=C chroot squashfs-root apt-key add -
cat > squashfs-root/etc/apt/sources.list.d/seafile.list << EOF
deb [arch=amd64] https://linux-clients.seafile.com/seafile-deb/buster/ stable main
deb [arch=amd64] https://linux-clients.seafile.com/seadrive-deb/buster/ stable main
EOF
fi
# 1/3 Remove kmod modules from deepin/UOS kernel that are incompatible with
# debian backport kernel. (part 1/2)
# 2/3 Reboot with the new filesystem.squashfs and old vmlinuz.efi/initrd.lz.
# Remove package linux-image-amd so that we can reinstall linux-image-amd
# package to update the initrd2.img (to be renamed to initrd.lz) and
# vmlinuz2 (to be renamed to vmlinuz and vmlinuz.efi).
# 3/3 Reboot again into the new filesystem.squash and new vmlinuz.efi/initrd.lz
# and install back those missing dkms kmod, firmware, etc. Remove the old
# kernel if desired.
#env HOME=/root LC_ALL=C chroot squashfs-root apt remove --purge bcmwl-kernel-source huawei-wmi-dkms linux-firmware
#env HOME=/root LC_ALL=C chroot squashfs-root apt autoremove --purge
# buster-backports
if [ ! -e "squashfs-root/etc/apt/sources.list.d/buster-backports.list" ] ; then
cat > squashfs-root/etc/apt/sources.list.d/buster-backports.list << EOF
deb https://deb.debian.org/debian buster-backports main contrib non-free
EOF
fi
if [ ! -e "squashfs-root/etc/apt/preferences.d/buster-backports.pref" ] ; then
cat > squashfs-root/etc/apt/preferences.d/buster-backports.pref << EOF
Package: wireless-regdb /zfs/ /zpool/ /dkms/ telegram-desktop ca-cacert /linux-doc/ /linux-source/ /linux-perf/ /linux-libc-dev/ /linux-compiler-gcc/ /torbrowser/ /wireguard/ /libnvpair1linux/ /libuutil1linux/ /firmware/
Pin: release n=buster-backports
Pin-Priority: 1000
EOF
fi
# mincores-dkms/warm-sched for cached DE login fails to compile on kernel > 5.1.
# linux-firmware has included many firmware-* and may cause conflicts.
################################################################################
# When upgrade zfs/spl-dkms, it is necessary first rmmod all related kmod before
# doing the upgrade. Otherwise, some dkms modules will not be removed in chroot.
# When there is a change in kernel version, the remove or build may also depends
# on header files that are missing in linux-headers-amd64. You need to make a
# soft link from linux-headers-common manually and remove dkms kmods first.
################################################################################
# Quick fix for missing /usr/src/linux-headers-$(uname -r)/include/linux (THIS
# SHOULD BE DONE BEFORE INSTALLING ZFS STUFF AFTER INSTALLING THE NEW HEADERS!!)
#if [ ! -h squashfs-rootusr/usr/src/linux-headers-$(uname -r)/include/linux ] ; then
# ln -s /usr/src/linux-headers-$(uname -r | sed -e 's%amd64%common%')/include/linux squashfs-root/usr/src/linux-headers-$(uname -r)/include/linux
#fi
env HOME=/root LC_ALL=C chroot squashfs-root apt update
env HOME=/root LC_ALL=C chroot squashfs-root apt full-upgrade
# 1/3 Upgrade from deepin/UOS kernel to debian backport kernel (part 2/2)
#env HOME=/root LC_ALL=C chroot squashfs-root apt install linux-image-amd64
# 3/3 Remove old kernel from new filesystem.squashfs and install dkms kmod and
# firmwares for the new kernel. dkms is not in debian repository.
#env HOME=/root LC_ALL=C chroot squashfs-root apt install linux-headers-5.8.0-0.bpo.2-amd64
#[ -e squashfs-root/usr/src/linux-headers-5.8.0-0.bpo.2-common/include/linux ] && [ -h squashfs-root/usr/src/linux-headers-5.8.0-0.bpo.2-amd64/include/linux ] || {
# ln -s /usr/src/linux-headers-5.8.0-0.bpo.2-common/include/linux squashfs-root/usr/src/linux-headers-5.8.0-0.bpo.2-amd64/include
#}
#env HOME=/root LC_ALL=C chroot squashfs-root apt install linux-image-5.8.0-0.bpo.2-amd64
#env HOME=/root LC_ALL=C chroot squashfs-root apt remove --purge linux-image-deepin-amd64 linux-image-5.7.7-amd64-desktop linux-headers-deepin-amd64 linux-headers-5.7.7-amd64-desktop
#env HOME=/root LC_ALL=C chroot squashfs-root apt autoremove --purge
#env HOME=/root LC_ALL=C chroot squashfs-root apt install zfsutils-linux zfs-dkms zfs-zed intel-microcode amd64-microcode firmware-linux firmware-amd-graphics firmware-atheros firmware-brcm80211 firmware-intel-sound firmware-intelwimax firmware-ipw2x00 firmware-iwlwifi firmware-libertas firmware-realtek firmware-ti-connectivity crda huawei-wmi-dkms
env HOME=/root LC_ALL=C chroot squashfs-root apt remove --purge linux-image-deepin-amd64 linux-image-5.4.50-amd64-desktop linux-headers-deepin-amd64 linux-headers-5.4.50-amd64-desktop
env HOME=/root LC_ALL=C chroot squashfs-root
env HOME=/root LC_ALL=C chroot squashfs-root apt autoremove --purge
env HOME=/root LC_ALL=C chroot squashfs-root apt list --installed | grep --color residual-config
# Install Apertium Bootstrap (i.e. apertium-init)
if [ -e "squashfs-root/usr/bin/pip3" ] && [ ! -e "squashfs-root/usr/local/bin/apertium-init" ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root /usr/bin/pip3 install apertium-init
fi
# Disable zfs-import, zed, zfs-mount and zfs-share
for i in zfs-import.target zfs-zed.service ; do
if [ -e "squashfs-root/etc/systemd/system/zfs.target.wants/${i}" ] ; then env HOME=/root LC_ALL=C chroot squashfs-root systemctl disable ${i} ; fi
done
for i in zfs-mount.service zfs-share.service ; do
if [ -h "squashfs-root/etc/systemd/system/zfs.target.wants/${i}" ] ; then env HOME=/root LC_ALL=C chroot squashfs-root systemctl disable ${i} ; fi
done
# The whole set of stardict dictionary files exceed the default nofile limit.
if [ ! -e "squashfs-root/etc/security/limits.d/stardict.conf" ] ; then
cat > "squashfs-root/etc/security/limits.d/stardict.conf" << EOF
* soft nofile 1048576
* soft stack unlimited
EOF
fi
# Random MAC address
if ! grep -qs "cloned-mac-address" squashfs-root/etc/NetworkManager/NetworkManager.conf ; then
sed -e 's/wifi.scan-rand-mac-address=no/wifi.scan-rand-mac-address=yes/' -i"" squashfs-root/etc/NetworkManager/NetworkManager.conf
sed -f - -i"" squashfs-root/etc/NetworkManager/NetworkManager.conf << "EOF"
/^.connectivity.$/ a\
enabled=false
$ a\
\
[connection]\
ethernet.cloned-mac-address=random\
wifi.cloned-mac-address=random
EOF
fi
# Disable App Store Autoupdate and AutoDownload
if [ ! -e squashfs-root/var/lib/lastore/config.json ] ; then
cat > squashfs-root/var/lib/lastore/config.json << "EOF"
{"Version":"0.1","AutoCheckUpdates":false,"DisableUpdateMetadata":false,"AutoDownloadUpdates":false,"AutoClean":false,"MirrorSource":"default","UpdateNotify":false,"CheckInterval":604800000000000,"CleanInterval":604800000000000,"CleanIntervalCacheOverLimit":86400000000000,"AppstoreRegion":"","LastCheckTime":"1970-01-01T00:00:00.000000000Z","LastCleanTime":"1970-01-01T00:00:00.000000000Z","LastCheckCacheSizeTime":"1970-01-01T00:00:00.000000000Z","Repository":"desktop","MirrorsUrl":"http://packages.deepin.com/mirrors/community.json"}
EOF
fi
# Disable charon (IPSec)
if [ -e "squashfs-root/etc/systemd/system/multi-user.target.wants/strongswan.service" ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root systemctl disable ipsec.service
fi
# Disable tftpd-hpa
if [ -e squashfs-root/etc/rc5.d/S[0-9][0-9]tftpd-hpa ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root systemctl disable tftpd-hpa.service
fi
# Disable nmbd and smbd
if [ -e squashfs-root/etc/rc5.d/S[0-9][0-9]nmbd ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root systemctl disable nmbd.service
fi
if [ -e squashfs-root/etc/rc5.d/S[0-9][0-9]smbd ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root systemctl disable smbd.service
fi
# Disable smartd
if [ -e squashfs-root//etc/systemd/system/multi-user.target.wants/smartd.service ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root systemctl disable smartd.service
fi
# Disable deepin-anything-tool
if [ -e squashfs-root/etc/systemd/system/multi-user.target.wants/deepin-anything-tool.service ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root systemctl disable deepin-anything-tool.service
fi
# Disable deepin-anything-monitor
if [ -e squashfs-root/etc/systemd/system/multi-user.target.wants/deepin-anything-monitor.service ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root systemctl disable deepin-anything-monitor.service
fi
# Added papp_cloud
[ -e squashfs-root/usr/bin/papp_cloud ] || {
tar cvf - -C $(dirname ${0}) papp_cloud_linux64 | tar xf - --no-same-owner -C squashfs-root/usr/bin
mv squashfs-root/usr/bin/papp_cloud_linux64 squashfs-root/usr/bin/papp_cloud
chmod 755 squashfs-root/usr/bin/papp_cloud
ln -s papp_cloud squashfs-root/usr/bin/papp_cli
}
# Enable ssh-agent
if grep -q no-use-ssh-agent squashfs-root/etc/X11/Xsession.options ; then
sed -e 's/no-\(use-ssh-agent\)/\1/' -i"" squashfs-root/etc/X11/Xsession.options
fi
# Disable sshd
if [ -e squashfs-root/etc/systemd/system/multi-user.target.wants/ssh.service ] ; then
env HOME=/root LC_ALL=C chroot squashfs-root systemctl disable ssh.service
fi
# Chromium temporary profile and incognito mode
if ! grep -q incognito squashfs-root/usr/share/applications/chromium.desktop ; then
sed -e 's|\(/usr/bin/chromium\)\( %U\)|\1 --temp-profile --incognito\2|' -i"" squashfs-root/usr/share/applications/chromium.desktop
fi
# dialout and nopasswdlogin groups for live user
for i in dialout wireshark nopasswdlogin ; do
if ! grep -q "${i}" squashfs-root/usr/lib/live/init-config.sh ; then
sed -e "s/\(LIVE_USER_DEFAULT_GROUPS=.*\)\(\"\)$/\1 ${i}\2/" -i"" squashfs-root/usr/lib/live/init-config.sh
fi
done
# add nopasswdlogin group which does not exist initially
if ! grep -q nopasswdlogin squashfs-root/etc/group ; then
env HOME=/root LC_ALL=C chroot squashfs-root addgroup --gid 997 nopasswdlogin
fi
# Random password for live user (WARNING: Doing this will lose root access because sudo require unknown password)
#if ! grep -q hexdump squashfs-root/usr/lib/live/config/0030-user-setup ; then
# sed -e "s@\(_PASSWORD=\).*@\1\"\$(/usr/bin/hexdump -n 64 -e '1/1 \"%02x\"' /dev/random | /usr/bin/mkpasswd -s)\"@" -i"" squashfs-root/usr/lib/live/config/0030-user-setup
#fi
# Use private window for Firefox by default
if ! grep -q private-window squashfs-root/opt/apps/org.mozilla.firefox-nal/entries/applications/firefox-nal.desktop ; then
sed -e 's/\(Name=\).*/\1Firefox/' -e 's/\(Exec=.*\)/\1 --private-window %U/' -i"" squashfs-root/opt/apps/org.mozilla.firefox-nal/entries/applications/firefox-nal.desktop
fi
# Update Firefox (http://archive.mozilla.org/pub/firefox/releases/)
env HOME=/root LC_ALL=C chroot squashfs-root /opt/apps/org.mozilla.firefox-nal/files/firefox --full-version
cat << EOF
Open http://archive.mozilla.org/pub/firefox/releases If update is available, run
"/opt/apps/org.mozilla.firefox-nal/files/firefox --headless" in background. See
/opt/apps/org.mozilla.firefox-nal/files/updates/last-update.log if update was
successfully. Then, quit firefox and start in headless mode again to apply it.
If this is a major upgrade, running firefox headless will not do the trick.
Use the updater:
% ( cd /opt/apps/org.mozilla.firefox-nal/files/updates/0 ; wget --random-wait --continue -O update.mar 'https://archive.mozilla.org/pub/firefox/releases/82.0/update/linux-x86_64/en-US/firefox-82.0.complete.mar' )
% /opt/apps/org.mozilla.firefox-nal/files/updater /opt/apps/org.mozilla.firefox-nal/files/updates/0 /opt/apps/org.mozilla.firefox-nal/files /opt/apps/org.mozilla.firefox-nal/files
EOF
env HOME=/root LC_ALL=C chroot squashfs-root
env HOME=/root LC_ALL=C chroot squashfs-root /opt/apps/org.mozilla.firefox-nal/files/firefox --full-version
# minicom config file
if [ ! -e squashfs-root/etc/profile.d/minicom.sh ] ; then
cat > squashfs-root/etc/profile.d/minicom.sh << "EOF"
[ -e "${HOME}/.minirc.rk3399" ] || {
cat > "${HOME}/.minirc.rk3399" << "FOE"
pu port /dev/ttyUSB0
pu baudrate 1500000
pu bits 8
pu parity N
pu stopbits 1
pu rtscts No
FOE
}
EOF
fi
# fcitx config
if [ ! -e squashfs-root/etc/profile.d/fcitx.sh ] ; then
cat > squashfs-root/etc/profile.d/fcitx.sh << "EOF"
[ -d "${HOME}/.config/fcitx" ] || mkdir -p "${HOME}/.config/fcitx"
[ -e "${HOME}/.config/fcitx/profile" ] || {
cat > "${HOME}/.config/fcitx/profile" << "FOE"
[Profile]
# Use Full Width Character
# Available Value:
# True False
#FullWidth=False
# Use Wide Punctuation
# Available Value:
# True False
#WidePunc=True
# Prompt the phrases after input
# Available Value:
# True False
#UseRemind=False
# Current Input Method Name
IMName=sunpinyin
# Current Enabled Input Method List
EnabledIMList=fcitx-keyboard-us:True,sunpinyin:True,pinyin:True,shuangpin:True,wubi:True,cangjie3:False,quick-classic:False,emoji:True,latex:True
# Show Preedit String in Client Window
# Available Value:
# True False
#PreeditStringInClientWindow=True
FOE
[ "${LANG}" = zh_CN.UTF-8 ] || {
sed -e 's/.*\(IMName=\).*/\1quick-classic/' -e 's/\(cangjie3\|quick-classic\|emoji\|latex\):\(False\|True\)/\1:True/g' -e 's/\(sunpinyin\|pinyin\|shuangpin\|wubi\):\(False\|True\)/\1:False/g' -e 's/\(cangjie3:[a-zA-Z]*\)\(.*\)\(quick-classic:[a-zA-Z]*\)/\3\2\1/' -i"" "${HOME}/.config/fcitx/profile"
}
}
EOF
fi
# deepin theme config (overide from: /usr/share/glib-2.0/schemas ; dconf-editor and gsettings are useful commands)
if ! grep -q chromium squashfs-root/usr/share/deepin-desktop-schemas/desktop-override ; then
sed -e "s/\(docked-apps=\[\)\(.*\)firefox-esr/\1'deepin-terminal', 'org.gnome.DiskUtility', \2chromium/" -e "s/\(fullscreen=\)false/\1true/" -f - -i"" squashfs-root/usr/share/deepin-desktop-schemas/desktop-override << "EOF"
/com.deepin.dde.power/ a\
sleep-lock=false\
screen-black-lock=false\
battery-lock-delay=0\
line-power-screen-black-delay=3600\
line-power-lock-delay=0
$ a\
[com.deepin.dde.appearance]\
gtk-theme='deepin-dark'\
\
[com.deepin.wrap.gnome.desktop.wm.preferences]\
theme='deepin-dark'\
\
[com.deepin.xsettings]\
theme-name='deepin-dark'\
\
[org.gnome.desktop.screensaver]\
lock-enabled=false\
\
[com.deepin.wrap.gnome.desktop.screensaver]\
lock-enabled=false\
\
[com.deepin.wrap.gnome.desktop.lockdown]\
disable-lock-screen=true\
\
[org.gnome.desktop.lockdown]\
disable-lock-screen=true
EOF
env HOME=/root LC_ALL=C chroot squashfs-root /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas
fi
# deepin filemanager config
if [ ! -e squashfs-root/etc/profile.d/deepin-filemanager.sh ] ; then
cat > squashfs-root/etc/profile.d/deepin-filemanager.sh << "EOF"
[ -d "${HOME}/.config/deepin" ] || mkdir -p "${HOME}/.config/deepin"
[ -e "${HOME}/.config/deepin/dde-file-manager.json" ] || {
cat > "${HOME}/.config/deepin/dde-file-manager.json" << "FOE"
{
"GenericAttribute": {
"AutoMount": false,
"PreviewDocumentFile": false,
"PreviewImage": false,
"PreviewTextFile": false,
"PreviewVideo": false
}
}
FOE
}
[ -d "${HOME}/.config/systemd/user" ] || mkdir -p "${HOME}/.config/systemd/user"
[ -h "${HOME}/.config/systemd/user/gvfs-daemon.service" ] || {
ln -s /dev/null "${HOME}/.config/systemd/user/gvfs-daemon.service"
}
EOF
fi
[ -d squashfs-root/var/cache/deepin/deepin-anything ] || mkdir -p squashfs-root/var/cache/deepin/deepin-anything
[ -e squashfs-root/var/cache/deepin/deepin-anything/config.ini ] || cat > squashfs-root/var/cache/deepin/deepin-anything/config.ini << "EOF"
[General]
autoIndexInternal=false
EOF
# deepin terminal config
if [ ! -e squashfs-root/etc/profile.d/deepin-terminal.sh ] ; then
cat > squashfs-root/etc/profile.d/deepin-terminal.sh << "EOF"
[ -d "${HOME}/.config/deepin/deepin-terminal" ] || mkdir -p "${HOME}/.config/deepin/deepin-terminal"
[ -e "${HOME}/.config/deepin/deepin-terminal/config.conf" ] || {
cat > "${HOME}/.config/deepin/deepin-terminal/config.conf" << "FOE"
[advanced.cursor.auto_copy_selection]
value=true
[basic.interface.font]
value=Noto Sans Mono
[basic.interface.opacity]
value=85
[basic.interface.theme]
value=Dark
[shortcuts.workspace.next_workspace]
value=Ctrl+Tab
[shortcuts.workspace.previous_workspace]
value=Ctrl+Shift+Tab
FOE
}
[ -e "${HOME}/.config/deepin/deepin-terminal/wininfo-config.conf" ] || {
cat > "${HOME}/.config/deepin/deepin-terminal/wininfo-config.conf" << "FOE"
[General]
window_height=916
window_width=1196
FOE
}
EOF
fi
# Add x509 certificates to .pki/nssdb
if [ ! -e squashfs-root/etc/profile.d/pki-nssdb.sh ] ; then
cat > squashfs-root/etc/profile.d/pki-nssdb.sh << "EOF"
[ -d ${HOME}/.pki/nssdb ] || {
mkdir -p ${HOME}/.pki/nssdb
chmod 700 -R ${HOME}/.pki/nssdb
certutil -N -d sql:${HOME}/.pki/nssdb --empty-password
}
if ! certutil -d sql:${HOME}/.pki/nssdb -L -n "Self-signed CA" > /dev/null 2>&1 ; then
[ -e /usr/share/ca-certificates/OpenWrt/OpenWrt-ef6b-CA.crt ] && {
certutil -d sql:${HOME}/.pki/nssdb -A -t "C,," -n "Self-signed CA" -i /usr/share/ca-certificates/OpenWrt/OpenWrt-ef6b-CA.crt
openssl x509 -inform PEM -outform DM -in /usr/share/ca-certificates/OpenWrt/OpenWrt-ef6b-CA.crt -out Downloads/OpenWrt-ef6b-CA.crt
}
fi
EOF
fi
# Add git-user initialization
if [ ! -e squashfs-root/etc/profile.d/git-user.sh ] ; then
cat > squashfs-root/etc/profile.d/git-user.sh << "EOF"
gitconfuser() {
git config --global user.name "de-user"
git config --global user.email "de-user@debian.local"
}
[ -e "${HOME}/.gitconfig" ] || gitconfuser
grep -q de-user "${HOME}/.gitconfig" || gitconfuser
unset gitconfuser
EOF
fi
# Add git-lfs initialization
if [ ! -e squashfs-root/etc/profile.d/git-lfs.sh ] ; then
cat > squashfs-root/etc/profile.d/git-lfs.sh << "EOF"
[ -e "${HOME}/.gitconfig" ] || git lfs install
grep -q lfs "${HOME}/.gitconfig" || git lfs install
EOF
fi
# Add x509 certificates to share directory
[ -d squashfs-root/usr/share/ca-certificates/OpenWrt ] || mkdir -p squashfs-root/usr/share/ca-certificates/OpenWrt
for i in OpenWrt-ef6b-CA.crt ; do
if [ ! -e squashfs-root/usr/share/ca-certificates/OpenWrt/${i} ] ; then
tar cvf - -C $(dirname ${0}) ${i} | tar xf - --no-same-owner -C squashfs-root/usr/share/ca-certificates/OpenWrt
echo "OpenWrt/${i}" >> squashfs-root/etc/ca-certificates.conf
env HOME=/root LC_ALL=C chroot squashfs-root /sbin/update-ca-certificates
fi
done
# Add HP LaserJet M254 driver
[ -e squashfs-root/etc/cups/subscriptions.conf ] || {
cat > squashfs-root/etc/cups/subscriptions.conf << "EOF"
NextSubscriptionId 4
<Subscription 1>
Events printer-state-changed printer-restarted printer-shutdown printer-stopped printer-deleted job-state-changed job-created job-completed job-stopped job-progress
Owner user
LeaseDuration 86400
Interval 0
ExpirationTime 1605588586
NextEventId 4
</Subscription>
EOF
chown root:lp squashfs-root/etc/cups/subscriptions.conf
chmod 640 squashfs-root/etc/cups/subscriptions.conf
}
[ -e squashfs-root/etc/cups/printers.conf ] || {
cat > squashfs-root/etc/cups/printers.conf << "EOF"
NextPrinterId 2
<Printer HP-Color-LaserJet-M254dn>
PrinterId 1
UUID urn:uuid:c309c42e-b1ea-374b-4104-ed8a8c31c2ce
Info HP Color LaserJet M254dn
Location china
MakeModel HP ColorLaserJet M253-M254 Postscript (recommended)
DeviceURI socket://172.27.1.254
State Idle
StateTime 1605502791
ConfigTime 1605504258
Type 8425692
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
Option outputorder normal
</Printer>
EOF
chown root:lp squashfs-root/etc/cups/printers.conf
chmod 600 squashfs-root/etc/cups/printers.conf
}
[ -e squashfs-root/etc/cups/ppd/HP-Color-LaserJet-M254dn.ppd ] || {
tar cvf - -C $(dirname ${0}) HP-Color-LaserJet-M254dn.ppd | tar xf - --no-same-owner -C squashfs-root/etc/cups/ppd
chown root:lp squashfs-root/etc/cups/ppd/HP-Color-LaserJet-M254dn.ppd
chmod 640 squashfs-root/etc/cups/ppd/HP-Color-LaserJet-M254dn.ppd
}
env HOME=/root LC_ALL=C chroot squashfs-root
if [ ${?} -ne 0 ] ; then
rm squashfs-root/sbin/initctl
sudo umount /home/user/squashfs-root/dev/pts
sudo umount /home/user/squashfs-root/dev
sudo umount /home/user/squashfs-root/sys
sudo umount /home/user/squashfs-root/proc
cat << EOF
Fix the problems and try again. Unmount and delete squashfs-root if necessary.
EOF
exit 3
fi
env HOME=/root LC_ALL=C chroot squashfs-root apt clean all
env HOME=/root LC_ALL=C chroot squashfs-root dpkg-query -W --showformat='${Package} ${Version}\n' > /media/${USER}/DEEPINOS/live/filesystem.manifest
cp /media/${USER}/DEEPINOS/live/filesystem.manifest /media/${USER}/DEEPINOS/live/filesystem.manifest-desktop
# Add a partition named "common" (if exists) to fstab at boot for running xDroid
if ! grep -qs "LABEL=common /var/xdroid/overlay" squashfs-root/lib/live/boot/9990-fstab.sh ; then
sed -f - -i"" squashfs-root/lib/live/boot/9990-fstab.sh << EOF
/log_end_msg/ i\\
if [ -b /dev/disk/by-label/common ] && ! grep -qs "^LABEL=common /var/xdroid/overlay" /root/etc/fstab\\
then\\
echo "LABEL=common /var/xdroid/overlay auto lazytime,relatime,rw 0 2" >> /root/etc/fstab\\
echo "overlay /var/xdroid/common overlay lowerdir=/run/live/rootfs/xDroid.squashfs/var/xdroid/common:/run/live/rootfs/google-translate.squashfs/var/xdroid/common,upperdir=/var/xdroid/overlay/rw,workdir=/var/xdroid/overlay/work,x-systemd.requires=var-xdroid-overlay.mount 0 0" >> /root/etc/fstab\\
fi\\
EOF
fi
rm -rf squashfs-root/var/cache/apt/archives/*
rm -rf squashfs-root/tmp/* squashfs-root/root/.bash_history
rm -rf squashfs-root/etc/pam.d/*.pam-old
rm -rf squashfs-root/root/.mozilla squashfs-root/root/.cache squashfs-root/root/.viminfo
rm squashfs-root/var/lib/dbus/machine-id
rm squashfs-root/sbin/initctl
rm squashfs-root/etc/resolv.conf
rm squashfs-root/etc/hosts
env HOME=/root LC_ALL=C chroot squashfs-root dpkg-divert --rename --remove /sbin/initctl
umount squashfs-root/proc || umount -lf squashfs-root/proc
umount squashfs-root/sys
umount squashfs-root/dev/pts
umount squashfs-root/dev
rm ${fssqfspath}/filesystem.squashfs
mksquashfs squashfs-root ${fssqfspath}/filesystem.squashfs -comp xz
chmod 600 ${fssqfspath}/filesystem.squashfs
if [ -z "${FORCE}" ] ; then
if [ -z "${lmpath}" ] ; then
if [ -d "/lib/live/mount/persistence/${pdisk}/${lmpath}" ] ; then
tar cvf - --totals=USR1 -C ${fssqfspath} filesystem.squashfs | sudo -u ${USER} tar xf - --totals=USR1 -C /lib/live/mount/persistence/${pdisk}/${lmpath}
fi
elif [ $(($(blkid -p -s PART_ENTRY_SIZE -o value $(findmnt -no SOURCE /media/${USER}/DEEPINOS))/2048/1024)) -gt 2 ] ; then
tar cvf - --totals=USR1 -C ${fssqfspath} filesystem.squashfs | sudo -u ${USER} tar xf - --totals=USR1 -C /media/${USER}/DEEPINOS/live
fi
fi
printf $(du -sx --block-size=1 /media/${USER}/DEEPINOS | cut -f1) > /media/${USER}/DEEPINOS/live/filesystem.size
rm /media/${USER}/DEEPINOS/md5sum.txt
( cd /media/${USER}/DEEPINOS ; find \! -name md5sum.txt -type f -print0 | xargs -0 md5sum | grep -v 'syslinux/boot.cat\|filesystem.module' | tee md5sum.txt )
if [ -z "${FORCE}" ] && [ -d "/lib/live/mount/persistence/${pdisk}/${lmpath}" ] ; then
sed -e '/filesystem.squashfs/ d' -i"" /lib/live/mount/persistence/${pdisk}/${lmpath}/md5sum.txt
sed -n -e 's|\./live/\(filesystem.squashfs\)|\1| p' /media/${USER}/DEEPINOS/md5sum.txt | tee -a /lib/live/mount/persistence/${pdisk}/${lmpath}/md5sum.txt
fi
# Need to update the vmlinuz and initrd.lz
cat << EOF
Must reboot without "persistence" option in order to update vmlinuz/initrd.lz if
kernel or kernel modules are updated. Always run update-live.sh after the reboot
if any /lib/live/boot or initramfs related stuff is modified.
EOF
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。