-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
309 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#!/bin/bash | ||
|
||
# User-username: user | ||
|
||
######################################### | ||
# USER # | ||
######################################### | ||
|
||
printf 'Where is the remote webserver presenting the NTOS files? ' | ||
read -r web_address | ||
|
||
printf 'What rdp file do you need for this configuration? (remove the .rdp from the name)(case sensitive) ' | ||
read -r rdp_name | ||
|
||
printf 'What should the hostname be? ' | ||
read -r new_hostname | ||
|
||
echo -e '\nCustomizing user environment...' | ||
|
||
echo "Grabbing ${rdp_name}.rdp from NTOS server." | ||
curl -s "${web_address}"/rdp/"${rdp_name}".rdp > /home/user/Templates/remote-connection.rdp | ||
|
||
echo "Grabbing Credcon from NTOS server." | ||
curl -s "${web_address}"/credcon/credcon.sh > /home/user/Templates/credcon.sh | ||
|
||
# Download the file to /home/user/Templates (runs as the normal user) | ||
echo "Grabbing panel profile from NTOS server." | ||
wget -q "${web_address}"/assets/panel-profile.tar.bz2 -P /home/user/Templates | ||
|
||
echo "Applying panel profile..." | ||
xfce4-panel-profiles load /home/user/Templates/panel-profile.tar.bz2 | ||
|
||
# Set theme to Adwaita-Dark. | ||
xfconf-query -c xsettings -p '/Net/ThemeName' -s 'Adwaita-dark' | ||
xfconf-query -c xsettings -p '/Net/IconThemeName' -s 'Adwaita' | ||
xfconf-query -c xsettings -p '/Gtk/CursorThemeName' -s 'Adwaita' | ||
|
||
# Customize logout screen. | ||
xfconf-query -c xfce4-session -np '/shutdown/ShowHibernate' -t 'bool' -s 'false' | ||
xfconf-query -c xfce4-session -np '/shutdown/ShowSuspend' -t 'bool' -s 'false' | ||
xfconf-query -c xfce4-session -np '/shutdown/ShowHybridSleep' -t 'bool' -s 'false' | ||
xfconf-query -c xfce4-session -np '/shutdown/ShowSwitchUser' -t 'bool' -s 'false' | ||
xfconf-query -c xfce4-session -np '/shutdown/LockScreen' -t 'bool' -s 'false' | ||
|
||
# Limit workspaces (Like Virtual Desktops in Windows). | ||
xfconf-query -c xfwm4 -p /general/workspace_count -s 1 | ||
|
||
# Desktop itself customization. | ||
xfconf-query -c xfce4-desktop -np '/desktop-icons/style' -t 'int' -s '0' | ||
xfconf-query -c xfce4-desktop -np '/desktop-menu/show' -t 'bool' -s 'false' | ||
xfconf-query -c xfce4-desktop -np '/windowlist-menu/show-add-remove-workspaces' -t 'bool' -s 'false' | ||
|
||
# Disable logout on screenlock and such things. (Unneeded without light-locker) | ||
xfconf-query -c xfce4-power-manager -np '/xfce4-power-manager/lock-screen-suspend-hibernate' -t 'bool' -s 'false' | ||
xfconf-query -c xfce4-power-manager -np '/xfce4-power-manager/logind-handle-lid-switch' -t 'bool' -s 'false' | ||
|
||
# Configure the span monitor option. | ||
xfconf-query -c xfce4-panel -np '/panels/panel-1/span-monitors' -t 'bool' -s 'true' | ||
|
||
# Enable automounting | ||
xfconf-query -c thunar-volman -np '/automount-drives/enabled' -t 'bool' -s 'true' | ||
xfconf-query -c thunar-volman -np '/automount-media/enabled' -t 'bool' -s 'true' | ||
|
||
# Apply rounding GTK-3.0 CSS. | ||
mkdir -p /home/user/.config/gtk-3.0/ | ||
curl -s "${web_address}"/assets/gtk.css > /home/user/.config/gtk-3.0/gtk.css | ||
xfce4-panel -r | ||
|
||
# Set a nice looking background. | ||
wget -q "${web_address}"/assets/desktop.png -P /home/user/Templates | ||
xfconf-query -c xfce4-desktop -p $(xfconf-query -c xfce4-desktop -l | grep "workspace0/last-image") -s /home/user/Templates/desktop.png | ||
|
||
######################################### | ||
# ROOT # | ||
######################################### | ||
|
||
echo -e '\nEscalating for remote management agent installation...' | ||
|
||
# Use su to switch to root and run commands interactively | ||
su root -c " | ||
# Start agent installation for remote management. (e.g. MeshCentral, NinjaRMM, ConnectWise RMM, N-Able, etc...) | ||
# End agent installation for remote management. | ||
hostname $new_hostname && | ||
echo $new_hostname > /etc/hostname && | ||
sed -i 's/^127\.0\.1\.1.*/127.0.1.1 $new_hostname/' /etc/hosts && | ||
# Check if the source file exists before copying | ||
sleep 3s # Add some sleep for the machine to process everything. | ||
if [ -f '/home/user/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml' ]; then | ||
echo 'Source xfce4-panel.xml found. Proceeding with copy.' | ||
# Copy xfce4-panel.xml to the system-wide config directory | ||
cp /home/user/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/ && | ||
echo 'Successfully copied xfce4-panel.xml to /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/' && | ||
# Lock the panel configuration | ||
sed -i 's|<channel name=\"xfce4-panel\" version=\"1.0\">|<channel name=\"xfce4-panel\" version=\"1.0\" locked=\"*\" unlocked=\"root\">|' /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml && | ||
echo 'Successfully applied the lock to xfce4-panel.xml' | ||
else | ||
echo 'Error: Source xfce4-panel.xml not found at /home/user/.config/xfce4/xfconfxfce-perchannel-xml/xfce4-panel.xml' | ||
fi | ||
# Removing both xfce4-keyboard shortcuts to be sure. | ||
echo 'Removing keyboard shortcuts' | ||
rm /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml | ||
rm /home/user/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml | ||
mkdir -p /home/user/.config/autostart | ||
cp /etc/xdg/autostart/light-locker.desktop /home/user/.config/autostart | ||
echo 'Hidden=true' >> /home/user/.config/autostart/light-locker.desktop | ||
echo -e '\nPending reboot, press any key to reboot.' | ||
read doReboot | ||
/sbin/reboot now | ||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Basic settings | ||
d-i debian-installer/locale select en_US.UTF-8 | ||
d-i localechooser/supported-locales multiselect | ||
d-i keyboard-configuration/xkb-keymap select us | ||
d-i cdrom-detect/success note | ||
d-i anna/choose_modules multiselect | ||
|
||
# use autoconfig for networking which will use DHCP | ||
d-i netcfg/disable_autoconfig boolean false | ||
d-i netcfg/link_wait_timeout string 2 | ||
d-i netcfg/get_domain string local | ||
|
||
# this line can be commented out if you do not want to preset the DNS servers | ||
d-i netcfg/get_nameservers string 9.9.9.9 8.8.8.8 | ||
|
||
# mirror settings | ||
d-i mirror/country string NL | ||
d-i mirror/http/hostname string deb.debian.org | ||
d-i mirror/http/directory string /debian/ | ||
d-i mirror/http/proxy string | ||
|
||
# disable the root account password [Welkom01!] you can also set your own password with bcrypt. | ||
d-i passwd/root-login boolean true | ||
d-i passwd/root-password-crypted password $y$j9T$PW2rQYwHkL2JYD7h8V2SM/$X5/lTTFJHNz3OlWgUHfP2GjXaycZe19D.HEMq81SIi5 | ||
|
||
# user account setup [Welkom01!] you can also set your own password with bcrypt. | ||
d-i passwd/user-fullname string User | ||
d-i passwd/username string user | ||
d-i passwd/user-password-crypted password $y$j9T$PW2rQYwHkL2JYD7h8V2SM/$X5/lTTFJHNz3OlWgUHfP2GjXaycZe19D.HEMq81SIi5 | ||
|
||
# set up the clock to UTC with NTP | ||
d-i clock-setup/utc boolean true | ||
d-i time/zone string Europe/Amsterdam | ||
d-i clock-setup/ntp boolean true | ||
d-i clock-setup/ntp-server string nl.pool.ntp.org | ||
|
||
# disk configuration is probably the hardest part of the preseed | ||
# so we're not going to try to do it automatically | ||
d-i partman/default_filesystem string ext4 | ||
|
||
d-i apt-setup/use_mirror boolean true | ||
d-i mirror/protocol select http | ||
d-i mirror/country string manual | ||
d-i mirror/http/mirror select deb.debian.org | ||
d-i apt-setup/non-free boolean true | ||
d-i apt-setup/contrib boolean true | ||
d-i apt-setup/enable-source-repositories boolean false | ||
|
||
d-i apt-setup/services-select multiselect security, updates | ||
d-i pkgsel/update-policy select full-upgrade | ||
d-i popularity-contest/participate boolean true | ||
|
||
# package selection | ||
tasksel tasksel/first multiselect standard | ||
|
||
# choose the base system | ||
d-i base-installer/kernel/image select linux-image-amd64 | ||
d-i base-installer/initramfs-tools/driver-policy select targeted | ||
|
||
# install grub | ||
d-i grub-installer/bootdev string /dev/sda | ||
d-i grub-installer/force-efi-extra-removable boolean true | ||
d-i grub-installer/only_debian boolean true | ||
|
||
d-i preseed/late_command string \ | ||
in-target /bin/bash -c 'sed -i "/^deb cdrom:/s/^/#/" /etc/apt/sources.list && \ | ||
echo "deb http://ftp.de.debian.org/debian bookworm-backports main" > /etc/apt/sources.list.d/backport.list && \ | ||
apt-get update && \ | ||
apt-get install -y xfce4 xfce4-goodies xfce4-power-manager system-config-printer xfce4-panel-profiles xsane plymouth-themes dbus-x11 network-manager-gnome curl yad freerdp3-x11 && \ | ||
apt-get autoremove -y && \ | ||
echo "NTOS-Setup" > /etc/hostname && \ | ||
sed -i "s/127.0.1.1.*/127.0.1.1 NTOS-Setup/" /etc/hosts && \ | ||
sed -i "s/quiet/quiet splash/" /etc/default/grub && \ | ||
sed -i "s/GRUB_TIMEOUT=5/GRUB_TIMEOUT=1/" /etc/default/grub && \ | ||
sed -i "s/^#autologin-user=/autologin-user=user/" /etc/lightdm/lightdm.conf && \ | ||
sed -i "s/^#\\(SystemMaxUse=\\).*/\\150M/" /etc/systemd/journald.conf && \ | ||
grub-mkconfig -o /boot/grub/grub.cfg' | ||
|
||
d-i finish-install/reboot_in_progress note |
Oops, something went wrong.