## voir https://github.com/tiredofit/docker-gcds/blob/main/Dockerfile

cat <<EOF>/etc/apt/apt.conf.d/99-cache
  Acquire::http {
  Proxy "http://apt-cacher.infra.leolagrange.org:3142";
};
EOF
apt update
apt dist-upgrade -y
#Pourle fonctionnement de l'application
apt install -y xrdp xorgxrdp locales wget ca-certificates lwm libxtst6 libxi6 firefox-esr 
dpkg-reconfigure locales

# Pour la fenetre graphique de xrdp et le fonctionnement de l'ouverture du navigateur
# Il doit ĂȘtre possible d'enlever des packages de la liste
apt install -y xfce4 dbus-x11 libsynctex2 libatrildocument3 libatrilview3 libcaja-extension1 atril \
	baobab catfish cheese-common libcrack2 cracklib-runtime engrampa-common engrampa libportaudio2 \
	libsonic0 espeak-data libespeak1 espeak espeak-ng-data libbabeltrace1 libdebuginfod1 libipt2 \
	libsource-highlight-common libboost-regex1.74.0 libsource-highlight4v5 gir1.2-atspi-2.0 gir1.2-cogl-1.0 \
	gir1.2-coglpango-1.0 gir1.2-json-1.0 gir1.2-clutter-1.0 gir1.2-gstreamer-1.0 libclutter-gst-3.0-0 \
	libcheese8 gir1.2-cheese-3.0 libgnome-menu-3-0 gir1.2-gmenu-3.0 gir1.2-gst-plugins-base-1.0 gir1.2-gtkclutter-1.0 \
	gir1.2-libxfce4ui-2.0 gir1.2-polkit-1.0 libpeas-common libpeas-1.0-0 libtotem-plparser-common libtotem-plparser18 \
	librhythmbox-core10 gir1.2-rb-3.0 libpwquality-common libpwquality1 gnome-disk-utility gnome-font-viewer \
	gnome-menus libgnome-games-support-common libgnome-games-support-1-3 gnome-mines gnome-software-common \
	libmalcontent-0-0 gnome-software gnome-software-plugin-snap libqqwing2v5 gstreamer1.0-pulseaudio \
	libcdio-cdda2 libcdio-paranoia2 libmtp-common libmtp9 libnfs13 gvfs-backends gvfs-fuse im-config \
	libao-common libao4 libbrlapi0.8 libburn4 libdmapsharing-3.0-2 libdotconf0 libpcaudio0 libespeak-ng1 \
	libevent-2.1-7 libgpod4 libgpod-common libgrilo-0.3-0 libgtop2-common libgtop-2.0-11 libjte2 libisofs6 \
	libminiupnpc17 libmtp-runtime libnatpmp1 system-tools-backends liboobs-1-5 libpcre2-32-0 libqrencode4 \
	libtagc0 libtumbler-1-0 libxfce4ui-utils lightdm-gtk-greeter-settings media-player-info menulibre mugshot \
	pastebinit python3-ply python3-pycparser python3-cffi python3-markupsafe python3-mako python3-xcffib \
	liblirc-client0 gir1.2-peas-1.0 sgt-puzzles speech-dispatcher-audio-plugins tree tumbler-common tumbler \
	brltty brltty-x11 cups-pk-helper gnome-system-tools inxi libc6-dbg xbrlapi xfce4-places-plugin

useradd -m -s /usr/bin/bash gcds
cat << EOF > /home/gcds/.xsession
/home/gcds/GoogleCloudDirSync/config-manager &
xfce4-session
EOF
passwd gcds
su - gcds
export https_proxy=http://squid:3128
export http_proxy=http://squid:3128
GCDS_VERSION=5.0.22
wget https://dl.google.com/dirsync/Google/GoogleCloudDirSync_linux_64bit_${GCDS_VERSION//./_}.sh -O /tmp/install.sh
bash /tmp/install.sh
rm /tmp/install.sh