Added a very unsafe auto update tool.
This commit is contained in:
parent
34c2b9e8d3
commit
144fa010cb
2 changed files with 84 additions and 19 deletions
|
@ -1,12 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script configures the machines to auto-launch Moonlight streaming on startup.
|
||||
|
||||
# This script configures converted Lenovo N42 ChromeBooks loaded with Linux Mint XFCE.
|
||||
|
||||
|
||||
function configureMachine() {
|
||||
|
||||
# Update everything.
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D5AFC5E2A4987676 241FE6973B765FAE
|
||||
apt-get -y update
|
||||
apt-get -y upgrade
|
||||
apt-get -y dist-upgrade
|
||||
|
@ -15,16 +15,26 @@ function configureMachine() {
|
|||
# Tools for us.
|
||||
apt-get -y install mc joe openssh-server
|
||||
|
||||
# Disable screensaver.
|
||||
sed -i 's/mode:[[:space:]]*blank/mode: off/' /home/${SUDO_USER}/.xscreensaver
|
||||
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-enabled -t bool -s false
|
||||
# Disable screensaver/blanking/dimming.
|
||||
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-enabled -t bool -s false --create
|
||||
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/blank-on-ac -s 0 --create
|
||||
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/brightness-on-ac -s 9 --create
|
||||
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/brightness-level-on-ac -s 100 --create
|
||||
|
||||
# Change clock format.
|
||||
plugin_name="$( xfconf-query -c xfce4-panel -p /plugins -lv | grep -E '/plugins/plugin-[0-9]+.*clock' | cut -d" " -f '1-1' )"
|
||||
xfconf-query -c xfce4-panel -p ${plugin_name}/digital-format -t "string" -s '<span font="18">%T</span>%n<span font="12">%Y-%m-%d</span>' -n
|
||||
xfconf-query -c xfce4-panel -p ${plugin_name}/digital-time-format -t "string" -s '%l:%M:%S %P' --create
|
||||
xfconf-query -c xfce4-panel -p ${plugin_name}/digital-date-format -t "string" -s '%b %d, %Y' --create
|
||||
|
||||
# Disable unneeded desktop services.
|
||||
mkdir -p /home/${SUDO_USER}/.config/autostart
|
||||
declare -a disable=("light-locker" "mintreport" "mintupdate" "mintwelcome" "nvidia-prime" "sticky" "warpinator-autostart")
|
||||
for i in "${disable[@]}"; do
|
||||
echo -e "[Desktop Entry]\nHidden=True\n" > /home/${SUDO_USER}/.config/autostart/${i}.desktop
|
||||
done
|
||||
chown -R ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/.config/autostart
|
||||
|
||||
# Install Moonlight.
|
||||
apt-get -y install flatpak
|
||||
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
flatpak install -y flathub com.moonlight_stream.Moonlight
|
||||
|
||||
|
@ -37,29 +47,72 @@ function configureMachine() {
|
|||
# Add icon to desktop
|
||||
cat <<- ICON > /home/${SUDO_USER}/Desktop/Moonlight.desktop
|
||||
[Desktop Entry]
|
||||
Version 1.0
|
||||
Type Application
|
||||
Name Moonlight
|
||||
Comment Game Streaming Client
|
||||
Exec /home/${SUDO_USER}/moonlight.sh
|
||||
icon palemoon
|
||||
Path /home/${SUDO_USER}
|
||||
Terminal false
|
||||
StartupNotify false
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Name=Moonlight
|
||||
Comment=Game Streaming Client
|
||||
Exec=/home/${SUDO_USER}/moonlight.sh
|
||||
Icon=network-idle
|
||||
Path=/home/${SUDO_USER}
|
||||
Terminal=false
|
||||
StartupNotify=false
|
||||
ICON
|
||||
chown ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/Desktop/Moonlight.desktop
|
||||
|
||||
|
||||
:<<SKIP
|
||||
# Make Moonlight run on startup.
|
||||
mkdir -p /home/${SUDO_USER}/.config/autostart
|
||||
ln -s /home/${SUDO_USER}/Desktop/Moonlight.desktop /home/${SUDO_USER}/.config/autostart/.
|
||||
chown -R ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/.config
|
||||
chown -R ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/.config/autostart/Moonlight.desktop
|
||||
SKIP
|
||||
|
||||
# Remove unnwanted software.
|
||||
apt-get -y purge evolution-data-server
|
||||
|
||||
# Create auto-update script.
|
||||
apt-get -y install shc
|
||||
cat <<- UPDATE > /home/${SUDO_USER}/unsafe-update.sh
|
||||
#!/bin/bash
|
||||
###
|
||||
### THIS IS TOTALLY NOT A SECURE WAY TO UPDATE ANYTHING! ###
|
||||
###
|
||||
if [[ -f unsafe-update-payload.sh ]]; then
|
||||
rm -f unsafe-update-payload.sh
|
||||
fi
|
||||
wget https://forge.duensing.digital/Duensing_Digital/chromebook-linux/raw/branch/master/unsafe-update-payload.sh
|
||||
if [[ -f unsafe-update-payload.sh ]]; then
|
||||
source unsafe-update-payload.sh
|
||||
unsafeUpdate
|
||||
fi
|
||||
UPDATE
|
||||
shc -S -f /home/${SUDO_USER}/unsafe-update.sh
|
||||
chmod u+s /home/${SUDO_USER}/unsafe-update.sh.x
|
||||
rm /home/${SUDO_USER}/unsafe-update.sh.x.c
|
||||
|
||||
# Add auto update icon to autostart.
|
||||
cat <<- ICON > /home/${SUDO_USER}/.config/autostart/AutoUpdate.desktop
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Name=Auto Update
|
||||
Comment=Duensing Digital Client Auto Update
|
||||
Exec=/home/${SUDO_USER}/unsafe-update.sh.x
|
||||
Icon=mintupdate-type-backport
|
||||
Path=/home/${SUDO_USER}
|
||||
Terminal=true
|
||||
StartupNotify=false
|
||||
ICON
|
||||
chown ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/.config/autostart/AutoUpdate.desktop
|
||||
|
||||
# Reboot!
|
||||
reboot
|
||||
}
|
||||
|
||||
|
||||
if [[ ${EUID} -ne 0 ]]; then
|
||||
echo "${0} must be run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# All the config is in a function so we can stream this script from forge.duensing.digital.
|
||||
sudo configureMachine
|
||||
configureMachine
|
||||
|
|
12
unsafe-update-payload.sh
Normal file
12
unsafe-update-payload.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
function unsafeUpdate() {
|
||||
# Handle system updates.
|
||||
apt-get update
|
||||
apt-get -fy upgrade
|
||||
apt-get -fy dist-upgrade
|
||||
apt-get -fy autoremove
|
||||
if [[ -f /var/run/reboot-required ]] then
|
||||
shutdown -r now
|
||||
fi
|
||||
|
||||
# Additional updates.
|
||||
}
|
Loading…
Add table
Reference in a new issue