| const { execSync } = require("child_process"); |
| const readline = require("readline"); |
| const fs = require("fs"); |
|
|
| function run(cmd) { |
| try { |
| execSync(cmd, { stdio: "inherit", shell: "/bin/bash" }); |
| } catch (e) { |
| console.error("Failed:", cmd); |
| } |
| } |
|
|
| const rl = readline.createInterface({ |
| input: process.stdin, |
| output: process.stdout |
| }); |
|
|
| rl.question("Google CRD SSH Code: ", (CRD_SSH_Code) => { |
|
|
| const username = "user"; |
| const password = "root"; |
| const Pin = 123456; |
| const Autostart = true; |
|
|
| try { |
|
|
| |
| run(`useradd -m ${username}`); |
| run(`adduser ${username} sudo`); |
| run(`echo "${username}:${password}" | chpasswd`); |
| run(`sed -i 's/\\/bin\\/sh/\\/bin\\/bash/g' /etc/passwd`); |
|
|
| |
| run(`apt update`); |
|
|
| |
| run(`wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb`); |
| run(`dpkg --install chrome-remote-desktop_current_amd64.deb`); |
| run(`apt install --assume-yes --fix-broken`); |
|
|
| console.log("✔ Chrome Remote Desktop Installed"); |
|
|
| |
| run(`export DEBIAN_FRONTEND=noninteractive`); |
| run(`apt install --assume-yes xfce4 desktop-base xfce4-terminal`); |
|
|
| run(`bash -c 'echo "exec /etc/X11/Xsession /usr/bin/xfce4-session" > /etc/chrome-remote-desktop-session'`); |
|
|
| run(`apt remove --assume-yes gnome-terminal`); |
| run(`apt install --assume-yes xscreensaver`); |
| run(`apt purge -y light-locker`); |
| run(`apt install --reinstall -y xfce4-screensaver`); |
| run(`systemctl disable lightdm.service`); |
|
|
| console.log("✔ XFCE Installed"); |
|
|
| |
| run(`wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb`); |
| run(`dpkg --install google-chrome-stable_current_amd64.deb`); |
| run(`apt install --assume-yes --fix-broken`); |
|
|
| console.log("✔ Chrome Installed"); |
|
|
| |
| run(`apt install --assume-yes telegram-desktop`); |
| console.log("✔ Telegram Installed"); |
|
|
| |
| run(`apt update`); |
| run(`apt install -y qbittorrent`); |
| console.log("✔ qBittorrent Installed"); |
|
|
| |
| run(`curl -s -L -k -o wallpaper.png https://gitlab.com/chamod12/changewallpaper-win10/-/raw/main/CachedImage_1024_768_POS4.jpg`); |
| run(`cp wallpaper.png /usr/share/backgrounds/xfce/ || true`); |
|
|
| console.log("✔ Wallpaper Set"); |
|
|
| |
| if (Autostart) { |
|
|
| run(`mkdir -p /home/${username}/.config/autostart`); |
|
|
| const link = "https://www.youtube.com/@The_Disala"; |
|
|
| const desktopFile = ` |
| [Desktop Entry] |
| Type=Application |
| Name=Colab |
| Exec=sh -c "sensible-browser ${link}" |
| Icon= |
| Comment=Autostart Link |
| X-GNOME-Autostart-enabled=true |
| `; |
|
|
| fs.writeFileSync( |
| `/home/${username}/.config/autostart/colab.desktop`, |
| desktopFile |
| ); |
|
|
| run(`chmod +x /home/${username}/.config/autostart/colab.desktop`); |
| run(`chown -R ${username}:${username} /home/${username}/.config`); |
|
|
| run(`adduser ${username} chrome-remote-desktop`); |
| } |
|
|
| |
| const command = `${CRD_SSH_Code} --pin=${Pin}`; |
|
|
| run(`su - ${username} -c '${command}'`); |
| run(`service chrome-remote-desktop start`); |
|
|
| |
| console.log("\n================================"); |
| console.log("CRD SETUP COMPLETE"); |
| console.log("User:", username); |
| console.log("Pass:", password); |
| console.log("PIN:", Pin); |
| console.log("================================"); |
|
|
| console.log("System running..."); |
|
|
| } catch (e) { |
| console.error("Setup error:", e); |
| } |
|
|
| rl.close(); |
| }); |