From 845e1aa1fcaef8fbae1d2410a5f5b74957437b8f Mon Sep 17 00:00:00 2001 From: Devin Dice Date: Sun, 14 Aug 2022 00:43:22 -0400 Subject: [PATCH] Reconfigured users home directory --- Dockerfile.amd64 | 10 +++-- rootfs/cloud9/configure_desktop.sh | 1 - rootfs/etc/supervisor/conf.d/supervisord.conf | 2 +- rootfs/startup.sh | 38 +++++++++++++------ rootfs/usr/share/backgrounds/dynamic.sh | 1 - 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 index 5d05641..2d177f6 100644 --- a/Dockerfile.amd64 +++ b/Dockerfile.amd64 @@ -95,8 +95,8 @@ RUN mkdir /workspace # Clone and install cloud9 RUN git clone https://github.com/c9/core.git /cloud9/c9sdk -RUN mkdir -p /cloud9/c9sdk/build /workspace/.ubuntu/.standalone -RUN ln -sf /workspace/.ubuntu/.standalone /cloud9/c9sdk/build/standalone +#RUN mkdir -p /cloud9/c9sdk/build /workspace/.ubuntu/.standalone +#RUN ln -sf /workspace/.ubuntu/.standalone /cloud9/c9sdk/build/standalone RUN /cloud9/c9sdk/scripts/install-sdk.sh RUN cd /cloud9/c9sdk && git reset --hard RUN wget -O user-install.sh https://raw.githubusercontent.com/c9/install/master/install.sh && mv user-install.sh /cloud9/ @@ -161,7 +161,8 @@ RUN echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null RUN apt-get update -RUN apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin menulibre python3-pip keychain python3.8-venv strace gedit gvfs-backends +RUN apt-get -y install menulibre python3-pip keychain python3.8-venv strace gedit gvfs-backends +RUN apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin RUN wget -O beyond-compare.deb https://www.scootersoftware.com/$(curl -sd "platform=linux" https://www.scootersoftware.com/download.php | grep amd64.deb | awk -F\" '{print $2}' | sed 's/\///g') RUN wget -O sublime-text.deb $(curl -s https://www.sublimetext.com/download_thanks?target=x64-deb#direct-downloads | grep amd64.deb | grep url | awk -F'"' '{print $2}') @@ -172,4 +173,5 @@ RUN apt install -y ./beyond-compare.deb ./sublime-text.deb ./sublime-merge.deb . RUN npm -g install sass yuglify # Copy files -COPY rootfs / \ No newline at end of file +COPY rootfs / +RUN rm -rf /workspace/* \ No newline at end of file diff --git a/rootfs/cloud9/configure_desktop.sh b/rootfs/cloud9/configure_desktop.sh index 37f68e6..72eb475 100644 --- a/rootfs/cloud9/configure_desktop.sh +++ b/rootfs/cloud9/configure_desktop.sh @@ -11,7 +11,6 @@ sleep 5 DBUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-) echo "DBUS Session Address: $DBUS_ADDRESS" -echo "$DBUS_ADDRESS" > /var/log/dbus.txt export DBUS_SESSION_BUS_ADDRESS export DISPLAY=:1.0 diff --git a/rootfs/etc/supervisor/conf.d/supervisord.conf b/rootfs/etc/supervisor/conf.d/supervisord.conf index 970d49d..df60d06 100644 --- a/rootfs/etc/supervisor/conf.d/supervisord.conf +++ b/rootfs/etc/supervisor/conf.d/supervisord.conf @@ -50,6 +50,6 @@ command=bash -c 'while ps aux | grep user-install.sh | grep -v grep 2>&1> /dev/n [program:desktop] priority=30 -directory=/workspace/.ubuntu/dynamic-background/active +directory=/home/%USER%/.dynamic-background/active user=%USER% command=bash /usr/share/backgrounds/dynamic.sh \ No newline at end of file diff --git a/rootfs/startup.sh b/rootfs/startup.sh index e79999e..89db59e 100755 --- a/rootfs/startup.sh +++ b/rootfs/startup.sh @@ -31,7 +31,8 @@ USER=${USER:-root} HOME=/root if [ "$USER" != "root" ]; then echo "* enable custom user: $USER" - useradd --create-home --shell /bin/bash --user-group --groups adm,sudo,docker -d /workspace/.home/$USER $USER + #useradd --create-home --shell /bin/bash --user-group --groups adm,sudo,docker -d /workspace/.home/$USER $USER + useradd --create-home --shell /bin/bash --user-group --groups adm,sudo,docker $USER if [ -z "$PASSWORD" ]; then echo " set default password to \"ubuntu\"" @@ -41,7 +42,8 @@ if [ "$USER" != "root" ]; then PASSWORD=$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20) fi - HOME=/workspace/.home/$USER + #HOME=/workspace/.home/$USER + HOME=/home/$USER echo "$USER:$PASSWORD" | chpasswd cp -r /root/{.config,.gtkrc-2.0,.asoundrc} ${HOME} chown -R $USER:$USER ${HOME} @@ -86,27 +88,39 @@ if [ -n "$DOMAIN" ]; then fi # Reduce this so its not everything -chown -R $USER:$USER $HOME /cloud9 /workspace/.c9 /workspace/.$USER +#chown -R $USER:$USER $HOME /cloud9 /workspace # Add required packages for ubuntu user (Run as user) -rm -rf $HOME/.c9 -mkdir -p /workspace/.c9 -chown $USER:$USER /workspace/.c9 -sudo -H -u $USER bash -c 'bash /cloud9/user-install.sh' 2>&1> /workspace/.c9/install.log & +#rm -rf $HOME/.c9 +#mkdir -p /workspace/.c9 +#chown $USER:$USER /workspace/.c9 +sudo -H -u $USER bash -c 'bash /cloud9/user-install.sh' 2>&1> /home/$USER/.cloud9-install.log & # Only for testing while editing the menu -chown $USER /usr/share/applications/ +#chown $USER /usr/share/applications/ # Setup Backgrounds -mkdir -p /workspace/.ubuntu/dynamic-background/active/ +mkdir -p /home/$USER/.dynamic-background/active/ for BACKGROUND in $(ls -1 /usr/share/backgrounds/dynamic-background/ | grep -v -e "active" -e "default" ); do - cp -r /usr/share/backgrounds/dynamic-background/$BACKGROUND /workspace/.ubuntu/dynamic-background/ + cp -r /usr/share/backgrounds/dynamic-background/$BACKGROUND /home/$USER/.dynamic-background/active/ done -if [ ! "$(ls -A /workspace/.ubuntu/dynamic-background/active/ )" ]; then - cp -r /usr/share/backgrounds/dynamic-background/default/* /workspace/.ubuntu/dynamic-background/active +if [ ! "$(ls -A /home/$USER/.dynamic-background/active/ )" ]; then + cp -r /usr/share/backgrounds/dynamic-background/default/* /home/$USER/.dynamic-background/active/ fi bash /cloud9/configure_desktop.sh & +mkdir /home/$USER/Workspace +chown $USER:$USER /home/$USER/Workspace +echo "/home/$USER/Workspace /workspace none defaults,bind 0 0" >> /etc/fstab +mount -a + +mkdir /home/$USER/.config/gtk-3.0 +chown $USER:$USER /home/$USER/.config/gtk-3.0 +echo "file:///home/$USER/Documents" > /home/$USER/.config/gtk-3.0/bookmarks +echo "file:///home/$USER/Workspace" >> /home/$USER/.config/gtk-3.0/bookmarks +echo "file:///home/$USER/Workspace/Company%20Files" >> /home/$USER/.config/gtk-3.0/bookmarks +echo "file:///home/$USER/Downloads" >> /home/$USER/.config/gtk-3.0/bookmarks + exec /bin/tini -- supervisord -n -c /etc/supervisor/supervisord.conf \ No newline at end of file diff --git a/rootfs/usr/share/backgrounds/dynamic.sh b/rootfs/usr/share/backgrounds/dynamic.sh index 39f43db..54396c5 100644 --- a/rootfs/usr/share/backgrounds/dynamic.sh +++ b/rootfs/usr/share/backgrounds/dynamic.sh @@ -1,5 +1,4 @@ OLD_FILE="" -DBUS_FILE="/var/log/dbus.txt" DIR=$(pwd) export DISPLAY=:1.0