47 lines
1.7 KiB
Bash
Executable File
47 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Usage: jetbrains_first_run.sh HOME_DIR
|
|
# Settings of the JetBrains IDEs (CLion, IntelliJ IDEA, PyCharm) for the team
|
|
# account, so that the teams go straight to work:
|
|
# - user agreement accepted, no usage data sharing (first-launch questions)
|
|
# - the home directory /home/team trusted (no "Trust project?" question)
|
|
# Compiler and interpreter defaults are installed by configure_ides.py.
|
|
# The folder name under .java is how Java stores the preference node
|
|
# "privacy_policy".
|
|
set -eu
|
|
dest_home=$1
|
|
prefs="$dest_home/.java/.userPrefs/jetbrains/"$'_!(!!cg"p!(}!}@"j!(k!|w"w!\'8!b!"p!\':!e@=='
|
|
consent="$dest_home/.local/share/JetBrains/consentOptions"
|
|
mkdir -p "$prefs" "$consent"
|
|
cat > "$prefs/prefs.xml" <<'XML'
|
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
<!DOCTYPE map SYSTEM "http://java.sun.com/dtd/preferences.dtd">
|
|
<map MAP_XML_VERSION="1.0">
|
|
<entry key="eua_accepted_version" value="2.0"/>
|
|
</map>
|
|
XML
|
|
printf 'rsch.send.usage.stat:1.1:0:1791991599000' > "$consent/accepted"
|
|
|
|
for ide in pycharm intellij-idea clion; do
|
|
[ -f "/opt/$ide/product-info.json" ] || continue
|
|
dir=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["dataDirectoryName"])' "/opt/$ide/product-info.json")
|
|
options="$dest_home/.config/JetBrains/$dir/options"
|
|
mkdir -p "$options"
|
|
cat > "$options/trusted-paths.xml" <<'XML'
|
|
<application>
|
|
<component name="Trusted.Paths.Settings">
|
|
<option name="TRUSTED_PATHS">
|
|
<list>
|
|
<option value="/home/team" />
|
|
</list>
|
|
</option>
|
|
</component>
|
|
</application>
|
|
XML
|
|
|
|
done
|
|
|
|
if [ "$dest_home" != /etc/skel ]; then
|
|
owner=$(stat -c %U:%G "$dest_home")
|
|
chown -R "$owner" "$dest_home/.java" "$dest_home/.local" "$dest_home/.config/JetBrains"
|
|
fi
|