Browse Source

Merge pull request #753 from 01-edu/add-vscode

Add vscode
content-update
xpetit 3 years ago committed by GitHub
parent
commit
36cbfc51eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 85
      sh/debian/ubuntu/configure.sh
  2. 2
      sh/debian/ubuntu/dconfig.txt
  3. 34
      sh/debian/ubuntu/set.sh
  4. 21
      sh/debian/ubuntu/setup.sh

85
sh/debian/ubuntu/configure.sh diff.vendored

@ -2,12 +2,31 @@
# Configure Z01 Ubuntu
set -euo pipefail
IFS='
'
# The value of this parameter is expanded like PS1 and the expanded value is the
# prompt printed before the command line is echoed when the -x option is set
# (see The Set Builtin). The first character of the expanded value is replicated
# multiple times, as necessary, to indicate multiple levels of indirection.
# \D{%F %T} prints date like this : 2019-12-31 23:59:59
PS4='-\D{%F %T} '
# Print commands and their arguments as they are executed.
set -x
# Log stdout & stderr
exec > >(tee -i /tmp/install_ubuntu.log) 2>&1
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)"
cd $script_dir
. set.sh
script_dir="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$script_dir"
# Skip dialogs during apt-get install commands
export DEBIAN_FRONTEND=noninteractive # DEBIAN_PRIORITY=critical
export LC_ALL=C LANG=C
export SHELL=/bin/bash
disk=$(lsblk -o tran,kname,hotplug,type,fstype -pr |
grep '0 disk' |
@ -68,22 +87,21 @@ EOF
for dir in $(ls -1d /root /home/* 2>/dev/null ||:)
do
# Hide login informations
touch $dir/.hushlogin
touch "$dir/.hushlogin"
# Add convenient aliases & behaviors
cat <<-'EOF'>> $dir/.bashrc
cat <<-'EOF'>> "$dir/.bashrc"
export LS_OPTIONS="--color=auto"
eval "`dircolors`"
alias df="df --si"
alias du="du -cs --si"
alias du="du --si"
alias free="free -h --si"
alias l="ls $LS_OPTIONS -al --si --group-directories-first"
alias less="less -i"
alias nano="nano -clDOST4"
alias pstree="pstree -palU"
GOPATH=$HOME/go
HISTCONTROL=ignoreboth
HISTFILESIZE=
HISTSIZE=
@ -92,7 +110,7 @@ do
# Fix rights
usr=$(echo "$dir" | rev | cut -d/ -f1 | rev)
chown -R $usr:$usr $dir ||:
chown -R "$usr:$usr" "$dir" ||:
done
# Install OpenSSH
@ -139,22 +157,24 @@ grub-install "$disk"
wget https://dl.google.com/go/go1.16.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.16.linux-amd64.tar.gz
rm go1.16.linux-amd64.tar.gz
# shellcheck disable=2016
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
# Set-up all users
for dir in $(ls -1d /root /home/* 2>/dev/null ||:)
do
# Add convenient aliases & behaviors
cat <<-'EOF'>> $dir/.bashrc
cat <<-'EOF'>> "$dir/.bashrc"
GOPATH=$HOME/go
PATH=$PATH:$GOPATH/bin
alias gobuild='CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w"'
EOF
echo 'GOPATH=$HOME/go' >> $dir/.profile
# shellcheck disable=2016
echo 'GOPATH=$HOME/go' >> "$dir/.profile"
# Fix rights
usr=$(echo "$dir" | rev | cut -d/ -f1 | rev)
chown -R $usr:$usr $dir ||:
chown -R "$usr:$usr" "$dir" ||:
done
# Install Node.js
@ -178,7 +198,13 @@ EOF
apt-get --no-install-recommends update
apt-get --no-install-recommends install -y sublime-text sublime-merge libgtk2.0-0
# Install VSCode
# Install Visual Studio Code
wget 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64' --output-document vscode.deb
dpkg -i vscode.deb
rm vscode.deb
# Install VSCodium
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | apt-key add -
echo 'deb https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/debs/ vscodium main' >> /etc/apt/sources.list.d/vscodium.list
@ -186,31 +212,34 @@ echo 'deb https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/debs/ vscodium mai
apt-get --no-install-recommends update
apt-get --no-install-recommends install -y codium
ln -s /usr/bin/codium /usr/local/bin/code ||:
# Set-up all users
for dir in $(ls -1d /home/* 2>/dev/null ||:)
do
# Disable most of the telemetry and auto-updates
mkdir -p $dir/.config/VSCodium/User
cat <<-'EOF'> $dir/.config/VSCodium/User/settings.json
mkdir -p "$dir/.config/Code/User"
mkdir -p "$dir/.config/VSCodium/User"
cat <<-'EOF' | tee \
"$dir/.config/Code/User/settings.json" \
"$dir/.config/VSCodium/User/settings.json"
{
"extensions.autoCheckUpdates": false,
"extensions.autoUpdate": false,
"json.schemaDownload.enable": false,
"npm.fetchOnlinePackageInfo": false,
"settingsSync.keybindingsPerPlatform": false,
"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false,
"update.enableWindowsBackgroundUpdates": false,
"update.mode": "none",
"update.showReleaseNotes": false,
"extensions.autoCheckUpdates": false,
"extensions.autoUpdate": false,
"workbench.enableExperiments": false,
"workbench.settings.enableNaturalLanguageSearch": false,
"npm.fetchOnlinePackageInfo": false
"workbench.settings.enableNaturalLanguageSearch": false
}
EOF
# Fix rights
usr=$(echo "$dir" | rev | cut -d/ -f1 | rev)
chown -R $usr:$usr $dir ||:
chown -R "$usr:$usr" "$dir" ||:
done
# Install LibreOffice
@ -269,6 +298,7 @@ whoopsie
xdg-desktop-portal
"
# shellcheck disable=2086
apt-get -y purge $pkgs
apt-get -y autoremove --purge
@ -293,6 +323,7 @@ virtualbox
xfsprogs
zenity
"
# shellcheck disable=2086
apt-get --no-install-recommends -y install $pkgs
# Disable services
@ -305,12 +336,14 @@ keyboard-setup.service
motd-news.timer
remote-fs.target
"
# shellcheck disable=2086
systemctl disable $services
services="
grub-common.service
plymouth-quit-wait.service
"
# shellcheck disable=2086
systemctl mask $services
# Disable GTK hidden scroll bars
@ -384,7 +417,7 @@ cd /tmp/system
cp --preserve=mode -RT . /
cd $script_dir
cd "$script_dir"
rm -rf /tmp/system
if ! test -v PERSISTENT; then
@ -448,12 +481,12 @@ apt-get install
rm -rf /root/.local
# Remove connection logs
> /var/log/lastlog
> /var/log/wtmp
> /var/log/btmp
echo > /var/log/lastlog
echo > /var/log/wtmp
echo > /var/log/btmp
# Remove machine ID
> /etc/machine-id
echo > /etc/machine-id
# Remove logs
cd /var/log

2
sh/debian/ubuntu/dconfig.txt diff.vendored

@ -116,7 +116,7 @@ ambient-enabled=false
[org/gnome/shell]
enable-hot-corners=true
favorite-apps=['firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'sublime_text.desktop', 'codium.desktop', 'org.gnome.Calculator.desktop', 'gnome-control-center.desktop', 'org.gnome.tweaks.desktop', 'lock_screen.desktop', 'suspend_session.desktop', 'yelp.desktop']
favorite-apps=['firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'sublime_text.desktop', 'code.desktop', 'codium.desktop', 'org.gnome.Calculator.desktop', 'gnome-control-center.desktop', 'org.gnome.tweaks.desktop', 'lock_screen.desktop', 'suspend_session.desktop', 'yelp.desktop']
[org/gnome/system/location]
enabled=false

34
sh/debian/ubuntu/set.sh diff.vendored

@ -1,34 +0,0 @@
#!/usr/bin/env bash
# Set scripting variables
# Treat unset variables as an error when substituting.
set -u
# Exit immediately if a command exits with a non-zero status.
set -e
# Set the variable corresponding to the return value of a pipeline is the status
# of the last command to exit with a non-zero status, or zero if no command
# exited with a non-zero status
set -o pipefail
# Separate tokens on newlines only
IFS='
'
# The value of this parameter is expanded like PS1 and the expanded value is the
# prompt printed before the command line is echoed when the -x option is set
# (see The Set Builtin). The first character of the expanded value is replicated
# multiple times, as necessary, to indicate multiple levels of indirection.
# \D{%F %T} prints date like this : 2019-12-31 23:59:59
PS4='-\D{%F %T} '
# Print commands and their arguments as they are executed.
set -x
# Skip dialogs during apt-get install commands
export DEBIAN_FRONTEND=noninteractive # DEBIAN_PRIORITY=critical
export LC_ALL=C LANG=C
export SHELL=/bin/bash

21
sh/debian/ubuntu/setup.sh diff.vendored

@ -2,9 +2,22 @@
# Setup everything
script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)"
cd $script_dir
. set.sh
set -euo pipefail
IFS='
'
# The value of this parameter is expanded like PS1 and the expanded value is the
# prompt printed before the command line is echoed when the -x option is set
# (see The Set Builtin). The first character of the expanded value is replicated
# multiple times, as necessary, to indicate multiple levels of indirection.
# \D{%F %T} prints date like this : 2019-12-31 23:59:59
PS4='-\D{%F %T} '
# Print commands and their arguments as they are executed.
set -x
script_dir=$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)
cd "$script_dir"
repo_dir=$(git rev-parse --show-toplevel)
@ -12,6 +25,6 @@ gsettings set org.gnome.desktop.session idle-delay 0
gsettings set org.gnome.desktop.screensaver lock-enabled false
sudo -E ./configure.sh
cat dconfig.txt | dconf load /
dconf load / < dconfig.txt
rm -rf "$repo_dir"
reboot

Loading…
Cancel
Save