From cfbff390b26e8b93f8a46f9ba5c0fbd0ee5de108 Mon Sep 17 00:00:00 2001 From: amid Date: Sun, 22 Jan 2023 22:31:02 +0600 Subject: [PATCH] Init commit --- EULA.txt | 48 ++ EULA_DB.txt | 88 +++ LICENSE | 717 ++++++++++++++++++ ublinux/functions | 435 +++++++++++ ublinux/os-config | 186 +++++ ublinux/rc.d/init.d/compcache | 67 ++ ublinux/rc.d/init.d/ntlmaps | 113 +++ ublinux/rc.d/rc.desktop | 30 + ublinux/rc.d/rc.halt | 7 + ublinux/rc.d/rc.halt.pre | 7 + ublinux/rc.d/rc.local | 19 + ublinux/rc.d/rc.network | 15 + ublinux/rc.d/rc.post | 25 + ublinux/rc.d/rc.preinit | 25 + ublinux/rc.d/rc.xorg | 7 + ublinux/rc.desktop/all/autoexec | 22 + ublinux/rc.desktop/all/bookmarks | 10 + ublinux/rc.desktop/all/fusion-icon | 21 + ublinux/rc.desktop/all/keyboard | 22 + ublinux/rc.desktop/all/ldconfig | 8 + ublinux/rc.desktop/all/placeondesktop | 21 + ublinux/rc.desktop/all/pulseaudio | 9 + ublinux/rc.desktop/all/qtox | 19 + ublinux/rc.desktop/all/rfkill | 8 + ublinux/rc.desktop/all/ublinuxupdate | 149 ++++ ublinux/rc.desktop/all/xbindkeys | 8 + ublinux/rc.desktop/all/xss_heartbeat | 37 + ublinux/rc.desktop/deonly/cryptkeeper | 14 + ublinux/rc.desktop/deonly/exclusiveapp | 60 ++ ublinux/rc.desktop/deonly/guake | 11 + ublinux/rc.desktop/deonly/hideloop4dolphin | 86 +++ .../rc.desktop/deonly/i3_notification-daemon | 12 + .../deonly/mate-authentication-agent | 7 + ublinux/rc.desktop/deonly/parcellite | 11 + ublinux/rc.desktop/deonly/qterminal | 11 + ublinux/rc.desktop/deonly/trolltech | 8 + .../rc.desktop/deonly/xfce4-screensaver-fix | 25 + ublinux/rc.desktop/deonly/yakuake | 11 + ublinux/rc.desktop/gnome/cryptkeeper | 1 + ublinux/rc.desktop/gnome/guake | 1 + ublinux/rc.desktop/i3/i3_notification-daemon | 1 + ublinux/rc.desktop/i3term/exclusiveapp | 1 + .../rc.desktop/i3term/i3_notification-daemon | 1 + ublinux/rc.desktop/kde/cryptkeeper | 1 + ublinux/rc.desktop/kde/hideloop4dolphin | 1 + ublinux/rc.desktop/kde/yakuake | 1 + ublinux/rc.desktop/lxde/cryptkeeper | 1 + ublinux/rc.desktop/lxde/parcellite | 1 + ublinux/rc.desktop/lxqt/cryptkeeper | 1 + ublinux/rc.desktop/lxqt/qterminal | 1 + ublinux/rc.desktop/lxqt/trolltech | 1 + ublinux/rc.desktop/mate/cryptkeeper | 1 + ublinux/rc.desktop/mate/guake | 1 + .../rc.desktop/mate/mate-authentication-agent | 1 + ublinux/rc.desktop/mate/parcellite | 1 + ublinux/rc.desktop/plasma/cryptkeeper | 1 + ublinux/rc.desktop/plasma/hideloop4dolphin | 1 + ublinux/rc.desktop/plasma/yakuake | 1 + ublinux/rc.desktop/xfce/xfce4-screensaver-fix | 1 + ublinux/rc.domain.d/30-usershwaccess | 17 + ublinux/rc.halt.pre/01-sysrq-sleepshutdown | 8 + ublinux/rc.halt.pre/10-shutdown | 36 + ublinux/rc.halt.pre/15-cleanup | 11 + ublinux/rc.halt.pre/70-savetomodule | 70 ++ ublinux/rc.halt.pre/75-save-cache | 53 ++ ublinux/rc.halt.pre/80-upgrade | 59 ++ ublinux/rc.halt.pre/85-chmod | 25 + ublinux/rc.halt.pre/90-deactivate | 26 + ublinux/rc.halt.pre/95-umount | 28 + ublinux/rc.halt/20-timesave | 14 + ublinux/rc.halt/99-sync | 5 + ublinux/rc.local.d/01-background | 12 + ublinux/rc.local.d/10-sudoers | 21 + ublinux/rc.local.d/31-sound | 62 ++ ublinux/rc.local.d/40-pacman-keyring | 21 + ublinux/rc.local.d/41-x11vnc | 116 +++ ublinux/rc.local.d/42-domain_join | 29 + ublinux/rc.local.d/50-update-cache-gdk-pixbuf | 10 + ublinux/rc.local.d/50-update-cache-gtk-icon | 17 + ublinux/rc.local.d/50-update-desktop-database | 13 + .../rc.local.d/50-update-glib-compile-schemas | 10 + ublinux/rc.local.d/50-update-mime | 10 + ublinux/rc.local.d/51-mozilla_extensions | 25 + ublinux/rc.local.d/52-consolesetup | 20 + ublinux/rc.local.d/54-plymouth | 14 + ublinux/rc.local.d/55-x2go | 11 + ublinux/rc.local.d/91-cts | 18 + ublinux/rc.local.d/91-eula | 22 + ublinux/rc.local.d/99-1c-enterprise | 20 + ublinux/rc.network.d/10-network | 49 ++ ublinux/rc.network.d/81-samba | 46 ++ ublinux/rc.network.d/90-ublinuxupdate | 18 + ublinux/rc.post.d/01-system | 25 + ublinux/rc.post.d/02-hwclock | 16 + ublinux/rc.post.d/03-modprobepreload | 14 + ublinux/rc.post.d/09-automount | 34 + ublinux/rc.post.d/10-backgrounds | 428 +++++++++++ ublinux/rc.post.d/11-xorg | 132 ++++ ublinux/rc.post.d/16-kiosk | 37 + ublinux/rc.post.d/20-initrd | 22 + ublinux/rc.post.d/23-publicdir | 29 + ublinux/rc.post.d/30-network | 26 + ublinux/rc.post.d/35-soundprofile | 40 + ublinux/rc.post.d/50-update-fonts | 26 + ublinux/rc.post.d/51-theme | 112 +++ ublinux/rc.post.d/60-blacklistdkms | 24 + ublinux/rc.post.d/90-kesl | 14 + ublinux/rc.post/01-system | 8 + ublinux/rc.post/10-ldconfig | 11 + ublinux/rc.post/20-plymouth | 8 + ublinux/rc.post/30-selinux | 12 + ublinux/rc.preinit.d/01-depmod | 22 + ublinux/rc.preinit.d/02-modulespreload | 30 + ublinux/rc.preinit.d/03-ldconfig | 14 + ublinux/rc.preinit.d/04-update-fonts | 34 + ublinux/rc.preinit.d/10-system | 71 ++ ublinux/rc.preinit.d/11-partitions | 114 +++ ublinux/rc.preinit.d/12-save2module | 22 + ublinux/rc.preinit.d/13-release | 29 + ublinux/rc.preinit.d/20-services | 49 ++ ublinux/rc.preinit.d/21-ntp | 34 + ublinux/rc.preinit.d/22-samba | 46 ++ ublinux/rc.preinit.d/23-realmd | 46 ++ ublinux/rc.preinit.d/30-network | 98 +++ ublinux/rc.preinit.d/31-iptables | 45 ++ ublinux/rc.preinit.d/31-ufw | 50 ++ ublinux/rc.preinit.d/40-authpam | 43 ++ ublinux/rc.preinit.d/50-xorg | 235 ++++++ ublinux/rc.preinit.d/51-autologin | 62 ++ ublinux/rc.preinit.d/52-desktop | 177 +++++ ublinux/rc.preinit.d/53-language | 42 + ublinux/rc.preinit.d/54-backgrounds | 27 + ublinux/rc.preinit.d/55-multiseat | 36 + ublinux/rc.preinit.d/60-virtualbox | 22 + ublinux/rc.preinit.d/61-vmware | 23 + ublinux/rc.preinit.d/62-hyperv | 25 + ublinux/rc.preinit.d/90-apparmor | 45 ++ ublinux/rc.preinit.d/99-osinstall | 39 + ublinux/rc.preinit/01-inifile | 63 ++ ublinux/rc.preinit/02-skel-adds | 37 + ublinux/rc.preinit/03-initvars | 16 + ublinux/rc.preinit/10-accounts | 78 ++ ublinux/rc.xorg/00-envvars | 13 + ublinux/rc.xorg/01-background | 55 ++ ublinux/rc.xorg/02-xrandr | 73 ++ ublinux/rc.xorg/10-fixkeyboard_layout | 23 + ublinux/rc.xorg/50-domain_join | 36 + ublinux/rc.xorg/60-checknet | 30 + ublinux/rc.xorg/90-secretnet | 16 + ublinux/rootfs-patches/clean_distr.sh | 62 ++ .../ublinux/ublinux-00-install.sh | 51 ++ .../rootfs-patches/ublinux_db_patch_distr.sh | 7 + .../rootfs-patches/ublinux_de_patch_distr.sh | 7 + .../rootfs-patches/ublinux_edu_patch_distr.sh | 7 + ublinux/rootfs-patches/ublinux_patch_distr.sh | 7 + .../rootfs-patches/ublinux_srv_patch_distr.sh | 7 + ublinux/scripts/gpu_passthrough_revert.sh | 23 + ublinux/scripts/gpu_passthrough_single.sh | 39 + ublinux/scripts/printers_setup.sh | 150 ++++ ublinux/scripts/printers_setup_capt.sh | 250 ++++++ ublinux/scripts/ubxswitcher.sh | 31 + .../ublinux-postinit.service | 1 + .../ublinux-pre-shutdown.service | 1 + .../ublinux-rc-local.service | 1 + .../ublinux-rc-network.service | 1 + ublinux/systemd/printers-setup@.service | 7 + .../ublinux-shutdown.service | 1 + ublinux/systemd/ublinux-postinit.service | 12 + ublinux/systemd/ublinux-pre-shutdown.service | 16 + ublinux/systemd/ublinux-rc-local.service | 16 + ublinux/systemd/ublinux-rc-network.service | 17 + ublinux/systemd/ublinux-shutdown.service | 22 + ublinux/templates/ublinux-data.ini | 656 ++++++++++++++++ ublinux/templates/ublinux-data.sgn | 9 + ublinux/templates/ublinux.ini | 6 + ublinux/templates/ublinux.sgn | 9 + ublinux/udev/70-nvidia-ubconfig.rules | 1 + ublinux/udev/70-setup-prn-ubconfig.rules | 22 + ublinux/udev/99-hide-partition-ubconfig.rules | 3 + ublinux/udev/99-printers-local-ubconfig.rules | 35 + ublinux/xorg.conf.d/10-headless-ubconfig.conf | 20 + ublinux/xorg.conf.d/20-nvidia-ubconfig.conf | 5 + 182 files changed, 7756 insertions(+) create mode 100644 EULA.txt create mode 100644 EULA_DB.txt create mode 100644 LICENSE create mode 100755 ublinux/functions create mode 100644 ublinux/os-config create mode 100755 ublinux/rc.d/init.d/compcache create mode 100755 ublinux/rc.d/init.d/ntlmaps create mode 100755 ublinux/rc.d/rc.desktop create mode 100755 ublinux/rc.d/rc.halt create mode 100755 ublinux/rc.d/rc.halt.pre create mode 100755 ublinux/rc.d/rc.local create mode 100755 ublinux/rc.d/rc.network create mode 100755 ublinux/rc.d/rc.post create mode 100755 ublinux/rc.d/rc.preinit create mode 100755 ublinux/rc.d/rc.xorg create mode 100755 ublinux/rc.desktop/all/autoexec create mode 100755 ublinux/rc.desktop/all/bookmarks create mode 100755 ublinux/rc.desktop/all/fusion-icon create mode 100755 ublinux/rc.desktop/all/keyboard create mode 100755 ublinux/rc.desktop/all/ldconfig create mode 100755 ublinux/rc.desktop/all/placeondesktop create mode 100755 ublinux/rc.desktop/all/pulseaudio create mode 100755 ublinux/rc.desktop/all/qtox create mode 100755 ublinux/rc.desktop/all/rfkill create mode 100755 ublinux/rc.desktop/all/ublinuxupdate create mode 100755 ublinux/rc.desktop/all/xbindkeys create mode 100755 ublinux/rc.desktop/all/xss_heartbeat create mode 100755 ublinux/rc.desktop/deonly/cryptkeeper create mode 100755 ublinux/rc.desktop/deonly/exclusiveapp create mode 100755 ublinux/rc.desktop/deonly/guake create mode 100755 ublinux/rc.desktop/deonly/hideloop4dolphin create mode 100755 ublinux/rc.desktop/deonly/i3_notification-daemon create mode 100755 ublinux/rc.desktop/deonly/mate-authentication-agent create mode 100755 ublinux/rc.desktop/deonly/parcellite create mode 100755 ublinux/rc.desktop/deonly/qterminal create mode 100755 ublinux/rc.desktop/deonly/trolltech create mode 100755 ublinux/rc.desktop/deonly/xfce4-screensaver-fix create mode 100755 ublinux/rc.desktop/deonly/yakuake create mode 120000 ublinux/rc.desktop/gnome/cryptkeeper create mode 120000 ublinux/rc.desktop/gnome/guake create mode 120000 ublinux/rc.desktop/i3/i3_notification-daemon create mode 120000 ublinux/rc.desktop/i3term/exclusiveapp create mode 120000 ublinux/rc.desktop/i3term/i3_notification-daemon create mode 120000 ublinux/rc.desktop/kde/cryptkeeper create mode 120000 ublinux/rc.desktop/kde/hideloop4dolphin create mode 120000 ublinux/rc.desktop/kde/yakuake create mode 120000 ublinux/rc.desktop/lxde/cryptkeeper create mode 120000 ublinux/rc.desktop/lxde/parcellite create mode 120000 ublinux/rc.desktop/lxqt/cryptkeeper create mode 120000 ublinux/rc.desktop/lxqt/qterminal create mode 120000 ublinux/rc.desktop/lxqt/trolltech create mode 120000 ublinux/rc.desktop/mate/cryptkeeper create mode 120000 ublinux/rc.desktop/mate/guake create mode 120000 ublinux/rc.desktop/mate/mate-authentication-agent create mode 120000 ublinux/rc.desktop/mate/parcellite create mode 120000 ublinux/rc.desktop/plasma/cryptkeeper create mode 120000 ublinux/rc.desktop/plasma/hideloop4dolphin create mode 120000 ublinux/rc.desktop/plasma/yakuake create mode 120000 ublinux/rc.desktop/xfce/xfce4-screensaver-fix create mode 100755 ublinux/rc.domain.d/30-usershwaccess create mode 100755 ublinux/rc.halt.pre/01-sysrq-sleepshutdown create mode 100755 ublinux/rc.halt.pre/10-shutdown create mode 100755 ublinux/rc.halt.pre/15-cleanup create mode 100755 ublinux/rc.halt.pre/70-savetomodule create mode 100755 ublinux/rc.halt.pre/75-save-cache create mode 100755 ublinux/rc.halt.pre/80-upgrade create mode 100755 ublinux/rc.halt.pre/85-chmod create mode 100755 ublinux/rc.halt.pre/90-deactivate create mode 100755 ublinux/rc.halt.pre/95-umount create mode 100755 ublinux/rc.halt/20-timesave create mode 100755 ublinux/rc.halt/99-sync create mode 100755 ublinux/rc.local.d/01-background create mode 100755 ublinux/rc.local.d/10-sudoers create mode 100755 ublinux/rc.local.d/31-sound create mode 100755 ublinux/rc.local.d/40-pacman-keyring create mode 100755 ublinux/rc.local.d/41-x11vnc create mode 100755 ublinux/rc.local.d/42-domain_join create mode 100755 ublinux/rc.local.d/50-update-cache-gdk-pixbuf create mode 100755 ublinux/rc.local.d/50-update-cache-gtk-icon create mode 100755 ublinux/rc.local.d/50-update-desktop-database create mode 100755 ublinux/rc.local.d/50-update-glib-compile-schemas create mode 100755 ublinux/rc.local.d/50-update-mime create mode 100755 ublinux/rc.local.d/51-mozilla_extensions create mode 100755 ublinux/rc.local.d/52-consolesetup create mode 100755 ublinux/rc.local.d/54-plymouth create mode 100755 ublinux/rc.local.d/55-x2go create mode 100755 ublinux/rc.local.d/91-cts create mode 100755 ublinux/rc.local.d/91-eula create mode 100755 ublinux/rc.local.d/99-1c-enterprise create mode 100755 ublinux/rc.network.d/10-network create mode 100755 ublinux/rc.network.d/81-samba create mode 100755 ublinux/rc.network.d/90-ublinuxupdate create mode 100755 ublinux/rc.post.d/01-system create mode 100755 ublinux/rc.post.d/02-hwclock create mode 100755 ublinux/rc.post.d/03-modprobepreload create mode 100755 ublinux/rc.post.d/09-automount create mode 100755 ublinux/rc.post.d/10-backgrounds create mode 100755 ublinux/rc.post.d/11-xorg create mode 100755 ublinux/rc.post.d/16-kiosk create mode 100755 ublinux/rc.post.d/20-initrd create mode 100755 ublinux/rc.post.d/23-publicdir create mode 100755 ublinux/rc.post.d/30-network create mode 100755 ublinux/rc.post.d/35-soundprofile create mode 100755 ublinux/rc.post.d/50-update-fonts create mode 100755 ublinux/rc.post.d/51-theme create mode 100755 ublinux/rc.post.d/60-blacklistdkms create mode 100755 ublinux/rc.post.d/90-kesl create mode 100755 ublinux/rc.post/01-system create mode 100755 ublinux/rc.post/10-ldconfig create mode 100755 ublinux/rc.post/20-plymouth create mode 100755 ublinux/rc.post/30-selinux create mode 100755 ublinux/rc.preinit.d/01-depmod create mode 100755 ublinux/rc.preinit.d/02-modulespreload create mode 100755 ublinux/rc.preinit.d/03-ldconfig create mode 100755 ublinux/rc.preinit.d/04-update-fonts create mode 100755 ublinux/rc.preinit.d/10-system create mode 100755 ublinux/rc.preinit.d/11-partitions create mode 100755 ublinux/rc.preinit.d/12-save2module create mode 100755 ublinux/rc.preinit.d/13-release create mode 100755 ublinux/rc.preinit.d/20-services create mode 100755 ublinux/rc.preinit.d/21-ntp create mode 100755 ublinux/rc.preinit.d/22-samba create mode 100755 ublinux/rc.preinit.d/23-realmd create mode 100755 ublinux/rc.preinit.d/30-network create mode 100755 ublinux/rc.preinit.d/31-iptables create mode 100755 ublinux/rc.preinit.d/31-ufw create mode 100755 ublinux/rc.preinit.d/40-authpam create mode 100755 ublinux/rc.preinit.d/50-xorg create mode 100755 ublinux/rc.preinit.d/51-autologin create mode 100755 ublinux/rc.preinit.d/52-desktop create mode 100755 ublinux/rc.preinit.d/53-language create mode 100755 ublinux/rc.preinit.d/54-backgrounds create mode 100755 ublinux/rc.preinit.d/55-multiseat create mode 100755 ublinux/rc.preinit.d/60-virtualbox create mode 100755 ublinux/rc.preinit.d/61-vmware create mode 100755 ublinux/rc.preinit.d/62-hyperv create mode 100755 ublinux/rc.preinit.d/90-apparmor create mode 100755 ublinux/rc.preinit.d/99-osinstall create mode 100755 ublinux/rc.preinit/01-inifile create mode 100755 ublinux/rc.preinit/02-skel-adds create mode 100755 ublinux/rc.preinit/03-initvars create mode 100755 ublinux/rc.preinit/10-accounts create mode 100755 ublinux/rc.xorg/00-envvars create mode 100755 ublinux/rc.xorg/01-background create mode 100755 ublinux/rc.xorg/02-xrandr create mode 100755 ublinux/rc.xorg/10-fixkeyboard_layout create mode 100755 ublinux/rc.xorg/50-domain_join create mode 100755 ublinux/rc.xorg/60-checknet create mode 100755 ublinux/rc.xorg/90-secretnet create mode 100755 ublinux/rootfs-patches/clean_distr.sh create mode 100755 ublinux/rootfs-patches/ublinux/ublinux-00-install.sh create mode 100755 ublinux/rootfs-patches/ublinux_db_patch_distr.sh create mode 100755 ublinux/rootfs-patches/ublinux_de_patch_distr.sh create mode 100755 ublinux/rootfs-patches/ublinux_edu_patch_distr.sh create mode 100755 ublinux/rootfs-patches/ublinux_patch_distr.sh create mode 100755 ublinux/rootfs-patches/ublinux_srv_patch_distr.sh create mode 100755 ublinux/scripts/gpu_passthrough_revert.sh create mode 100755 ublinux/scripts/gpu_passthrough_single.sh create mode 100755 ublinux/scripts/printers_setup.sh create mode 100755 ublinux/scripts/printers_setup_capt.sh create mode 100755 ublinux/scripts/ubxswitcher.sh create mode 120000 ublinux/systemd/basic.target.wants/ublinux-postinit.service create mode 120000 ublinux/systemd/multi-user.target.wants/ublinux-pre-shutdown.service create mode 120000 ublinux/systemd/multi-user.target.wants/ublinux-rc-local.service create mode 120000 ublinux/systemd/multi-user.target.wants/ublinux-rc-network.service create mode 100644 ublinux/systemd/printers-setup@.service create mode 120000 ublinux/systemd/shutdown.target.wants/ublinux-shutdown.service create mode 100644 ublinux/systemd/ublinux-postinit.service create mode 100644 ublinux/systemd/ublinux-pre-shutdown.service create mode 100644 ublinux/systemd/ublinux-rc-local.service create mode 100644 ublinux/systemd/ublinux-rc-network.service create mode 100644 ublinux/systemd/ublinux-shutdown.service create mode 100644 ublinux/templates/ublinux-data.ini create mode 100644 ublinux/templates/ublinux-data.sgn create mode 100644 ublinux/templates/ublinux.ini create mode 100644 ublinux/templates/ublinux.sgn create mode 100644 ublinux/udev/70-nvidia-ubconfig.rules create mode 100644 ublinux/udev/70-setup-prn-ubconfig.rules create mode 100644 ublinux/udev/99-hide-partition-ubconfig.rules create mode 100644 ublinux/udev/99-printers-local-ubconfig.rules create mode 100644 ublinux/xorg.conf.d/10-headless-ubconfig.conf create mode 100644 ublinux/xorg.conf.d/20-nvidia-ubconfig.conf diff --git a/EULA.txt b/EULA.txt new file mode 100644 index 0000000..5994bbf --- /dev/null +++ b/EULA.txt @@ -0,0 +1,48 @@ +ЛИЦЕНЗИОННОЕ СОГЛАШЕНИЕ ДЛЯ КОНЕЧНОГО ПОЛЬЗОВАТЕЛЯ +ПО ИСПОЛЬЗОВАНИЮ +ОПЕРАЦИОННЫХ СИСТЕМ +«UBLINUX DESKTOP ENTERPRISE» +«UBLINUX EDUCATION» +«UBLINUX SERVER» +«UBLINUX ADARA DESKTOP ENTERPRISE» +«UBLINUX ADARA SERVER» +«UBLINUX DESKTOP ENTERPRISE SIBSUTIS» +«UBLINUX EDUCATION SIBSUTIS» +«UBLINUX SERVER SIBSUTIS» + +ВНИМАНИЕ! Прочтите внимательно нижеизложенное Лицензионное соглашение, прежде чем устанавливать, копировать или иным образом использовать приобретенный Программный продукт. Любое использование приобретенного Программного продукта, в том числе его установка и копирование, означает согласие с условиями приведенного ниже Лицензионного соглашения. + +Настоящее Лицензионное соглашение для конечного пользователя (СОГЛАШЕНИЕ) является юридическим соглашением между Вами (физическим или юридическим лицом) (ПОЛЬЗОВАТЕЛЕМ) и обществом ограниченной ответственности «Юбитех» (ПРАВООБЛАДАТЕЛЕМ), которое является разработчиком Операционной системы «UB LINUX» (ПРОГРАММНЫЙ ПРОДУКТ). Устанавливая, копируя или иным образом используя ПРОГРАММНЫЙ ПРОДУКТ, ПОЛЬЗОВАТЕЛЬ тем самым соглашается с положениями настоящего СОГЛАШЕНИЯ. Если ПОЛЬЗОВАТЕЛЬ не согласен с положениями настоящего СОГЛАШЕНИЯ, ПРАВООБЛАДАТЕЛЬ отказывает ему в праве на любое использование ПРОГРАММНОГО ПРОДУКТА. В этом случае ПОЛЬЗОВАТЕЛЬ не имеет права устанавливать, копировать или иным образом использовать ПРОГРАММНЫЙ ПРОДУКТ, а также вправе вернуть ПРОГРАММНЫЙ ПРОДУКТ организации, у которой его приобрел, при условии целостности (отсутствия признаков вскрытия) товарной упаковки. +1. ОБЩИЕ ПОЛОЖЕНИЯ +1.1. ПРОГРАММНЫЙ ПРОДУКТ охраняется авторским правом, международными соглашениями о защите интеллектуальной собственности и действующим законодательством Российской Федерации. Соответствие ПРОГРАММНОГО ПРОДУКТА требованиям безопасности информации подтверждается сертификатом, оформленным согласно действующего законодательства Российской Федерации. +1.2. ПРОГРАММНЫЙ ПРОДУКТ лицензируется, а не продается. ПРОГРАММНЫЙ ПРОДУКТ лицензируется как единое целое. Приобретение настоящего ПРОГРАММНОГО ПРОДУКТА – это приобретение простой лицензии (неисключительного права) на его использование. +1.3. ПРОГРАММНЫЙ ПРОДУКТ включает в себя собственно компьютерную программу на соответствующих носителях, а также сопровождающие печатные материалы и электронную документацию. +1.4. ПРОГРАММНЫЙ ПРОДУКТ является сложным объектом и содержит компоненты как собственной разработки ПРАВООБЛАДАТЕЛЯ, так и сторонних авторов. +1.5. При нарушении ПОЛЬЗОВАТЕЛЕМ положений данного СОГЛАШЕНИЯ ПРАВООБЛАДАТЕЛЬ имеет право отменить его действие. В этом случае ПОЛЬЗОВАТЕЛЬ обязан прекратить использование ПРОГРАММНОГО ПРОДУКТА и уничтожить все его копии, находящиеся в распоряжении ПОЛЬЗОВАТЕЛЯ. +1.6. Все условия, оговоренные далее, относятся как к ПРОГРАММНОМУ ПРОДУКТУ в целом, так и ко всем его компонентам в отдельности. +2. НЕИСКЛЮЧИТЕЛЬНОЕ ПРАВО, ПРЕДОСТАВЛЯЕМОЕ ПОЛЬЗОВАТЕЛЮ +2.1. Настоящее СОГЛАШЕНИЕ предоставляет ПОЛЬЗОВАТЕЛЮ право на установку и использование ПРОГРАММНОГО ПРОДУКТА на ОДНОМ компьютере и изготовление ОДНОЙ резервной копии, используемой в случае утраты или порчи основных носителей из состава ПРОГРАММНОГО ПРОДУКТА, придерживаясь условий данного СОГЛАШЕНИЯ и правил, содержащихся в прилагаемой печатной или электронной документации. +2.2. ПОЛЬЗОВАТЕЛЬ имеет право на получение обновлений ПРОГРАММНОГО ПРОДУКТА, общей технической поддержки и иных услуг от ПРАВООБЛАДАТЕЛЯ или его представителя по отдельному договору, заключаемому с ПОЛЬЗОВАТЕЛЕМ. +3. ОГРАНИЧЕНИЯ +3.1. Настоящее СОГЛАШЕНИЕ НЕ дает ПОЛЬЗОВАТЕЛЮ права на: +3.1.1. Декомпиляцию и дизассемблирование любых составных частей ПРОГРАММНОГО ПРОДУКТА, кроме случаев, предусмотренных законодательством Российской Федерации. +3.1.2. Передачу в аренду, в залог или лизинг ПРОГРАММНОГО ПРОДУКТА. +3.1.3. Распространение ПРОГРАММНОГО ПРОДУКТА, любых его изменений или перевод его текста на другой язык. +3.1.4. Установку ПРОГРАММНОГО ПРОДУКТА более чем на ОДИН компьютер без заключения ЛИЦЕНЗИОННОГО ДОГОВОРА. +3.2. ПРАВООБЛАДАТЕЛЬ не несет ответственности за любую информацию, которая создается или обрабатывается в процессе использования ПРОГРАММНОГО ПРОДУКТА. +3.3. Настоящее СОГЛАШЕНИЕ не предоставляет ПОЛЬЗОВАТЕЛЮ никаких прав в отношении каких-либо товарных знаков или знаков обслуживания, принадлежащих ПРАВООБЛАДАТЕЛЮ или его партнерам/контрагентам. +3.4. Ни при каких обстоятельствах ПРАВООБЛАДАТЕЛЬ, а также его партнеры и контрагенты не несут ответственность за действия третьих лиц, временные технические сбои и перерывы в работе ПРОГРАММНОГО ПРОДУКТА, вызванные неполадками используемых технических средств, иные аналогичные сбои, а также вызванные неполадками компьютера, который ПОЛЬЗОВАТЕЛЬ использовал для работы с ПРОГРАММНЫМ ПРОДУКТОМ. +4. СРОК ДЕЙСТВИЯ СОГЛАШЕНИЯ +4.1. Настоящее СОГЛАШЕНИЕ вступает в силу с момента установки или копирования ПРОГРАММНОГО ПРОДУКТА. +4.2. По инициативе ПРАВООБЛАДАТЕЛЯ СОГЛАШЕНИЕ может быть расторгнуто в случае нарушения ПОЛЬЗОВАТЕЛЕМ условий настоящего СОГЛАШЕНИЯ. +5. ПРАВА НА ИНТЕЛЛЕКТУАЛЬНУЮ СОБСТВЕННОСТЬ +5.1. Правовой титул и все права интеллектуальной собственности на ПРОГРАММНЫЙ ПРОДУКТ, включая (но не ограничиваясь только этим) любые входящие в его состав элементы мультимедиа, текст и программы, а также содержание сопровождающих его печатных материалов и любые копии ПРОГРАММНОГО ПРОДУКТА принадлежат ПРАВООБЛАДАТЕЛЮ, за исключением случаев, указанных в 5.2. настоящего СОГЛАШЕНИЯ. +5.2. Правовой титул и все права на объекты интеллектуальной собственности, которые не являются разработкой ПРАВООБЛАДАТЕЛЯ, но входят в состав ПРОГРАММНОГО ПРОДУКТА, включая (но не ограничиваясь только этим) любые входящие в его состав элементы мультимедиа, текст и программы, и доступ к которым предоставляет ПРОГРАММНЫЙ ПРОДУКТ, принадлежат владельцам прав на такие элементы и защищены международными соглашениями и законодательством Российской Федерации о защите интеллектуальной собственности. Настоящее СОГЛАШЕНИЕ не предоставляет ПОЛЬЗОВАТЕЛЮ никаких прав на использование такого содержания ПРОГРАММНОГО ПРОДУКТА. Права на такое содержание ПРОГРАММНОГО ПРОДУКТА определяются отдельными лицензионными соглашениями правообладателей данных объектов интеллектуальной собственности. +5.3. За нарушение авторских прав ПРАВООБЛАДАТЕЛЯ на ПРОГРАММНЫЙ ПРОДУКТ ПОЛЬЗОВАТЕЛЬ несет гражданскую, административную или уголовную ответственность в соответствии с действующим законодательством Российской Федерации. +6. ГАРАНТИИ +6.1. ПРАВООБЛАДАТЕЛЬ гарантирует, что: +6.1.1. ПРОГРАММНЫЙ ПРОДУКТ содержится в полном объеме, соответствующем описанию, представленному в печатных материалах или электронной документации, которые входят в состав ПРОГРАММНОГО ПРОДУКТА. +6.1.2. Функции, которые выполняет ПРОГРАММНЫЙ ПРОДУКТ, соответствуют функциям, указанным в печатных и электронных материалах и (или) документации к ПРОГРАММНОМУ ПРОДУКТУ, либо превосходят их. +6.2. Настоящая гарантия недействительна, если сбой в работе ПРОГРАММНОГО ПРОДУКТА возник в результате неосторожности, неправильного обращения или применения, а также в случаях, перечисленных в 3.4. настоящего СОГЛАШЕНИЯ. +7. ПРИМЕНИМОЕ ЗАКОНОДАТЕЛЬСТВО +7.1. При использовании ПРОГРАММНОГО ПРОДУКТА применяются международные соглашения Российской Федерации и действующее законодательство Российской Федерации, регулирующее отношения в области интеллектуальной собственности. diff --git a/EULA_DB.txt b/EULA_DB.txt new file mode 100644 index 0000000..0a98ed1 --- /dev/null +++ b/EULA_DB.txt @@ -0,0 +1,88 @@ +Последняя дата обновления — 01 сентября 2019 г. +Полностью заменяет предыдущую версию. +  +ЛИЦЕНЗИОННОЕ СОГЛАШЕНИЕ ДЛЯ КОНЕЧНОГО ПОЛЬЗОВАТЕЛЯ +ПО ИСПОЛЬЗОВАНИЮ +ОПЕРАЦИОННОЙ СИСТЕМЫ +«UBLINUX DESKTOP BASIC» +    +ВНИМАНИЕ! Прочтите внимательно нижеизложенное Лицензионное соглашение, прежде чем устанавливать, копировать или иным образом использовать приобретенный Программный продукт. +Любое использование приобретенного Программного продукта, в том числе его установка и копирование, означает согласие с условиями приведенного ниже Лицензионного соглашения. +   +Настоящее Лицензионное соглашение для конечного пользователя (СОГЛАШЕНИЕ) является юридически значимым соглашением между Вами (физическим или юридическим лицом) (ПОЛЬЗОВАТЕЛЕМ) +и обществом ограниченной ответственности «Юбитех» (ПРАВООБЛАДАТЕЛЕМ), которое является разработчиком Операционной системы «UB Linux Desktop Basic» (далее - ПРОГРАММНЫЙ ПРОДУКТ). +Устанавливая, копируя или иным образом используя ПРОГРАММНЫЙ ПРОДУКТ, ПОЛЬЗОВАТЕЛЬ тем самым соглашается с положениями настоящего СОГЛАШЕНИЯ. Если ПОЛЬЗОВАТЕЛЬ не согласен с +положениями настоящего СОГЛАШЕНИЯ, ПРАВООБЛАДАТЕЛЬ отказывает ему в праве на любое использование ПРОГРАММНОГО ПРОДУКТА. В этом случае ПОЛЬЗОВАТЕЛЬ не имеет права устанавливать, +копировать или иным образом использовать ПРОГРАММНЫЙ ПРОДУКТ, , а также вправе вернуть ПРОГРАММНЫЙ ПРОДУКТ организации, у которой его приобрел, при условии целостности (отсутствия +признаков вскрытия) товарной упаковки. + +1. ОБЩИЕ ПОЛОЖЕНИЯ +1.1. ПРОГРАММНЫЙ ПРОДУКТ охраняется авторским правом, международными соглашениями о защите интеллектуальной собственности и действующим законодательством Российской Федерации. +1.2. ПРОГРАММНЫЙ ПРОДУКТ лицензируется, а не продается. ПРОГРАММНЫЙ ПРОДУКТ лицензируется как единое целое. Приобретение настоящего ПРОГРАММНОГО ПРОДУКТА – это приобретение простой + (неисключительной) лицензии (права использования на условиях простой (неисключительной) лицензии) на его использование. +1.3. ПРОГРАММНЫЙ ПРОДУКТ включает в себя собственно компьютерную программу и электронную документацию на соответствующих носителях. +1.4. ПРОГРАММНЫЙ ПРОДУКТ является сложным объектом и содержит компоненты как собственной разработки ПРАВООБЛАДАТЕЛЯ, так и сторонних авторов. +1.5. При нарушении ПОЛЬЗОВАТЕЛЕМ положений данного СОГЛАШЕНИЯ ПРАВООБЛАДАТЕЛЬ имеет право отменить его действие. В этом случае ПОЛЬЗОВАТЕЛЬ обязан прекратить использование + ПРОГРАММНОГО ПРОДУКТА и уничтожить все его копии, находящиеся в распоряжении ПОЛЬЗОВАТЕЛЯ. +1.6. Все условия, оговоренные далее, относятся как к ПРОГРАММНОМУ ПРОДУКТУ в целом, так и ко всем его компонентам в отдельности. +2. НЕИСКЛЮЧИТЕЛЬНОЕ ПРАВО, ПРЕДОСТАВЛЯЕМОЕ ПОЛЬЗОВАТЕЛЮ +2.1. Настоящее СОГЛАШЕНИЕ предоставляет ПОЛЬЗОВАТЕЛЮ, являющемуся юридическим лицом (любой организационно-правовой формы), органом государственной власти или индивидуальным + предпринимателем право на установку и использование ПРОГРАММНОГО ПРОДУКТА на ОДНОМ компьютере и изготовление ОДНОЙ резервной копии, используемой в случае утраты или порчи + носителей из состава ПРОГРАММНОГО ПРОДУКТА, придерживаясь условий данного СОГЛАШЕНИЯ и правил, содержащихся в прилагаемой документации, на основании отдельно заключаемого + лицензионного договора. +2.2. Если ПОЛЬЗОВАТЕЛЕМ является частное физическое лицо, в рамках настоящего СОГЛАШЕНИЯ такому ПОЛЬЗОВАТЕЛЮ — физическому лицу предоставляется право на установку и использование + ПРОГРАММНОГО ПРОДУКТА на условиях простой (неисключительной) лицензии исключительно для личных, семейных, домашних и иных бытовых нужд, не связанных с осуществлением + предпринимательской деятельности (без цели извлечения прибыли или иной материальной выгоды), на неограниченном количестве компьютеров при условии соблюдения требований данного + СОГЛАШЕНИЯ и правил, содержащихся в прилагаемой печатной или электронной документации. +2.3. ПОЛЬЗОВАТЕЛЬ имеет право на получение обновлений ПРОГРАММНОГО ПРОДУКТА, общей технической поддержки и иных услуг от ПРАВООБЛАДАТЕЛЯ или его представителя по отдельному + договору, заключаемому с ПОЛЬЗОВАТЕЛЕМ. +3. ОГРАНИЧЕНИЯ +3.1. Настоящее СОГЛАШЕНИЕ НЕ дает ПОЛЬЗОВАТЕЛЮ права на: +3.1.1. Использование ПРОГРАММНОГО ПРОДУКТА при осуществлении предпринимательской деятельности, а также установку ПРОГРАММНОГО ПРОДУКТА на компьютеры юридических лиц (любой + организационно-правовой формы), органов государственной власти и/или индивидуальных предпринимателей без заключения соответствующего лицензионного (сублицензионного) договора. +3.1.2. Декомпиляцию и дизассемблирование любых составных частей ПРОГРАММНОГО ПРОДУКТА, кроме случаев, предусмотренных законодательством Российской Федерации. +3.1.3. Передачу в аренду, в залог или лизинг ПРОГРАММНОГО ПРОДУКТА. +3.1.4. Распространение ПРОГРАММНОГО ПРОДУКТА, любых его изменений или перевод его текста на другой язык. +3.2. ПРАВООБЛАДАТЕЛЬ не несет ответственности за любую информацию, которая создается или обрабатывается в процессе использования ПРОГРАММНОГО ПРОДУКТА. +3.3. Настоящее СОГЛАШЕНИЕ не предоставляет ПОЛЬЗОВАТЕЛЮ никаких прав в отношении каких-либо товарных знаков или знаков обслуживания, принадлежащих ПРАВООБЛАДАТЕЛЮ или его + партнерам/контрагентам. +3.4. Лицензии в отношении ПРОГРАММНОГО ПРОДУКТА предоставляются на условиях «как есть» (AS IS): ПРАВООБЛАДАТЕЛЬ не предоставляет никаких гарантий в отношении безошибочной и + бесперебойной работы ПРОГРАММНОГО ПРОДУКТА, соответствия ПРОГРАММНОГО ПРОДУКТА конкретным целям и ожиданиям ПОЛЬЗОВАТЕЛЯ, а также не предоставляют никаких иных гарантий, прямо + не указанных в настоящем СОГЛАШЕНИИ. ПОЛЬЗОВАТЕЛЬ принимает на себя ответственность за выбор ПРОГРАММНОГО ПРОДУКТА с целью достижения желаемых результатов, и в отношении + результатов, получаемых в ходе использования ПОЛЬЗОВАТЕЛЕМ ПРОГРАММНОГО ПРОДУКТА. +3.5. ПРАВООБЛАДАТЕЛЬ ни при каких условиях не несет ответственности перед ПОЛЬЗОВАТЕЛЕМ или любым иным лицом, связанным с ПОЛЬЗОВАТЕЛЕМ, в отношении любых непрямых, случайных, + косвенных, специальных, штрафных убытков или убытков, присуждаемых в качестве меры ответственности (включая, без ограничения, утратой данных или иными подобными убытками в + денежной форме), в соответствии с принципами договорного права, по гарантии, в связи с гражданским правонарушением (включая небрежность), ответственностью в отношении продукции + или на иных основаниях. +3.6. Ни при каких обстоятельствах ПРАВООБЛАДАТЕЛЬ, а также его партнеры и контрагенты не несут ответственность за действия третьих лиц, временные технические сбои и перерывы в + работе ПРОГРАММНОГО ПРОДУКТА, вызванные неполадками используемых технических средств, иные аналогичные сбои, а также вызванные неполадками компьютера, который ПОЛЬЗОВАТЕЛЬ + использовал для работы с ПРОГРАММНЫМ ПРОДУКТОМ. +4. СРОК ДЕЙСТВИЯ СОГЛАШЕНИЯ +4.1. Настоящее СОГЛАШЕНИЕ вступает в силу с момента установки или копирования ПРОГРАММНОГО ПРОДУКТА его ПОЛЬЗОВАТЕЛЕМ и действует до момента полного прекращения использования + ПРОГРАММНОГО ПРОДУКТА . +4.2. По инициативе ПРАВООБЛАДАТЕЛЯ СОГЛАШЕНИЕ может быть расторгнуто в случае нарушения ПОЛЬЗОВАТЕЛЕМ условий настоящего СОГЛАШЕНИЯ. +5. ПРАВА НА ИНТЕЛЛЕКТУАЛЬНУЮ СОБСТВЕННОСТЬ +5.1. Правовой титул и все права интеллектуальной собственности на ПРОГРАММНЫЙ ПРОДУКТ, включая (но не ограничиваясь только этим) любые входящие в его состав элементы мультимедиа, + текст и программы, а также содержание сопровождающих его печатных материалов и любые копии ПРОГРАММНОГО ПРОДУКТА принадлежат ПРАВООБЛАДАТЕЛЮ, за исключением случаев, указанных + в п. 5.2 настоящего СОГЛАШЕНИЯ. +5.2. Правовой титул и все права на объекты интеллектуальной собственности, которые не являются разработкой ПРАВООБЛАДАТЕЛЯ, но входят в состав ПРОГРАММНОГО ПРОДУКТА, включая + (но не ограничиваясь только этим) любые входящие в его состав элементы мультимедиа, текст и программы, и доступ к которым предоставляет ПРОГРАММНЫЙ ПРОДУКТ, принадлежат + владельцам прав на такие элементы и защищены международными соглашениями и законодательством Российской Федерации о защите интеллектуальной собственности. Настоящее СОГЛАШЕНИЕ + не предоставляет ПОЛЬЗОВАТЕЛЮ никаких прав на использование такого содержания ПРОГРАММНОГО ПРОДУКТА. Права на такое содержание ПРОГРАММНОГО ПРОДУКТА определяются отдельными + лицензионными соглашениями правообладателей данных объектов интеллектуальной собственности. +5.3. За нарушение авторских прав ПРАВООБЛАДАТЕЛЯ на ПРОГРАММНЫЙ ПРОДУКТ, в том числе за нарушение условия настоящего СОГЛАШЕНИЯ ПОЛЬЗОВАТЕЛЬ несет гражданскую, административную + или уголовную ответственность в соответствии с действующим законодательством Российской Федерации. +6. ГАРАНТИИ +6.1. ПРАВООБЛАДАТЕЛЬ гарантирует, что: +6.1.1. ПРОГРАММНЫЙ ПРОДУКТ содержится в полном объеме, соответствующем описанию, представленному в печатных материалах или электронной документации, которые входят в состав + ПРОГРАММНОГО ПРОДУКТА. +6.1.2. Функции, которые выполняет ПРОГРАММНЫЙ ПРОДУКТ, соответствуют функциям, указанным в печатных и электронных материалах и (или) документации к ПРОГРАММНОМУ ПРОДУКТУ, либо + превосходят их. +6.2. Настоящая гарантия недействительна, если сбой в работе ПРОГРАММНОГО ПРОДУКТА возник в результате неосторожности, неправильного обращения или применения, а также в случаях, + перечисленных в п. 3.6 настоящего СОГЛАШЕНИЯ. +7. ПРИМЕНИМОЕ ЗАКОНОДАТЕЛЬСТВО +7.1. При использовании ПРОГРАММНОГО ПРОДУКТА применяются международные соглашения Российской Федерации и действующее законодательство Российской Федерации, регулирующее отношения + в области интеллектуальной собственности. +8. ПРИОРИТЕТНОЕ ПРИМЕНЕНИЕ +8.1. В случае наличия противоречий между документами, включенными в электронном виде в ПРОГРАММНЫЙ ПРОДУКТ, и настоящим СОГЛАШЕНИЕМ, приоритет имеют положения настоящего СОГЛАШЕНИЯ + (в том числе относительно объема предоставляемых ПОЛЬЗОВАТЕЛЮ прав). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..43816b5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,717 @@ + + License: + + This software consicts of several parts designed by various + companies and contributors. Source scripts and the most of parts + are licensing under GNU GPL (http://www.gnu.org/copyleft/gpl.html). + This allows you to use, copy and modify it freely. Some of parts + are distributed with various licenses which can prohibit you + to hack and modify it. + (Please see documentation in /usr/share/doc/ or developer's websites) + + Warranty: + + This software is distributed with NO WARRANTY, use it at your own risk. + + Authors: + + UBLinux Team http://ublinux.ru + +------------------------------------------------------------------------- + + Лицензия: + + Данное программное обеспечение (ПО) состоит из компонентов, созданных + различными людьми или организациями. Сборочные скрипты и основная + часть компонентов распространяются под лицензиями + GNU GPL (http://www.gnu.org/copyleft/gpl.html), которые позволяют + вам свободно использовать, тиражировать, адаптировать или + перераспределять компоненты, на которые распространяется действие + лицензий . Остальные компоненты имеют различные лицензии, которые могут + ограничивать исследование кода и изменение этих компонентов + (см. документацию в /usr/share/doc/ или на сайте производителя). + + Гарантии: + + Данное программное обеспечение поставляется без каких-либо гарантий + + Авторы: + + Сообщество UBLinux http://ublinux.ru + +------------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/ublinux/functions b/ublinux/functions new file mode 100755 index 0000000..6ddb975 --- /dev/null +++ b/ublinux/functions @@ -0,0 +1,435 @@ +#!/bin/bash +# Make from ini file text file with strings like [SECTION]Name=Value +# $1 - input filename +# stdout - result file +export TEXTDOMAINDIR=/usr/share/locale +export TEXTDOMAIN=ublinux_functions + + +function ini2simple() +{ + SECTION='[]' + cat $1 | while read a ;do + [ "$a" = "" ] && continue + if [ "${a#\[*\]}" = "" -a "$a" != "" ] ;then + SECTION=$a + else + echo "$SECTION$a" + fi + done +} + +# Restore ini file from text file with strings like [SECTION]Name=Value +# $1 - input filename +# stdout - result file +function simple2ini() +{ + LASTSECTION='[]' + cat $1 | while read a ;do + SECTION=${a%%\]*}']' + if [ "$SECTION" != "$LASTSECTION" ] ;then + [ "LASTSECTION" != "[]" ] && echo + echo "$SECTION" + LASTSECTION=$SECTION + fi + echo ${a#\[*\]} + done +} + +# It include string from $2 file and apply to $1 file +# $1 - base file +# $2 - included file +function apply2simple() +{ + cat "$2" | while read a ;do + SECTION=${a%%\]*} + SECTION=${SECTION#\[} + STR=${a#\[*\]} + PNAME=${STR%%=*} + PVAL=${a#*=} +# echo $SECTION $PNAME $PVAL + echo -ne >"$1.tmp" + echo -ne >"$1.lck" + FOUNDS= + cat "$1" | while read b ;do + BSECTION=${b%%\]*} + BSECTION=${BSECTION#\[} + BSTR=${b#\[*\]} + BPNAME=${BSTR%%=*} + BPVAL=${b#*=} + + [ "$BSECTION" = "$SECTION" ] && FOUNDS=1 + if [ "$BSECTION" = "$SECTION" -a "$BPNAME" = "$PNAME" ] ;then + b="$a" + rm -f "$1.lck" + fi + if [ "$BSECTION" != "$SECTION" -a "$FOUNDS" != "" -a -f "$1.lck" ] ;then + echo "$a" >> "$1.tmp" + rm -f "$1.lck" + fi + echo "$b" >> "$1.tmp" + done + [ -f "$1.lck" ] && echo "$a" >> "$1.tmp" + mv -f "$1.tmp" "$1" + rm -f "$1.lck" + done +} + +# It include string from $2 ini file and apply to $1 ini file +# $1 - base file +# $2 - included file +function concatenate_ini() +{ + [ -f "$1" -a -f "$2" ] || return 1 + ini2simple "$1" >"$1.tmp" + ini2simple "$2" >"$2.tmp" + apply2simple "$1.tmp" "$2.tmp" + simple2ini "$1.tmp" >"$1" + rm -f "$1.tmp" "$2.tmp" +} + +detectDE() +{ + if [ x"$KDE_FULL_SESSION" = x"true" ]; then SESSION=kde + elif [ x"$XDG_CURRENT_DESKTOP" = x"XFCE" ]; then SESSION=xfce + elif [ x"$DESKTOP_SESSION" = x"LXDE" ]; then SESSION=lxde + elif [ x"$XDG_CURRENT_DESKTOP" = x"LXQt" ]; then SESSION=lxqt + elif [ x"$DESKTOP_SESSION" = x"i3" ]; then SESSION=i3 + elif [ x"$XDG_CURRENT_DESKTOP" = x"i3" ]; then SESSION=i3 + elif [ x"$DESKTOP_SESSION" = x"i3term" ]; then SESSION=i3term + elif [ x"$XDG_CURRENT_DESKTOP" = x"i3term" ]; then SESSION=i3term + elif [ x"$XDG_CURRENT_DESKTOP" = x"MATE" ]; then SESSION=mate + fi + if [ -z "$SESSION" ]; then + ps -A | grep -q "xfce4-session" && SESSION=xfce + ps -A | grep -q "kdeinit" && SESSION=kde + ps -A | grep -q " i3$" && SESSION=i3 + ps -A | grep -q " i3term$" && SESSION=i3term + ps -A | grep -q "gnome-panel" && SESSION=gnome + ps -A | grep -q "gnome-shell" && SESSION=gnome-shell + fi + [ "$SESSION" = "kde" -a -f /etc/X11/wmsession.d/01Plasma ] && SESSION=plasma + [ -z "$SESSION" -a -x /usr/bin/startxfce4 ] && SESSION=xfce + [ -z "$SESSION" -a -x /usr/bin/startlxde ] && SESSION=lxde + [ -z "$SESSION" -a -x /usr/bin/startlxqt ] && SESSION=lxqt + echo $SESSION +} + +# =========================================================== +# liblinuxlive functions +# =========================================================== + +debug_log() +{ + if grep -q "debug" /proc/cmdline ; then + echo "- debug: $*" >&2 + log "- debug: $*" + fi +} + +log() +{ + echo "$@" 2>/dev/null >>/var/log/ublinuxlog +} + +debug_mode() +{ + if [ "$(cmdline_parameter debug)" -o "$DEBUGMODE" == "yes" ] ; then + name=$(basename $0) + slash="/" + [ "$(pwd)" == "/union" ] && slash="" + if ! test -f ${slash}var/log/ublinux/${name}.log ; then + echo "$0 -- debug mode enabled" + test -d ${slash}var/log/ublinux || mkdir -p ${slash}var/log/ublinux + echo $(date) > ${slash}var/log/ublinux/${name}.log || echo "can not create log file" + $0 "$@" 2>&1 | tee -a ${slash}var/log/ublinux/${name}.log + exit 0 + fi + fi +} + +echodebug() +{ + [ "$DEBUG_IS_ENABLED" -o "$DEBUGMODE" == "yes" ] && echo "$1" + if [ -n "$2" ] ;then + command=$2 + shift ; shift + if [ -z $1 ] ;then + $command + else + $command "$@" + fi + fi +} + +# Create module +# call mksquashfs with apropriate arguments +# $1 = directory which will be compressed to squashfs module +# $2 = output filesystem module file +# $3..$9 = optional arguments like -keep-as-directory or -b 123456789 +# +create_module() +{ + . /usr/lib/ublinux/os-config + . /etc/ublinux/config 2>/dev/null + echo " $@ " | egrep -q ' -comp | -noD ' && MKSQFS_OPTS= + mksquashfs "$1" "$2" $MKSQFS_OPTS $3 $4 $5 $6 $7 $8 $9 -noappend >/dev/null || return 1 + chmod 444 "$2" +} + +# look into cmdline and echo $1 back if $1 is set +# $1 = value name, case sensitive, for example 'debug' +# +cmdline_parameter() +{ + . /etc/ublinux/config 2>/dev/null || . etc/ublinux/config 2>/dev/null + echo -n " $CMDLINE " | cat /proc/cmdline - 2>/dev/null | tr "[:cntrl:]" " " | egrep -m1 -o "(^|[[:space:]])$1([[:space:]]|\$)" | head -1 | tr -d " " +} + +# look into cmdline and echo value of $1 option +# $1 = value name, case sensitive, for example 'changes' +# +cmdline_value() +{ + . /etc/ublinux/config 2>/dev/null || . etc/ublinux/config 2>/dev/null + echo -n " $CMDLINE " | cat /proc/cmdline - 2>/dev/null | tr "[:cntrl:]" " " | egrep -m1 -o "(^|[[:space:]])$1=[^[:space:]]+" | head -1 | cut -d "=" -f 2- +} + +# Find and run all scripts from the given module +# This function is used by the activate and deactivate script when the distro +# is already started, not during live setup +# $1 = mounted module full path +# $2..$n = optional arguments for the scripts, eg. 'start' +# +find_n_run_scripts() +{ + debug_log "find_n_run_scripts" "$*" + local MOD + + MOD="$1" + shift + + RCPATH=/etc/rc.d/init.d + [ -d $RCPATH ] || RCPATH=/etc/init.d + RUNLEVEL=$(runlevel | awk '{print $2}') + [ -d "/etc/rc$RUNLEVEL.d" ] && RCPATH=/etc/rc$RUNLEVEL.d + [ -d "/etc/rc.d/rc$RUNLEVEL.d" ] && RCPATH=/etc/rc.d/rc$RUNLEVEL.d + RUNSCRIPTS="$MOD$RCPATH|$MOD/usr/lib/ublinux/rc.local|$MOD/usr/lib/ublinux/rc.post" + echo $@ | grep -q start || RUNSCRIPTS="$MOD$RCPATH" + + find "$MOD" | egrep "$RUNSCRIPTS" | cut -b "${#MOD}"- | cut -b 2- | xargs -n 1 -r readlink -f | sort -u | \ + while read SCRIPT; do + if [ "$SCRIPT" != "" -a -x "$SCRIPT" -a ! -d "$SCRIPT" ]; then + # call the script by real path, not from the module + log "starting '"$SCRIPT" $@'" + "${SCRIPT}" "$@" + fi + done +} + +# test if the script is started by root user. If not, exit +allow_only_root() +{ + if [ "0$UID" -ne 0 ]; then + echo "Only root can run $(basename $0)"; exit 1 + fi +} + + +##################### +# Hotkeys functions # +##################### + +show_run() +{ + DE=$(detectDE) + if [ "$DE" = "kde" -o "$DE" = "plasma" ] ; then + krunner + elif [ "$DE" = "gnome" ] ; then + gnome-panel-control --run-dialog + elif [ "$DE" = "lxqt" ] ; then + lxqt-runner + else + rofi -config /usr/share/ublinux/i3/rofi.cfg -show + fi +} + +lock_session() +{ + DE=$(detectDE) +# qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.Lock + xterm -geometry 0x0+1+1 -e "dbus-send --dest=org.freedesktop.ScreenSaver --print-reply /ScreenSaver org.freedesktop.ScreenSaver.Lock" + if [ "$DE" != "kde" -a "$DE" != "plasma" ] ; then + ps -U $(id -u) | grep -q xscreensaver || xscreensaver -no-splash & + sleep 0.5s + xscreensaver-command -lock + fi +} + +xss_slideshow() +{ + chbg -xscreensaver -randomize -R -effect 1 -interval 0.2 -mode smart -max_size 100 -R /usr/share/ublinux/screensaver/Default >/dev/null 2>&1 +} + +xss_heartbeat() +{ + . /usr/lib/ublinux/os-config + . /etc/ublinux/config 2>/dev/null + SSAVERBLOCKAPPS="$(echo "$SSAVERBLOCKAPPS"| tr ',; ' '|' )" + bash -c "while true ;do top -bn1 -u $(id -un) | awk '{ print \$7 FS \$NF }' | grep ^[1-9] | egrep -q \"$SSAVERBLOCKAPPS\" && xscreensaver-command -deactivate >/dev/null ; sleep 20s ; done " & +} + + +show_hotkeys() +{ + MSG1=$(gettext -s "UBLinux magic keys:") + echo "$MSG1" > /tmp/listkeys + echo " " >> /tmp/listkeys + cat $HOME/.xbindkeysrc | sed -e 's/^".*"//' -e 's/Mod4/WIN/' -e '/^#.*#/ d' -e '/^ *$/ d' -e 's/^# *//' | while read a ; do + gettext -s "$a" >> /tmp/listkeys + done + mdialog --textbox /tmp/listkeys 600 600 + rm -f /tmp/listkeys +} + +show_info() +{ + . /etc/os-release + LIVECDNAME="$NAME" + UPTIME=$(uptime | awk '{print "time - "$1", up - "$3}') + RAM=$(free -m | grep Mem | awk '{ print "total - "$2", free - "$4}') + SWAP=$(free -m | grep Swap | awk '{ print "total - "$2", free - "$4}') + CPU="$(cat /proc/cpuinfo | sed -e '/model name/!d' -e 's/^.*://')" + CPUARCH=$(uname -p) + KERNEL=$(uname -r) + VIDEO=$(lspci | sed -e '/VGA/!d' -e 's/^.*://') + GLXINFO=$(glxinfo | sed '2,3!d') + AUDIO=$(lspci | sed -e '/Audio/!d' -e 's/^.*://') + CMDLINE=$(cat /proc/cmdline) + VERSION=$(cat /etc/ublinux-release) + if [ $(cmdline_parameter unionfs) ] ;then + PROF_SIZE=$(df -h / |grep unionfs | awk '{print " ["$5"] total - "$2", free - "$4}') + else + PROF_SIZE=$(df -h / |grep aufs | awk '{print " ["$5"] total - "$2", free - "$4}') + fi + echo "$LIVECDNAME ($VERSION)" > ~/info.txt + echo "UPTIME: $UPTIME" >> ~/info.txt + echo "KERNEL: $KERNEL" >> ~/info.txt + echo "RAM: $RAM" >> ~/info.txt + echo "SWAP: $SWAP" >> ~/info.txt + [ "$(cat /proc/cmdline | grep changes= )" ] && echo "PROFILE: $PROF_SIZE" >> ~/info.txt + echo -e "CPU: ($CPUARCH) \n$CPU" >> ~/info.txt + echo "VIDEO: $VIDEO" >> ~/info.txt + echo "$GLXINFO" >> ~/info.txt + echo "AUDIO: $AUDIO" >> ~/info.txt + echo "CMDLINE: $CMDLINE" >> ~/info.txt + echo "MODULES:" >> ~/info.txt + grep squashfs /proc/mounts | awk '{print $2}' | sort >> ~/info.txt + mdialog --textbox $HOME/info.txt + rm -f $HOME/info.txt +} + +touchpad() +{ + MSG2=$(gettext -s "Touchpad disabled, WIN+t to enable again") + if [ $(synclient -l | grep TouchpadOff | awk '{ print $3 }') -eq 0 ] ;then + synclient TouchpadOff=1 + mdialog --passivepopup "$MSG2" + else + synclient TouchpadOff=0 + fi +} + +rfswitch() +{ + MSG3=$(gettext -s "bluetooth, WI-FI interfaces disabled, WIN+w to enable again") + rfkill list | grep yes + if [ $? -eq 0 ] ;then + rfkill unblock all + else + rfkill block all + mdialog --passivepopup "$MSG3" + fi +} + +recordvideo() +{ + MSG1=$(gettext -s "Recording are stoped, please wait for encoding") + MSG2=$(gettext -s "Video are encoded and placed to your home dir") + RMDOPT= + . /etc/ublinux/config 2>/dev/null + ps -U $UID | grep -q pulseaudio && RMDOPT="$RMDOPT --device pulse" + PID=$(ps -U $UID -o pid,comm | grep recordmydesktop | awk '{print $1}') + if [ -z "$PID" ] ;then + recordmydesktop $RMDOPT & + else + kill "$PID" + mdialog --passivepopup "$MSG1" + bash -c "while true ;do ps -A -o pid | grep -q ^$PID$ || break ; sleep 1s ;done ; mdialog --passivepopup \"$MSG2\"" + fi +} + +show_network() +{ + echo "netstat --inet" > ~/network.txt + netstat --inet >> ~/network.txt + echo -e "\nlsof -i" >> ~/network.txt + /usr/sbin/lsof -i >> ~/network.txt + mdialog --textbox $HOME/network.txt 600 250 + rm -f $HOME/info.txt +} + +google_search() +{ + xclip -o | sed -r '2~1d;s/(^\s+|\s+$)//g;s/%/%25/g;s/#/%23/g;s/\$/%24/g;s/&/%26/g;s/\+/%2B/;s/,/%2C/g;s/:/%3A/g;s/;/%3B/g;s/=/%3D/g;s/\?/%3F/g;s/@/%40/g;s/\s/+/g' | awk '{print "http://www.google.ru/search?hl=ru&q=" $1}' | xargs firefox -new-tab +} + +translate_en_rus() +{ + [ "$1" == "passive" ] && mdialog --passivepopup "$(wget -U "Mozilla/5.0" -qO - "http://translate.google.com/translate_a/t?client=t&text=$(xclip -o | sed "s/[\"'<>]//g")&sl=auto&tl=ru" | sed 's/\[\[\[\"//' | cut -d \" -f 1)" + [ "$1" == "msgbox" ] && mdialog --msgbox "$(wget -U "Mozilla/5.0" -qO - "http://translate.google.com/translate_a/t?client=t&text=$(xclip -o | sed "s/[\"'<>]//g")&sl=auto&tl=ru" | sed 's/\[\[\[\"//' | cut -d \" -f 1)" + [ "$1" == "firefox" ] && xclip -o | sed -r '2~1d;s/(^\s+|\s+$)//g;s/%/%25/g;s/#/%23/g;s/\$/%24/g;s/&/%26/g;s/\+/%2B/;s/,/%2C/g;s/:/%3A/g;s/;/%3B/g;s/=/%3D/g;s/\?/%3F/g;s/@/%40/g;s/\s/+/g' | awk '{print "translate.google.com/translate_t?hl=en#en|ru|" $1}' | xargs firefox -new-tab +} + +translate_rus_en() +{ + [ "$1" == "passive" ] && mdialog --passivepopup "$(wget -U "Mozilla/5.0" -qO - "http://translate.google.com/translate_a/t?client=t&text=$(xclip -o | sed "s/[\"'<>]//g")&sl=auto&tl=en" | sed 's/\[\[\[\"//' | cut -d \" -f 1)" + [ "$1" == "msgbox" ] && mdialog --msgbox "$(wget -U "Mozilla/5.0" -qO - "http://translate.google.com/translate_a/t?client=t&text=$(xclip -o | sed "s/[\"'<>]//g")&sl=auto&tl=en" | sed 's/\[\[\[\"//' | cut -d \" -f 1)" + [ "$1" == "firefox" ] && xclip -o | sed -r '2~1d;s/(^\s+|\s+$)//g;s/%/%25/g;s/#/%23/g;s/\$/%24/g;s/&/%26/g;s/\+/%2B/;s/,/%2C/g;s/:/%3A/g;s/;/%3B/g;s/=/%3D/g;s/\?/%3F/g;s/@/%40/g;s/\s/+/g' | awk '{print "translate.google.com/translate_t?hl=ru#ru|en|" $1}' | xargs firefox -new-tab +} + +open_url() +{ + xclip -o | sed -n 1p | xargs firefox -new-tab +} + +userkeys() +{ + string=$(head -n $1 $HOME/.userkeys | tail -n 1) + TMPFILE=$HOME/tmp/userkey-$(id -un) + > $TMPFILE + echo "#!/bin/bash" > $TMPFILE + echo "$string" >> $TMPFILE + chmod +x $TMPFILE + $TMPFILE + rm -f $TMPFILE +} + +screen_scale() +{ + scale_[1]=1x1 + scale_[2]=1x1.2 + scale_[3]=1.2x1.2 + scale_[4]=1.2x1.5 + scale_[5]=1.5x1.5 + scale=2 + [ -f /tmp/scale ] && scale=$(cat /tmp/scale) + xrandr --output LVDS1 --scale ${scale_[$scale]} + if [ $scale == 5 ] ; then + echo 1 > /tmp/scale + else + echo $(expr $scale + 1) > /tmp/scale + fi +} + +[ "$(basename $0)" = "functions" ] && $@ || true diff --git a/ublinux/os-config b/ublinux/os-config new file mode 100644 index 0000000..f0602f3 --- /dev/null +++ b/ublinux/os-config @@ -0,0 +1,186 @@ +#!/usr/bin/bash +#this file contains different values for ublinux scripts + +declare -A AUTHPAM +declare -A DOMAIN + +##rc.desktop/all/* is launching when desktop is ready + +#rc.desktop/all/autoexec +# autostart apps/scripts +#AUTOEXEC= + +#rc.desktop/all/fusion-icon +# timeout to start fusion-icon +#FUSIONICONTIMEOUT=5 +# disable fusion-icon for de +#FUSIONICONDEDIS=gnome-shell,gnome,i3term + +#rc.desktop/all/keyboard +# set keyboard layout when system start +#RESETKBMODE=yes +# set on/off/autoset numlock kbd mode +#NUMLOCK + +#rc.desktop/all/ublinuxupdate +UBLINUXUPDATE=ask +MUPDSRCHTTP=http://mirror.yandex.ru/mirrors/ublinux/netlive +MUPDSRCRSYNC=rsync://mirror.yandex.ru:/mirrors/ublinux/netlive + +#rc.desktop/all/xbindkeys +#XBINDKEYSSTART=yes +#XBINDKEYSOPTIONS= + +#rc.desktop/gnome/guake +#GUAKESTART=yes + +#rc.desktop/all/pulseaudio +#PULSEAUDIOSTART=yes + +#rc.desktop/kde/hideloop4dolphin +# kde dolphin workaround. scripts hides loop devices in places bar +#HIDELOOP4DOLPHIN=yes +#DOLPHINBOOKMARKS=.local/share/user-places.xbel +#HIDELOOP=255 +#HIDERAM=0 + +#rc.desktop/kde/yakuake +#YAKUAKESTART=yes + +#rc.desktop/kde/parcellite +#PARCELLITESTART=yes + +#rc.domain.d/30-usershwaccess +#DOMUSGR=audio,video,usb,vboxusers,bumblebee,cdrom,cdwriter,lp,floppy + +#rc.halt/20-timesave +#HALTSAVETIME=yes + +#rc.local.d/01-background +WALLPAPERSRES=1920x1080 +WPDEFDIR=/mnt/livedata/ublinux-data/backgrounds/wallpapers/Default +SSDEFDIR=/mnt/livedata/ublinux-data/backgrounds/screensaver/Default +WPSYSDIR=/usr/share/ublinux/wallpapers/Default +SSSYSDIR=/usr/share/ublinux/screensaver/Default +WPDEFFILE=/usr/share/ublinux/wallpapers/default.jpg + +#rc.local.d/10-network +# start interface if its not networkmanager +#AUTOSTARTIFNNM=yes +#NFSMOUNTTM=10 +#NFSMOUNTWAIT=6 +#NFSOPTS="vers=3,nolock,users,noauto" + +#rc.local.d/31-sound +# to set default alsa card in case of 0 card is HDMI (see aplay -l) +#SNDFINCARD=yes +# mixer settings (see amixer) +#SNDMIXSET=yes +#SNDMIX_MASTER_N=Master +#SNDMIX_MASTER_VOL=35% +#SNDMIX_DEFAULT_VOL=90% +#SNDMIX_SWITCH_ON="IEC958 Playback Default,IEC958 Playback Switch" +#SNDMIX_SWITCH_OFF="Beep Playback Switch,Mic Playback Switch" + +#rc.local.d/51-gtk-update-icon-cache +#UPDATEGTKICONCACHE=yes +#UPDATEGTKICONOPTS="-fit /usr/share/icons/hicolor" + +#rc.local.d/51-mozilla_extensions +#REGISTERMOZEXT=yes + +#rc.local.d/81-samba +# make random passwords for samba users (for home nets) +#MKSMBPWD=yes + +#rc.post.d/02-hwclock +#SETCLKATSTART=yes + +# for help "man xkeyboard-config" +#rc.post.d/11-xorg +HARDCONF=etc/ublinux/service.conf +# make /etc/X11/xorg.conf.d/00-keyboard.conf +#SETXORGRES=yes +#MKKBDFXORG=yes + +# options (only if its not specified in /etc/ublinux/keyboard ) +XkbModel=pc105 +XkbLayout=us,ru +KEYBOARD=ru +KEYTABLE=ru4 +GRP_TOGGLE=lctrl_lshift_toggle +XkbOptions=grp:lctrl_lshift_toggle,grp_led:scroll,compose:rwin +#STEAMNODPMS=yes + + +#/rc.preinit/10-accounts +DEFAULTPASSWD='$6$E7stRhRS8fCKk7UU$Qoqw62AUaUa5uLIc2KC7WV3MUThhrR8kjXtCODmnKCzKe2zHu1/wmsiWBHZEIk/IQnk/aELQYbUK93OUtrwg60' +DEFAULTROOTPASSWD='$6$E7stRhRS8fCKk7UU$Qoqw62AUaUa5uLIc2KC7WV3MUThhrR8kjXtCODmnKCzKe2zHu1/wmsiWBHZEIk/IQnk/aELQYbUK93OUtrwg60' +DEFAULTUSER=superadmin +DEFAULTGROUP=users +USERGROUPS=nobody,scanner,power,audio,lp,optical,storage,video,sambashare,vboxusers,libvirt +NOSECUREROOTPASSWD=$DEFAULTROOTPASSWD +ADMGROUPS=wheel,vboxsf,disk +ADMUID=1000 +ADDADM=yes + +#/rc.preinit/10-accounts +HASHPASSWD=sha512crypt + +#/rc.preinit/50-xorg +#NVIDIATEST="nvidia-current nvidia340 nvidia304 nvidia" +#FAILSAFENVIDIA=nouveau +#CREATE_XORG_CONF=yes +#XFILE=etc/X11/xorg.conf + +#/rc.preinit/02-skel-adds +STEAMAPP=/mnt/livedata/ublinux-data/steam + +#/rc.preinit.d/53-language +#FORCE_LOCARCHIVE=no +LOCALE="en_US.UTF-8,ru_RU.UTF-8" +LANG="ru_RU.UTF-8" +CONSOLE_FONT=cyr-sun16 + +#/rc.preinit.d/20-services +SERVICESSTART=dbus-broker,NetworkManager,sshd,systemd-swap,systemd-timesyncd,cups,cockpit.socket,avahi-daemon,avahi-dnsconfd,veyon,smb,nmb,winbind,bluetooth + +#/rc.preinit.d/23-publicdir +# Папка с правами 777 доступная всем локальным пользователям и при разрешении всем из сети +PUBLICDIR=/home/public + +#/rc.halt.pre/10-shutdown +#HALTSERVICESSTOP="" +#HALTPROCESSESKILL="slim kdm X lxdm xdm sddm cupsd pdnsd mc mandb" + +#/rc.post.d/03-modprobepreload +#MODPROBEPRELOAD=yes + +#/rc.post/11-xorg +#DELETE_XORG_CONF=no + +#/scripts/ublinuxrepack +#MKSQFS_FASTALG="-b 512K -comp lz4 -Xhc" +MKSQFS_FASTALG="-b 32K -comp gzip" + +#/rc.desktop/lxqt/qterminal +#QTERMINALSTART=yes + +#/rc.preinit.d/52-desktop +#/rc.post.d/02-hwclock +#/rc.post.d/11-xorg +SYSCONF=/etc/ublinux + +#/rc.d/rc.desktop +#NOEXEC="i3term:xbindkeys;i3term:fusion-icon;i3term:ublinuxupdate" + +#/rc.desktop/i3term/exclusiveapp +#EXCLUSIVEAPP=remmina + +#/functions +#MKSQFS_OPTS="-b 512K -comp xz -Xbcj x86" +MKSQFS_OPTS="-b 32K -comp gzip" + +AUTHPAM[minimal]=with-faillock,with-time,with-systemd-homed + +DOMAIN[client]=realmd_sssd diff --git a/ublinux/rc.d/init.d/compcache b/ublinux/rc.d/init.d/compcache new file mode 100755 index 0000000..63c089d --- /dev/null +++ b/ublinux/rc.d/init.d/compcache @@ -0,0 +1,67 @@ +#!/bin/sh +# +# Compcache startup script +# +# chkconfig: 2345 26 59 +# +# description: Compcache uses part of the RAM as a compressed swap device +# +### BEGIN INIT INFO +# Provides: compcache +# Default-Start: 2 3 4 5 +# Short-Description: Compcache service +# Description: Compcache uses part of the RAM as a compressed swap device +### END INIT INFO + +. /lib/lsb/init-functions + +[ -f /etc/ublinux/services/compcache ] && . /etc/ublinux/services/compcache + +NUM_DEVICES=${NUM_DEVICES:-4} +[ -z "$ZRAMSIZE" ] && ZRAMSIZE=$(($(free -b | grep -m1 -i ^mem: | awk '{print $2}') /4)) +GPRINTF=gprintf +[ -f /etc/init.d/functions ] || GPRINTF=log_daemon_msg + +case "$1" in + start) + $GPRINTF "Loading compcache: " + /sbin/modprobe zram num_devices=$NUM_DEVICES && \ + echo $ZRAMSIZE > /sys/block/zram0/disksize && \ + mkswap /dev/zram0 >/dev/null 2>&1 && \ + swapon /dev/zram0 + RETVAL=$? + if [ $RETVAL = 0 ]; then + log_success_msg $"%s startup" "$base" + else + log_failure_msg $"%s startup" "$base" + fi + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/compcache + ;; + stop) + $GPRINTF "Stopping compcache: " + test -e /dev/zram0 && swapoff /dev/zram0 && sleep 0.5 && rmmod zram + RETVAL=$? + if [ $RETVAL = 0 ]; then + log_success_msg $"%s stop" "$base" + else + log_failure_msg $"%s stop" "$base" + fi + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/compcache + ;; + status) + swapon -s | grep -q /dev/zram0 + RETVAL=$? + ;; + restart|reload) + $0 stop + $0 start + ;; + *) + echo "Usage: $0 {start|stop|status|restart}" + RETVAL=1 + ;; +esac + +exit $RETVAL diff --git a/ublinux/rc.d/init.d/ntlmaps b/ublinux/rc.d/init.d/ntlmaps new file mode 100755 index 0000000..350bf85 --- /dev/null +++ b/ublinux/rc.d/init.d/ntlmaps @@ -0,0 +1,113 @@ +#!/bin/sh +# +# Polipo Startup script for the NTLM Authorization Proxy Server +# +# chkconfig: - 95 15 +# description: NTLMAPS is a proxy-like software, that will authorize you at MS proxy server\ +# and at web servers (ISS especially) using MS proprietary NTLM authorization method +# processname: ntlmaps +### BEGIN INIT INFO +# Provides: ntlmaps +# Required-Start: $local_fs $network $named winbind +# Required-Stop: $local_fs $network $named winbind +# Short-Description: NTLM Authorization Proxy Server +# Default-Start: 3 4 5 +# Description: NTLMAPS is a proxy-like software, that will authorize you at MS proxy server +# and at web servers (ISS especially) using MS proprietary NTLM authorization method. +### END INIT INFO + +# Source function library. +. /lib/lsb/init-functions + +# Source networking configuration +[ -f /etc/ublinux/network ] && . /etc/ublinux/network + +STATUS=status +[ -f /etc/init.d/functions ] || STATUS=status_of_proc +GPRINTF=gprintf +[ -f /etc/init.d/functions ] || GPRINTF=log_daemon_msg + +ntlmaps=${NTLMAPS-/usr/share/ntlmaps/ntlmaps} +prog=ntlmaps +config=${CONFIG-/etc/ntlmaps.cfg} +pidfile=${PIDFILE-/var/run/ntlmaps.pid} +lockfile=${LOCKFILE-/var/lock/subsys/ntlmaps} +logdir=${LOGDIR-/var/log/ntlmaps} +pwddir=$PWD +port=5865 +TIMEOUT=${TIMEOUT-10} +RETVAL=0 + + +start() { + # Check that networking is up. + [ ${NETWORKING} = "no" ] && exit 1 + [ -x $ntlmaps ] || exit 1 + [ `id -u` -ne 0 ] && exit 4 + # check if the config is present + [ -f $config ] || exit 6 + [ -f $pidfile ] && exit 1 + [ -d $logdir ] || mkdir $logdir + chmod 700 $logdir + cd $logdir + $GPRINTF "Starting ntlmaps: " "$prog" + start_daemon $ntlmaps -c $config /dev/null 2>/dev/null & + while [ "$TIMEOUT" != "0" ] ;do + PRPID=$(/usr/sbin/lsof 2>/dev/null| grep ":$port .LISTEN." | awk '{print $2}') + [ -z "$PRPID" ] || break + sleep 1 + TIMEOUT=$(( $TIMEOUT - 1 )) + done + if [ "$PRPID" = "" ] ;then + RETVAL=1 + log_failure_msg + else + RETVAL=0 + log_success_msg + touch ${lockfile} + echo -ne $PRPID > ${pidfile} + fi + echo + cd $pwddir + return $RETVAL +} +stop() { + $GPRINTF "Stopping ntlmaps: " "$prog" + PRPID=$(cat $pidfile 2>/dev/null) + if [ "$PRPID" = "" ] ;then + log_failure_msg + else + kill $PRPID >/dev/null 2>&1 && log_success_msg || log_failure_msg + fi + echo + rm -f ${lockfile} ${pidfile} 2>/dev/null +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + $STATUS -p ${pidfile} $prog + RETVAL=$? + ;; + restart) + stop + start + ;; + condrestart|try-restart) + if $STATUS -p ${pidfile} $ntlmaps >&/dev/null; then + stop + start + fi + ;; + *) + echo "Usage: $prog {start|stop|restart|condrestart|status}" + RETVAL=3 +esac + +exit $RETVAL diff --git a/ublinux/rc.d/rc.desktop b/ublinux/rc.d/rc.desktop new file mode 100755 index 0000000..b2b872c --- /dev/null +++ b/ublinux/rc.d/rc.desktop @@ -0,0 +1,30 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +NOEXEC="i3term:xbindkeys;i3term:fusion-icon;i3term:ublinuxupdate" + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +DE=$(detectDE) +cd $HOME + +NOEXEC=$(echo " $NOEXEC " | tr ',;' ' ') + +# We have to launch some rc scripts +for a in /usr/lib/ublinux/rc.desktop/$DE/* ;do + [ -x $a ] && $a & 2>/dev/null +done +for a in /usr/lib/ublinux/rc.desktop/all/* ;do + echo "$NOEXEC" | grep -q " $(basename $a) " && continue + echo "$NOEXEC" | grep -q " $DE:$(basename $a) " && continue + [ -x $a ] && $a & 2>/dev/null +done + +echo 1 > /run/ublinux_started + +true diff --git a/ublinux/rc.d/rc.halt b/ublinux/rc.d/rc.halt new file mode 100755 index 0000000..2010c54 --- /dev/null +++ b/ublinux/rc.d/rc.halt @@ -0,0 +1,7 @@ +#!/bin/bash + +for a in /usr/lib/ublinux/rc.halt/* ;do + [ -x $a ] && $a 2>/dev/null +done + +true diff --git a/ublinux/rc.d/rc.halt.pre b/ublinux/rc.d/rc.halt.pre new file mode 100755 index 0000000..e17d556 --- /dev/null +++ b/ublinux/rc.d/rc.halt.pre @@ -0,0 +1,7 @@ +#!/bin/bash + +for a in /usr/lib/ublinux/rc.halt.pre/* ;do + [ -x $a ] && $a 2>/dev/null +done + +true diff --git a/ublinux/rc.d/rc.local b/ublinux/rc.d/rc.local new file mode 100755 index 0000000..4e4460c --- /dev/null +++ b/ublinux/rc.d/rc.local @@ -0,0 +1,19 @@ +#!/bin/bash + +DEBUGMODE=no +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +# We have to launch some rc scripts +for a in /usr/lib/ublinux/rc.local.d/* ;do + [ -x $a ] && $a 2>/dev/null & +done + +echo -ne > /run/ublinux_started +chgrp users /run/ublinux_started +chmod 664 /run/ublinux_started + +true diff --git a/ublinux/rc.d/rc.network b/ublinux/rc.d/rc.network new file mode 100755 index 0000000..696c6e9 --- /dev/null +++ b/ublinux/rc.d/rc.network @@ -0,0 +1,15 @@ +#!/bin/bash + +DEBUGMODE=no +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +# We have to launch some rc scripts +for a in /usr/lib/ublinux/rc.network.d/* ;do + [ -x $a ] && $a 2>/dev/null & +done + +true diff --git a/ublinux/rc.d/rc.post b/ublinux/rc.d/rc.post new file mode 100755 index 0000000..6d5af4e --- /dev/null +++ b/ublinux/rc.d/rc.post @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +DEBUGMODE=no +. /usr/lib/ublinux/functions +debug_mode "$0" "$@" + +for a in /usr/lib/ublinux/rc.post.d/* ;do + [ -x $a ] && $a 2>/dev/null & +done +for a in /usr/lib/ublinux/rc.post/* ;do + [ -x $a ] && $a 2>/dev/null +done + +# We have to launch some rc scripts from external modules +LOCKDIR=/var/lock/ublinux/rc.runonce +[ -d "$LOCKDIR" ] || mkdir -p "$LOCKDIR" +for a in /usr/lib/ublinux/rc.runonce/* ;do + [ -f "$LOCKDIR/$(basename $a)" -o ! -x "$a" ] && continue + $a start 2>/dev/null + touch "$LOCKDIR/$(basename $a)" +done + +readlink -fq /usr/bin/init 2>/dev/null | grep -q /lib/systemd/systemd && wait + +true diff --git a/ublinux/rc.d/rc.preinit b/ublinux/rc.d/rc.preinit new file mode 100755 index 0000000..b012456 --- /dev/null +++ b/ublinux/rc.d/rc.preinit @@ -0,0 +1,25 @@ +#!/bin/bash + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +DEBUGMODE=no +. /liblinuxlive 2>/dev/null || . /mnt/live/liblinuxlive +debug_mode "$0" "$@" + +debug_log "starting rc.preinit" +debug_shell + +# install systemd services +[ ! -h usr/lib/systemd/system/ublinux-postinit.service ] && bash usr/lib/ublinux/rootfs-patches/ublinux/ublinux-00-install.sh + +# We have to launch some rc scripts +for a in usr/lib/ublinux/rc.preinit/* ;do + [ -x $a ] && $a 2>/dev/null +done +for a in usr/lib/ublinux/rc.preinit.d/* ;do + [ -x $a ] && $a 2>/dev/null & +done + +wait + +true diff --git a/ublinux/rc.d/rc.xorg b/ublinux/rc.d/rc.xorg new file mode 100755 index 0000000..d0e6b77 --- /dev/null +++ b/ublinux/rc.d/rc.xorg @@ -0,0 +1,7 @@ +#!/bin/sh + +for a in /usr/lib/ublinux/rc.xorg/* ;do + [ -x $a ] && $a 2>/dev/null +done + +true diff --git a/ublinux/rc.desktop/all/autoexec b/ublinux/rc.desktop/all/autoexec new file mode 100755 index 0000000..ab7114e --- /dev/null +++ b/ublinux/rc.desktop/all/autoexec @@ -0,0 +1,22 @@ +#!/bin/sh + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +DE=$(detectDE) +cd $HOME + +EXEC=$(cmdline_value exec) +[ "$EXEC" != "" -a "$AUTOEXEC" != "" ] && DELIM=, + +echo "$AUTOEXEC$DELIM$EXEC" | tr ',;' \\n | while read a ;do + NEEDDE=$(echo $a | grep : | awk -F: '{print $1}' | tr A-Z a-z) + PROGRAM=${a/*:/} + [ "$NEEDDE" -a "$NEEDDE" != "$DE" ] && continue + [ -z "$PROGRAM" ] || bash -c "$PROGRAM" & +done diff --git a/ublinux/rc.desktop/all/bookmarks b/ublinux/rc.desktop/all/bookmarks new file mode 100755 index 0000000..d100dab --- /dev/null +++ b/ublinux/rc.desktop/all/bookmarks @@ -0,0 +1,10 @@ +#!/bin/sh + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config + +# Фиксим ~/.config/gtk-3.0/bookmarks подставляя тукущего пользователя вместо ${USER} + + sed -i "s/\${USER}/${USER}/g" ~/.config/gtk-3.0/bookmarks diff --git a/ublinux/rc.desktop/all/fusion-icon b/ublinux/rc.desktop/all/fusion-icon new file mode 100755 index 0000000..e551cd0 --- /dev/null +++ b/ublinux/rc.desktop/all/fusion-icon @@ -0,0 +1,21 @@ +#!/bin/sh + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +FUSIONICONTIMEOUT=5 +FUSIONICONDEDIS=gnome-shell,gnome,i3term +[ -f /etc/ublinux/compositing-wm ] && . /etc/ublinux/compositing-wm +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +DE=$(detectDE) + +if [ "$COMPOSITING_WM_START" = "yes" -a "$COMPOSITING_WM" = "compiz-fusion" ] ;then + if ! echo " $FUSIONICONDEDIS " | tr ',;' " " | grep -q " $DE " ;then + sleep $FUSIONICONTIMEOUT + fusion-icon -f & + fi +fi diff --git a/ublinux/rc.desktop/all/keyboard b/ublinux/rc.desktop/all/keyboard new file mode 100755 index 0000000..f54c0b3 --- /dev/null +++ b/ublinux/rc.desktop/all/keyboard @@ -0,0 +1,22 @@ +#!/bin/sh + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/keyboard; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +[ "$RESETKBMODE" != "no" ] && setxkbmap $XkbLayout -model $XkbModel -option $XkbOptions + +# Automatic detection PC/notebooks +if [ -z "$NUMLOCK" ] ; then + if xinput list | grep -qi touchpad ; then + NUMLOCK=no + else + NUMLOCK=yes + fi +fi + +[ "$NUMLOCK" = "yes" -o "$NUMLOCK" = "on" ] && numlockx on +[ "$NUMLOCK" = "no" -o "$NUMLOCK" = "off" ] && numlockx off diff --git a/ublinux/rc.desktop/all/ldconfig b/ublinux/rc.desktop/all/ldconfig new file mode 100755 index 0000000..d23cce9 --- /dev/null +++ b/ublinux/rc.desktop/all/ldconfig @@ -0,0 +1,8 @@ +#!/bin/bash + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +[ "$RUNLDCONFIG" != "yes" -a "$RUNLDCONFIG" != "no" ] && bash -c "sleep 30 && sudo /sbin/ldconfig" & diff --git a/ublinux/rc.desktop/all/placeondesktop b/ublinux/rc.desktop/all/placeondesktop new file mode 100755 index 0000000..772d55a --- /dev/null +++ b/ublinux/rc.desktop/all/placeondesktop @@ -0,0 +1,21 @@ +#!/bin/sh + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +XDG_DESKTOP_DIR="$HOME/Рабочий стол" + +. /usr/lib/ublinux/os-config +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +[ -z "$PLACEONDESKTOP" ] && exit 0 +[ -f ~/.config/.desktopinitialized ] && exit 0 +. ~/.config/user-dirs.dirs +[ -d "$XDG_DESKTOP_DIR" ] || mkdir -p "$XDG_DESKTOP_DIR" +echo "$PLACEONDESKTOP" | tr ',;' \\n | while read a ;do + DF=$(find /usr/share/applications -type f -name $a.desktop ) + [ -f "$DF" ] && cp "$DF" "$XDG_DESKTOP_DIR" + grep "#!/usr/bin/env xdg-open" "$XDG_DESKTOP_DIR"/$a.desktop || sed -i 1s%^%'\#\!/usr/bin/env xdg-open\n'% "$XDG_DESKTOP_DIR"/$a.desktop + chmod 755 "$XDG_DESKTOP_DIR"/$a.desktop +done +touch ~/.config/.desktopinitialized diff --git a/ublinux/rc.desktop/all/pulseaudio b/ublinux/rc.desktop/all/pulseaudio new file mode 100755 index 0000000..40fac05 --- /dev/null +++ b/ublinux/rc.desktop/all/pulseaudio @@ -0,0 +1,9 @@ +#!/bin/sh + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config +[ -f /etc/sound/profiles/current/profile.conf ] && . /etc/sound/profiles/current/profile.conf + +[ "$SOUNDPROFILE" = "pulse" -a "$PULSEAUDIOSTART" != "no" ] && start-pulseaudio-x11 & diff --git a/ublinux/rc.desktop/all/qtox b/ublinux/rc.desktop/all/qtox new file mode 100755 index 0000000..ad77bd3 --- /dev/null +++ b/ublinux/rc.desktop/all/qtox @@ -0,0 +1,19 @@ +#!/bin/sh + +[ -f ~/.config/tox/qtox.ini ] && exit 0 + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +TOXLANG=$(cmdline_value lang) +[ -z "$TOXLANG" ] && TOXLANG=ru +mkdir -p ~/.config/tox +cat >~/.config/tox/qtox.ini </dev/null && STATUSPID= +} + +function dialogreboot() +{ + MSG01=$(gettext -s "System update is over") + MSG02=$(gettext -s "System updated. Please reboot computer.") + MSG03=$(gettext -s "Reboot now") + MSG04=$(gettext -s "No, i will reboot later") + CHOISE=$(Xdialog --title "$MSG01" --radiolist "$MSG02" 0 0 3 "1" "$MSG03" on "2" "$MSG04" off 2>&1 | tail -1) + [ "$CHOISE" = "1" ] || exit 0 + systemctl reboot + reboot +} + +function dialogrevert() +{ + stopstatus + MSG01=$(gettext -s "It's possible to revert update.") + MSG02=$(gettext -s "System started from backup version currently.")"\n"$(gettext -s "If you have a problems with new version, you can revert update.")"\n"$(gettext -s "Do you want to remove new version and switch to old one?") + MSG03=$(gettext -s "Yes, downgrade back to old version now") + MSG04=$(gettext -s "No, do nothing right now") + CHOISE=$(Xdialog --title "$MSG01" --radiolist "$MSG02" 0 0 3 "1" "$MSG03" off "2" "$MSG04" on 2>&1 | tail -1) + [ "$CHOISE" = "1" ] && return 0 + return 1 +} + +function dialogerrorlog() +{ + stopstatus + MSG01=$(gettext -s "Update was unsuccessful.") + cat $LOGFILE-$(id -u).log $LOGFILE-0.log > $LOGFILE.log 2>/dev/null + Xdialog --title "$MSG01" --no-cancel --textbox $LOGFILE.log 0 0 + exit 1 +} + +function dialognoupdates() +{ + stopstatus + MSG01=$(gettext -s "System update") + MSG02=$(gettext -s "Updates were not found at server.") + Xdialog --title "$MSG01" --msgbox "$MSG02" 0 0 +} + +function errorexit() +{ + stopstatus + if [ "$VERBOSE" = "1" ] ;then + MSG01=$(gettext -s "Error") + MSG02=$(gettext -s "$1") + Xdialog --title "$MSG01" --msgbox "$MSG02" 0 0 + else + echo $1 + fi + exit 1 +} + +# $1 text string +function dialogupdate() +{ + stopstatus + MSG01=$(gettext -s "Please select") + MSG02=$(gettext -s "$1") + MSG03=$(gettext -s "Do you want to update it now?") + MSG04=$(gettext -s "Yes, right now") + MSG05=$(gettext -s "No, later") + MSG06=$(gettext -s "Never, don't ask me again") + CHOISE=$(Xdialog --title "$MSG01" --radiolist "$MSG02\n$MSG03" 0 0 4 "1" "$MSG04" on "2" "$MSG05" off "3" "$MSG06" off 2>&1 | tail -1) + if [ "$CHOISE" = "3" ] ;then + touch $UBLINUXPATH/.dontupdateublinux 2>/dev/null || touch $HOME/.config/.dontupdateublinux + fi + [ "$CHOISE" = "1" ] && return 0 + return 1 +} + +export TEXTDOMAINDIR=/usr/share/locale +export TEXTDOMAIN=ublinux_functions +echo $PATH | grep -q /usr/lib/ublinux/scripts || PATH=/usr/lib/ublinux/scripts:$PATH +. /etc/os-release +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +DEBUGMODE=no +debug_mode "$0" "$@" +LOGFILE=/tmp/ublinuxupdate + +UBLINUXPATH=/mnt/livemedia/ublinux +[ -f /mnt/live/etc/modules ] && . /mnt/live/etc/modules +[ ! -z "$UBLINUXMODS" -a -d "$UBLINUXMODS/base" ] && UBLINUXPATH="$UBLINUXMODS" +[ -f "$UBLINUXPATH/vmlinuz" -a -d "$UBLINUXPATH/base" ] || errorexit "Can't find system folder" + +NEEDREBOOT=0 +[ "$1" = "--verbose" ] && VERBOSE=1 +grep -q "ub.from=ublinux.bak" /proc/cmdline && RUNFROMBACKUP=1 + +if [ "$VERBOSE" = "1" ] ;then + MSG01=$(gettext -s "System update") + MSG02=$(gettext -s "Please wait. Connecting to server...") + Xdialog --title "$MSG01" --no-close --no-buttons --infobox "\n$MSG02\n" 0 0 990000 2>/dev/null & + STATUSPID=$! +fi + +#check for readonly filesystem +ublinuxupdate --checkdir || errorexit "Can't find system folder" + +if [ "$RUNFROMBACKUP" != "1" ] ;then + #check for internet connection + if [ "$VERBOSE" = "1" ] ;then + ping -c 1 -W 1 77.88.8.8 >/dev/null 2>&1 || errorexit "Not connected to internet" + else + #check if update is disabled or auto + echo $UBLINUXUPDATE | grep -qi ^ask$ || exit 0 + [ -f $UBLINUXPATH/.dontupdateublinux -o -f $HOME/.config/.dontupdateublinux ] && exit 0 + fi + ublinuxupdate --checkserver || errorexit "Can't connect with server" +fi + +#check for updates +MSG01=$(gettext -s "New version of")" $PRETTY_NAME "$(gettext -s "is detected on server.") +MSG02=$(gettext -s "New updates for")" $PRETTY_NAME "$(gettext -s "are detected on server.") +if ublinuxupdate --checknewversion ;then + if dialogupdate "$MSG01" ;then + ublinuxupdate --updateversion || dialogerrorlog + grep -qi "please reboot" ${LOGFILE}-*.log && NEEDREBOOT=1 + fi +elif ublinuxupdate --checkupdates ;then + if dialogupdate "$MSG02" ;then + ublinuxupdate --updatebase || dialogerrorlog + grep -qi "please reboot" ${LOGFILE}-*.log && NEEDREBOOT=1 + fi +elif [ "$RUNFROMBACKUP" = "1" ] ;then + dialognoupdates + if dialogrevert ;then + ublinuxupdate --revertversion || dialogerrorlog + NEEDREBOOT=1 + fi +elif [ "$VERBOSE" = "1" ] ;then + dialognoupdates +fi + +[ "$NEEDREBOOT" = "1" ] && dialogreboot diff --git a/ublinux/rc.desktop/all/xbindkeys b/ublinux/rc.desktop/all/xbindkeys new file mode 100755 index 0000000..4359089 --- /dev/null +++ b/ublinux/rc.desktop/all/xbindkeys @@ -0,0 +1,8 @@ +#!/bin/sh + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config + +[ "$XBINDKEYSSTART" = "yes" ] && xbindkeys $XBINDKEYSOPTIONS & diff --git a/ublinux/rc.desktop/all/xss_heartbeat b/ublinux/rc.desktop/all/xss_heartbeat new file mode 100755 index 0000000..19349b9 --- /dev/null +++ b/ublinux/rc.desktop/all/xss_heartbeat @@ -0,0 +1,37 @@ +#!/bin/sh +# xscreensaver helper scripts +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +XSSHBTM=20s +# exit for DE +XSSDEIGNORE="kde,mate" +# exit if process started +XSSEXIT="screensaver" +# stop xss if process started +XSSBLRUNED="kscreenlocker" +# stop xss if process eats resources +XSSBLLOADED="media-play,mplayer,tvtime,firefox,steam,chromium" + + /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +which xscreensaver >/dev/null 2>&1 || exit 0 +DE=$(detectDE) +[ "$XSSDEIGNORE" = "all" ] && exit 0 +echo " $XSSDEIGNORE " | tr ',;' ' ' | grep -q " $DE " && exit 0 +XSSEXIT="$(echo "$XSSEXIT" | tr ',; ' '|' )" +ps -U $(id -un) -o comm | egrep -q "$XSSEXIT" && exit 0 + +xscreensaver -no-splash & +sleep 1s + +while true ;do + XSSBLRUNED="$(echo "$XSSBLRUNED" | tr ',; ' '|' )" + XSSBLLOADED="$(echo "$XSSBLLOADED" | tr ',; ' '|' )" + ps -U $(id -un) -o comm | egrep -q "$XSSBLRUNED" && xscreensaver-command -deactivate >/dev/null 2>&1 + top -bn1 -u $(id -un) | awk '{ print $7 FS $NF }' | grep ^[1-9] | egrep -q "$XSSBLLOADED" && xscreensaver-command -deactivate >/dev/null 2>&1 + sleep $XSSHBTM +done diff --git a/ublinux/rc.desktop/deonly/cryptkeeper b/ublinux/rc.desktop/deonly/cryptkeeper new file mode 100755 index 0000000..90fe309 --- /dev/null +++ b/ublinux/rc.desktop/deonly/cryptkeeper @@ -0,0 +1,14 @@ +#!/bin/sh +# +# Задача: заменить на sirikali (больше возможностей) +# + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +which $(basename $0) >/dev/null 2>&1 || exit 0 +[ "$CRYPTKEEPERSTART" != "no" ] && $(basename $0) & diff --git a/ublinux/rc.desktop/deonly/exclusiveapp b/ublinux/rc.desktop/deonly/exclusiveapp new file mode 100755 index 0000000..4b14dda --- /dev/null +++ b/ublinux/rc.desktop/deonly/exclusiveapp @@ -0,0 +1,60 @@ +#!/bin/sh + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +EXCLUSIVEAPP=remmina +TERMMODEEXIT="i3-msg exit" +TERMMODSCRIPTPRE= +TERMMODETIMEOUT=15 +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +function setsetting() +{ + if [ -f "$1" ];then + if grep -q ^$2= $1 ;then + sed -i s%"^$2=.*"%"$2=$3"% $1 + else + echo "$2=$3" >> $1 + fi + fi +} + +if [ "$EXCLUSIVEAPP" ] ;then + if [ ! -z "$TERMMODSCRIPTPRE" ] ;then + zenity --info --text="Запуск скрипта установки соединения с сервером. Пожалуйста, ожидайте" & + pid=$! + $TERMMODSCRIPTPRE + kill $pid + fi + if echo "$EXCLUSIVEAPP" | grep -q "remmina" ;then + FILEPREF=$HOME/.remmina/remmina.pref + setsetting "$FILEPREF" disable_tray_icon true + setsetting "$FILEPREF" save_view_mode false + FILEPREF=$HOME/.config/remmina/remmina.pref + setsetting "$FILEPREF" disable_tray_icon true + setsetting "$FILEPREF" save_view_mode false + FILEPREF=$(ls $HOME/.remmina/*.remmina | head -1) + if [ ! -z "$FILEPREF" ] ;then + setsetting "$FILEPREF" viewmode 4 + TMSERVER=$(grep ^server= "$FILEPREF" |awk -F= '{print $2}' | awk -F: '{print $1}') + TMPORT=$(grep ^server= "$FILEPREF" |awk -F= '{print $2}' | awk -F: '{print $2}') + [ -z "$TMPORT" ] && TMPORT=3389 + if [ "$TMSERVER" ] && [ "0$TERMMODETIMEOUT" -gt "0" ] ;then + STEP=$(( 100 * 100 / $TERMMODETIMEOUT )) + for a in $(seq 1 $TERMMODETIMEOUT) ;do + nmap --open -p$TMPORT $TMSERVER 2>/dev/null | grep -q "^$TMPORT/" && break + sleep 1 + echo "$(( $a * $STEP / 100 ))" + done | zenity --progress --percentage=0 --no-cancel --text "Ожидание подключения к удаленному серверу." --auto-close + fi + EXCLUSIVEAPP="$EXCLUSIVEAPP -c $FILEPREF" + fi + fi + $EXCLUSIVEAPP & + pid=$! + wait $pid + $TERMMODEEXIT +fi diff --git a/ublinux/rc.desktop/deonly/guake b/ublinux/rc.desktop/deonly/guake new file mode 100755 index 0000000..4a46385 --- /dev/null +++ b/ublinux/rc.desktop/deonly/guake @@ -0,0 +1,11 @@ +#!/bin/sh + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +which $(basename $0) >/dev/null 2>&1 || exit 0 +[ "$GUAKESTART" != "no" ] && $(basename $0) & diff --git a/ublinux/rc.desktop/deonly/hideloop4dolphin b/ublinux/rc.desktop/deonly/hideloop4dolphin new file mode 100755 index 0000000..848b60b --- /dev/null +++ b/ublinux/rc.desktop/deonly/hideloop4dolphin @@ -0,0 +1,86 @@ +#!/bin/sh + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +DOLPHINBOOKMARKS=.local/share/user-places.xbel +HIDELOOP=255 +HIDERAM=0 +HIDEZRAM=8 +. /usr/lib/ublinux/os-config + +[ "$HIDELOOP4DOLPHIN" = "no" ] && exit 0 +if [ "$1" != "fork" ] ;then + $0 fork & + exit 0 +fi + +sleep 3 + +FFP=$HOME/$DOLPHINBOOKMARKS + +if [ ! -f $FFP ] ;then + dolphin /home & + PIDDOL=$! + while [ ! -f $FFP ] ;do sleep 0.1 ;done + kill $PIDDOL +fi + +if ! grep -q "devices/loop$HIDELOOP" $FFP ;then + for a in $(seq 0 "$HIDELOOP") ;do + grep -q devices/loop$a $FFP && continue + cat >>$FFP < + + + /org/freedesktop/UDisks2/block_devices/loop$a + true + true + + + + + + Loop device + +EOF + done + for a in $(seq 0 "$HIDERAM") ;do + grep -q devices/ram$a $FFP && continue + cat >>$FFP < + + + /org/freedesktop/UDisks2/block_devices/ram$a + true + true + + + + + + Ram device + +EOF + done + for a in $(seq 0 "$HIDEZRAM") ;do + grep -q devices/ram$a $FFP && continue + cat >>$FFP < + + + /org/freedesktop/UDisks2/block_devices/zram$a + true + true + + + + + + ZRam device + +EOF + done + sed -i /'<\/xbel>'/d $FFP + echo '' >> $FFP +fi diff --git a/ublinux/rc.desktop/deonly/i3_notification-daemon b/ublinux/rc.desktop/deonly/i3_notification-daemon new file mode 100755 index 0000000..828fdb3 --- /dev/null +++ b/ublinux/rc.desktop/deonly/i3_notification-daemon @@ -0,0 +1,12 @@ +#!/bin/sh + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +I3_NOTIFYD=yes + +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +[ "$I3_NOTIFYD" != "no" ] && dex /usr/share/applications/notification-daemon.desktop & diff --git a/ublinux/rc.desktop/deonly/mate-authentication-agent b/ublinux/rc.desktop/deonly/mate-authentication-agent new file mode 100755 index 0000000..6f2c9ae --- /dev/null +++ b/ublinux/rc.desktop/deonly/mate-authentication-agent @@ -0,0 +1,7 @@ +#!/bin/sh + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 +. /usr/lib/ublinux/os-config + +[ "$MATEPAAGENTSTART" != "no" ] && /usr/lib64/polkit-mate-authentication-agent-1 & diff --git a/ublinux/rc.desktop/deonly/parcellite b/ublinux/rc.desktop/deonly/parcellite new file mode 100755 index 0000000..52b9873 --- /dev/null +++ b/ublinux/rc.desktop/deonly/parcellite @@ -0,0 +1,11 @@ +#!/bin/sh + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +which $(basename $0) >/dev/null 2>&1 || exit 0 +[ "$PARCELLITESTART" != "no" ] && $(basename $0) & diff --git a/ublinux/rc.desktop/deonly/qterminal b/ublinux/rc.desktop/deonly/qterminal new file mode 100755 index 0000000..cc6d280 --- /dev/null +++ b/ublinux/rc.desktop/deonly/qterminal @@ -0,0 +1,11 @@ +#!/bin/sh + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +which $(basename $0) >/dev/null 2>&1 || exit 0 +[ "$QTERMINALSTART" != "no" ] && $(basename $0) --drop & diff --git a/ublinux/rc.desktop/deonly/trolltech b/ublinux/rc.desktop/deonly/trolltech new file mode 100755 index 0000000..4c1bd5b --- /dev/null +++ b/ublinux/rc.desktop/deonly/trolltech @@ -0,0 +1,8 @@ +#!/bin/sh + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +if [ ! -f $HOME/.config/Trolltech.conf ] ;then + [ -f /usr/share/lxqt/themes/Default/Trolltech.conf ] && cp /usr/share/lxqt/themes/Default/Trolltech.conf $HOME/.config/Trolltech.conf +fi diff --git a/ublinux/rc.desktop/deonly/xfce4-screensaver-fix b/ublinux/rc.desktop/deonly/xfce4-screensaver-fix new file mode 100755 index 0000000..c621d82 --- /dev/null +++ b/ublinux/rc.desktop/deonly/xfce4-screensaver-fix @@ -0,0 +1,25 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +#. /etc/ublinux/config + +# Если не загружен ни один драйвер видео KMS, то xfce4-screensaver закрываем, т.к. не правильно отрабатывает блокировка + +sleep 5 +if pidof -qx xfce4-screensaver; then + if ! lspci -k | egrep -i -A 3 'VGA|3D' | grep -q 'Kernel driver in use:'; then + BLOBPS=$(ps -u $(id -u) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n') + DISPLAY=$(grep -m1 '^DISPLAY=' <<< "${BLOBPS}") +# XAUTHORITY=$(grep -m1 '^XAUTHORITY=' <<< "${BLOBPS}") + DBUS_SESSION_BUS_ADDRESS=$(grep -m1 '^DBUS_SESSION_BUS_ADDRESS=' <<< "${BLOBPS}") +# USER=$(cut -d/ -f3 <<< "${XAUTHORITY}") +# su -l ${USER} -c "${DISPLAY} ${XAUTHORITY} ${DBUS_SESSION_BUS_ADDRESS} xfce4-screensaver-command -i -r 'UBLinux fix: KMS video driver not loaded' &" + + export ${DISPLAY} + export ${DBUS_SESSION_BUS_ADDRESS} +# xfce4-screensaver-command -i -r 'UBLinux fix: KMS video driver not loaded' & + xfce4-screensaver-command --exit + fi +fi \ No newline at end of file diff --git a/ublinux/rc.desktop/deonly/yakuake b/ublinux/rc.desktop/deonly/yakuake new file mode 100755 index 0000000..d6bba11 --- /dev/null +++ b/ublinux/rc.desktop/deonly/yakuake @@ -0,0 +1,11 @@ +#!/bin/sh + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +which $(basename $0) >/dev/null 2>&1 || exit 0 +[ "$YAKUAKESTART" != "no" ] && $(basename $0) & diff --git a/ublinux/rc.desktop/gnome/cryptkeeper b/ublinux/rc.desktop/gnome/cryptkeeper new file mode 120000 index 0000000..02d8564 --- /dev/null +++ b/ublinux/rc.desktop/gnome/cryptkeeper @@ -0,0 +1 @@ +../deonly/cryptkeeper \ No newline at end of file diff --git a/ublinux/rc.desktop/gnome/guake b/ublinux/rc.desktop/gnome/guake new file mode 120000 index 0000000..77e96bb --- /dev/null +++ b/ublinux/rc.desktop/gnome/guake @@ -0,0 +1 @@ +../deonly/guake \ No newline at end of file diff --git a/ublinux/rc.desktop/i3/i3_notification-daemon b/ublinux/rc.desktop/i3/i3_notification-daemon new file mode 120000 index 0000000..719e5be --- /dev/null +++ b/ublinux/rc.desktop/i3/i3_notification-daemon @@ -0,0 +1 @@ +../deonly/i3_notification-daemon \ No newline at end of file diff --git a/ublinux/rc.desktop/i3term/exclusiveapp b/ublinux/rc.desktop/i3term/exclusiveapp new file mode 120000 index 0000000..5f2158e --- /dev/null +++ b/ublinux/rc.desktop/i3term/exclusiveapp @@ -0,0 +1 @@ +../deonly/exclusiveapp \ No newline at end of file diff --git a/ublinux/rc.desktop/i3term/i3_notification-daemon b/ublinux/rc.desktop/i3term/i3_notification-daemon new file mode 120000 index 0000000..719e5be --- /dev/null +++ b/ublinux/rc.desktop/i3term/i3_notification-daemon @@ -0,0 +1 @@ +../deonly/i3_notification-daemon \ No newline at end of file diff --git a/ublinux/rc.desktop/kde/cryptkeeper b/ublinux/rc.desktop/kde/cryptkeeper new file mode 120000 index 0000000..02d8564 --- /dev/null +++ b/ublinux/rc.desktop/kde/cryptkeeper @@ -0,0 +1 @@ +../deonly/cryptkeeper \ No newline at end of file diff --git a/ublinux/rc.desktop/kde/hideloop4dolphin b/ublinux/rc.desktop/kde/hideloop4dolphin new file mode 120000 index 0000000..ab01b1f --- /dev/null +++ b/ublinux/rc.desktop/kde/hideloop4dolphin @@ -0,0 +1 @@ +../deonly/hideloop4dolphin \ No newline at end of file diff --git a/ublinux/rc.desktop/kde/yakuake b/ublinux/rc.desktop/kde/yakuake new file mode 120000 index 0000000..8ea7e56 --- /dev/null +++ b/ublinux/rc.desktop/kde/yakuake @@ -0,0 +1 @@ +../deonly/yakuake \ No newline at end of file diff --git a/ublinux/rc.desktop/lxde/cryptkeeper b/ublinux/rc.desktop/lxde/cryptkeeper new file mode 120000 index 0000000..02d8564 --- /dev/null +++ b/ublinux/rc.desktop/lxde/cryptkeeper @@ -0,0 +1 @@ +../deonly/cryptkeeper \ No newline at end of file diff --git a/ublinux/rc.desktop/lxde/parcellite b/ublinux/rc.desktop/lxde/parcellite new file mode 120000 index 0000000..48e2584 --- /dev/null +++ b/ublinux/rc.desktop/lxde/parcellite @@ -0,0 +1 @@ +../deonly/parcellite \ No newline at end of file diff --git a/ublinux/rc.desktop/lxqt/cryptkeeper b/ublinux/rc.desktop/lxqt/cryptkeeper new file mode 120000 index 0000000..02d8564 --- /dev/null +++ b/ublinux/rc.desktop/lxqt/cryptkeeper @@ -0,0 +1 @@ +../deonly/cryptkeeper \ No newline at end of file diff --git a/ublinux/rc.desktop/lxqt/qterminal b/ublinux/rc.desktop/lxqt/qterminal new file mode 120000 index 0000000..6c367f9 --- /dev/null +++ b/ublinux/rc.desktop/lxqt/qterminal @@ -0,0 +1 @@ +../deonly/qterminal \ No newline at end of file diff --git a/ublinux/rc.desktop/lxqt/trolltech b/ublinux/rc.desktop/lxqt/trolltech new file mode 120000 index 0000000..224ac67 --- /dev/null +++ b/ublinux/rc.desktop/lxqt/trolltech @@ -0,0 +1 @@ +../deonly/trolltech \ No newline at end of file diff --git a/ublinux/rc.desktop/mate/cryptkeeper b/ublinux/rc.desktop/mate/cryptkeeper new file mode 120000 index 0000000..02d8564 --- /dev/null +++ b/ublinux/rc.desktop/mate/cryptkeeper @@ -0,0 +1 @@ +../deonly/cryptkeeper \ No newline at end of file diff --git a/ublinux/rc.desktop/mate/guake b/ublinux/rc.desktop/mate/guake new file mode 120000 index 0000000..77e96bb --- /dev/null +++ b/ublinux/rc.desktop/mate/guake @@ -0,0 +1 @@ +../deonly/guake \ No newline at end of file diff --git a/ublinux/rc.desktop/mate/mate-authentication-agent b/ublinux/rc.desktop/mate/mate-authentication-agent new file mode 120000 index 0000000..78e67e6 --- /dev/null +++ b/ublinux/rc.desktop/mate/mate-authentication-agent @@ -0,0 +1 @@ +../deonly/mate-authentication-agent \ No newline at end of file diff --git a/ublinux/rc.desktop/mate/parcellite b/ublinux/rc.desktop/mate/parcellite new file mode 120000 index 0000000..48e2584 --- /dev/null +++ b/ublinux/rc.desktop/mate/parcellite @@ -0,0 +1 @@ +../deonly/parcellite \ No newline at end of file diff --git a/ublinux/rc.desktop/plasma/cryptkeeper b/ublinux/rc.desktop/plasma/cryptkeeper new file mode 120000 index 0000000..02d8564 --- /dev/null +++ b/ublinux/rc.desktop/plasma/cryptkeeper @@ -0,0 +1 @@ +../deonly/cryptkeeper \ No newline at end of file diff --git a/ublinux/rc.desktop/plasma/hideloop4dolphin b/ublinux/rc.desktop/plasma/hideloop4dolphin new file mode 120000 index 0000000..ab01b1f --- /dev/null +++ b/ublinux/rc.desktop/plasma/hideloop4dolphin @@ -0,0 +1 @@ +../deonly/hideloop4dolphin \ No newline at end of file diff --git a/ublinux/rc.desktop/plasma/yakuake b/ublinux/rc.desktop/plasma/yakuake new file mode 120000 index 0000000..8ea7e56 --- /dev/null +++ b/ublinux/rc.desktop/plasma/yakuake @@ -0,0 +1 @@ +../deonly/yakuake \ No newline at end of file diff --git a/ublinux/rc.desktop/xfce/xfce4-screensaver-fix b/ublinux/rc.desktop/xfce/xfce4-screensaver-fix new file mode 120000 index 0000000..aa124cf --- /dev/null +++ b/ublinux/rc.desktop/xfce/xfce4-screensaver-fix @@ -0,0 +1 @@ +../deonly/xfce4-screensaver-fix \ No newline at end of file diff --git a/ublinux/rc.domain.d/30-usershwaccess b/ublinux/rc.domain.d/30-usershwaccess new file mode 100755 index 0000000..750ba40 --- /dev/null +++ b/ublinux/rc.domain.d/30-usershwaccess @@ -0,0 +1,17 @@ +#!/bin/bash + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +DOMUSGR=audio,video,usb,vboxusers,bumblebee,cdrom,cdwriter,lp,floppy +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +if [ "$DOMAINUSERSHWACCESS" ] ;then + for a in $(echo "$DOMAINUSERSHWACCESS" | tr ",;" " ") ;do + for b in $(echo "$DOMUSGR" | tr ",;" " ") ;do + usermod -a -G $b $a + done + done +fi diff --git a/ublinux/rc.halt.pre/01-sysrq-sleepshutdown b/ublinux/rc.halt.pre/01-sysrq-sleepshutdown new file mode 100755 index 0000000..dd8aecd --- /dev/null +++ b/ublinux/rc.halt.pre/01-sysrq-sleepshutdown @@ -0,0 +1,8 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +#echo "Sleep 60 sec to reboot /proc/sysrq-trigger" +#echo 1 > /proc/sys/kernel/sysrq +sleep 60 && echo b > /proc/sysrq-trigger & \ No newline at end of file diff --git a/ublinux/rc.halt.pre/10-shutdown b/ublinux/rc.halt.pre/10-shutdown new file mode 100755 index 0000000..430cf2c --- /dev/null +++ b/ublinux/rc.halt.pre/10-shutdown @@ -0,0 +1,36 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +#HALTPROCESSESKILL="slim kdm X lxdm xdm sddm cupsd pdnsd mc mandb" +HALTPROCESSESKILL="" +HALTSERVICESSTOP="" +HALTEXCLUDESTOP="" + +PATH=/usr/lib/ublinux/scripts:$PATH +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/desktop; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + + +# Stop DisplayManager +#HALTSERVICESSTOP="$HALTSERVICESSTOP $(echo $SERVICESSTART | tr "," " ") display-manager.service" +#HALTSERVICESSTOP="$HALTSERVICESSTOP $(systemctl list-units --type=service --state=running | egrep "$DISPLAYMANAGER.*running" | awk '{$1=$1;print}' | cut -d ' ' -f 1 | xargs)" +# Stop all running service +#HALTSERVICESSTOP="$HALTSERVICESSTOP $(systemctl list-units --type=service --state=running | egrep "running" | awk '{$1=$1;print}' | cut -d ' ' -f 1 | egrep -v " $HALTEXCLUDESTOP" | xargs)" +for i in ${HALTSERVICESSTOP}; do + [ -z "${i}" ] || systemctl stop ${i} 2>/dev/null +done + +# Kill all users apps +#GROUPFORLIST="users" +#LISTUSERS=$(cut -d: -f1,4 /etc/passwd | grep $(getent group $GROUPFORLIST | cut -d: -f3) | cut -d: -f1 | xargs |tr " " ",") +#LISTUSERSOTHER=$(getent group $GROUPFORLIST | cut -d: -f4) +#[ -z $LISTUSERSOTHER ] || LISTUSERS="$LISTUSERS,$LISTUSERSOTHER" +#pkill -U $LISTUSERS + + +[ -z "$HALTPROCESSESKILL" ] || killall -9 $HALTPROCESSESKILL + diff --git a/ublinux/rc.halt.pre/15-cleanup b/ublinux/rc.halt.pre/15-cleanup new file mode 100755 index 0000000..da58dc5 --- /dev/null +++ b/ublinux/rc.halt.pre/15-cleanup @@ -0,0 +1,11 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +# some cleanups +rm -fr /tmp/* /mnt/live/memory/changes/usr/share/apps/ksplash/Themes/Default 2>/dev/null +#rm -f /usr/share/ublinux/wallpapers/default*.jpg 2>/dev/null + +# cleanup empty dirs +for a in /media/* /mnt/* ;do rmdir $a >/dev/null 2>&1 ;done diff --git a/ublinux/rc.halt.pre/70-savetomodule b/ublinux/rc.halt.pre/70-savetomodule new file mode 100755 index 0000000..f95896c --- /dev/null +++ b/ublinux/rc.halt.pre/70-savetomodule @@ -0,0 +1,70 @@ +#!/bin/bash + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 +#grep -q 1 /run/ublinux_started || exit 0 + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +SAVETOMODULEOPTIONS="$MKSQFS_FASTALG" + +PATH=/usr/lib/ublinux/scripts:$PATH + +# save2module mode parser +MODULEFORMAT="ubm" +CHSRC=$(readlink -f /mnt/live/memory/changes) +IMSRC=$(readlink -f /mnt/live/memory/images) +[ -z "$SAVETOMODULENAME" -a -w /mnt/livedata/$LIVECDNAME-data/modules ] && SAVETOMODULENAME=/mnt/livedata/$LIVECDNAME-data/modules/zz-save.$MODULEFORMAT +[ -z "$SAVETOMODULENAME" -a -w /mnt/livemedia/$LIVECDNAME/modules ] && SAVETOMODULENAME=/mnt/livemedia/$LIVECDNAME/modules/zz-save.$MODULEFORMAT +[ -f /.savetomodule ] && grep -q . /.savetomodule && SAVETOMODULENAME="$(cat /.savetomodule)" +[ -f /.savetomodule ] && SAVETOMODULE=${SAVETOMODULE-yes} +grep -q save2module /proc/cmdline && SAVETOMODULE=${SAVETOMODULE-yes} +# if machine was freezed +egrep -q '/dynamic/|/static/' /.savetomodule 2>/dev/null && [ -f "$(sed s=dynamic=static= /.savetomodule)" ] && SAVETOMODULE=no +# if machine was unfreezed +grep -q /static/ /.savetomodule 2>/dev/null && [ ! -f "$(cat /.savetomodule)" ] && SAVETOMODULENAME=$(sed s=static=dynamic= /.savetomodule) +SAVETOMODULEDIR="$(dirname $SAVETOMODULENAME)" +FILELIST=/.savelist +if [ -w $SAVETOMODULEDIR -a "$SAVETOMODULE" = "yes" ] ;then + echo "Please wait. Saving changes to module $SAVETOMODULENAME" + # if old module exists we have to concatenate it + if [ -d $IMSRC/${SAVETOMODULENAME##*/} ]; then + echo "Old module exists, we have to concatenate it" + SRC=/mnt/live/tmp/save2module + mkdir -p $SRC $SRC-rw + mount -t aufs -o shwh,br:$SRC-rw=rw:$CHSRC=rr:$IMSRC/${SAVETOMODULENAME##*/}=rr aufs $SRC + else + SRC=$CHSRC + fi + [ -d /memory/ovl/changes ] && SRC=/memory/ovl/changes + # preparing excluded files list + echo -e "/tmp/includedfiles\n/tmp/excludedfiles" > /tmp/excludedfiles + if [ -f "$FILELIST" ] ;then + grep ^! "$FILELIST" | cut -c 2- >/tmp/savelist.black + grep -v '^[!#]' "$FILELIST" | grep . >/tmp/savelist.white + grep -q . /tmp/savelist.white || echo '.' > /tmp/savelist.white + find $SRC/ -type l >/tmp/allfiles + find $SRC/ -type f >>/tmp/allfiles + sed -i 's|'$SRC'||' /tmp/allfiles + grep -f /tmp/savelist.white /tmp/allfiles | grep -vf /tmp/savelist.black > /tmp/includedfiles + grep -q . /tmp/savelist.black && grep -f /tmp/savelist.black /tmp/allfiles >> /tmp/excludedfiles + grep -vf /tmp/savelist.white /tmp/allfiles >> /tmp/excludedfiles + find $SRC/ -type d | sed 's|'$SRC'||' | while read a ;do + grep -q "^$a" /tmp/includedfiles && continue + echo "$a" | grep -vf /tmp/savelist.black | grep -qf /tmp/savelist.white && continue + echo "$a" >> /tmp/excludedfiles + done + rm -f /tmp/savelist* /tmp/allfiles /tmp/includedfiles + fi + sed -i 's|^/||' /tmp/excludedfiles + # backuping old module + [ -f "$SAVETOMODULENAME" ] && mv -f "$SAVETOMODULENAME" "${SAVETOMODULENAME}.bak" + # making module + [ "$SAVETONOXZM" = "yes" ] && SAVETOMODULEOPTIONS="-noI -noD -noF" + create_module $SRC "$SAVETOMODULENAME" -ef /tmp/excludedfiles $SAVETOMODULEOPTIONS + echo + [ "$SRC" = "$CHSRC" ] || umount "$SRC" +fi diff --git a/ublinux/rc.halt.pre/75-save-cache b/ublinux/rc.halt.pre/75-save-cache new file mode 100755 index 0000000..7b36c22 --- /dev/null +++ b/ublinux/rc.halt.pre/75-save-cache @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/network; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +PATH_ROOT="" +PATH_CHANGES="/memory/changes" + +NAME_ROOTCOPY="rootcopy" +PATH_ROOTCOPY=$(find ${PATH_ROOT}/memory/layer-base/*/ -maxdepth 1 -type d -name "${NAME_ROOTCOPY}" | head -1) +[[ -n ${PATH_ROOTCOPY} ]] || PATH_ROOTCOPY="$(find ${PATH_ROOT}/memory/layer-base/*/ -maxdepth 1 -type f -name "ublinux-data*.sgn" | head -1)" +[[ -n ${PATH_ROOTCOPY} ]] && PATH_ROOTCOPY="${PATH_ROOTCOPY%/*}/${NAME_ROOTCOPY}" || exit 0 + +NAME_MODULES="modules" +PATH_MODULES=$(find ${PATH_ROOT}/memory/layer-base/*/ -maxdepth 1 -type d -name "${NAME_MODULES}" | head -1) +[[ -n ${PATH_MODULES} ]] || PATH_MODULES="$(find ${PATH_ROOT}/memory/layer-base/*/ -maxdepth 1 -type f -name "ublinux-data*.sgn" | head -1)" +[[ -n ${PATH_MODULES} ]] && PATH_MODULES="${PATH_MODULES%/*}/${NAME_MODULES}" || exit 0 + + [[ -n ${PATH_ROOTCOPY} ]] || install -dm0750 -o root -g root "${PATH_ROOTCOPY}" + if [[ ${SAVE_ALL_CACHE} == "rootcopy" && -w ${PATH_ROOTCOPY} ]]; then + cd ${PATH_CHANGES} +# find etc/ -type f -name ld.so.cache -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find etc/udev/ -type f -name hwdb.bin -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find usr/lib/gdk-pixbuf-*/*/ -type f -name loaders.cache -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find usr/lib/locale/ -type f -name locale-archive -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find usr/lib/modules/*/ -type f -name modules. -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find usr/share/applications/ -type f -name mimeinfo.cache -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find usr/share/fonts/ -type f \( -name "fonts.dir" -o -name "fonts.scale" \) -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find usr/share/glib-*/schemas/ -type f -name gschemas.compiled -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find usr/share/icons/ -type f -name icon-theme.cache -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find usr/share/mime/ -maxdepth 1 -type f -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find usr/share/mime/ -type f -name *.xml -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find var/cache/fontconfig/ -type f -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; +# find var/cache/ldconfig/ -type f -name aux-cache -exec install -CDm600 {} ${PATH_ROOTCOPY}/{} \; +# install -dm700 ${PATH_ROOTCOPY}/var/cache/ldconfig + cp -af etc/pacman.d ${PATH_ROOTCOPY}/etc/ + cp -af etc/ssh ${PATH_ROOTCOPY}/etc/ + fi + + # Save DOMAIN settings + if [[ -n ${DOMAIN} && -w ${PATH_ROOTCOPY} ]]; then + cd ${PATH_CHANGES} + find etc/ -type f -name krb5.conf -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; + find etc/ -type f -name krb5.keytab -exec install -CDm600 {} ${PATH_ROOTCOPY}/{} \; + find etc/ -type f -name realmd.conf -exec install -CDm600 {} ${PATH_ROOTCOPY}/{} \; + find etc/sssd/ -type f -name "*.conf" -exec install -CDm600 {} ${PATH_ROOTCOPY}/{} \; + fi + \ No newline at end of file diff --git a/ublinux/rc.halt.pre/80-upgrade b/ublinux/rc.halt.pre/80-upgrade new file mode 100755 index 0000000..5433314 --- /dev/null +++ b/ublinux/rc.halt.pre/80-upgrade @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +#grep -q 1 /run/ublinux_started || exit 0 + +#. /usr/lib/ublinux/functions +#. /usr/lib/ublinux/os-config + +#SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + + EXT="ubm" + PATH_BASE=$(find /memory/layer-base/*/ -maxdepth 1 -type d -name "base") + PATH_MODULES=$(find /memory/layer-base/*/ -maxdepth 1 -type d -name "modules") + PATH_UPGRADE=$(find /memory/layer-base/*/ -maxdepth 1 -type d -name "upgrade") + F_UPGRADE_CONF=$(find ${PATH_UPGRADE} -maxdepth 1 -type f -name "upgrade.conf") + PATH_KERNEL=$(find /memory/layer-base/*/ -maxdepth 1 -type f -name "vmlinuz*" | head -1 | xargs dirname) + + # Удаляем модули, отмеченные на устаревшие + for F_REMOVE in $(cat ${F_UPGRADE_CONF} | uniq | grep "remove=" | sed "s/remove=//"); do + [[ -f ${F_REMOVE} ]] && rm -f ${F_REMOVE} 2>/dev/null + done + + # Переименовываем модули, отмеченные на обновляемые + for F_RENAME_UPGRADE in $(find ${PATH_BASE} ${PATH_MODULES} -type f -name "*.upgrade"); do + [[ -f ${F_RENAME_UPGRADE} ]] && mv -f ${F_RENAME_UPGRADE} ${F_RENAME_UPGRADE/.${EXT}.upgrade/.${EXT}} 2>/dev/null + done + + # Перемещаем модули, отмеченные на обновляемые + for F_UPGRADE in $(cat ${F_UPGRADE_CONF} | uniq | grep "upgrade=" | sed "s/install=//"); do + for PATH_UPGRADE_ITEM in ${PATH_UPGRADE}; do + [[ -f ${PATH_UPGRADE_ITEM}/${F_UPGRADE##*/} ]] && mv -f ${PATH_UPGRADE_ITEM}/${F_UPGRADE##*/} ${F_UPGRADE%/*} 2>/dev/null + done + done + + # Перемещаем модули, отмеченные на новые на установку + for F_INSTALL in $(cat ${F_UPGRADE_CONF} | uniq | grep "install=" | sed "s/install=//"); do + for PATH_UPGRADE_ITEM in ${PATH_UPGRADE}; do + [[ -f ${PATH_UPGRADE_ITEM}/${F_INSTALL##*/} ]] && mv -f ${PATH_UPGRADE_ITEM}/${F_INSTALL##*/} ${F_INSTALL%/*} 2>/dev/null + done + done + + # Переименовываем модули, отмеченные на обновление, но отсутствующие в upgrade.conf + for F_NOMARK_UPGRADE in $(find ${PATH_UPGRADE} -type f -name "*.${EXT}*"); do + NAME_NOMARK_UPGRADE=${F_NOMARK_UPGRADE##*/} + if [[ ${NAME_NOMARK_UPGRADE} =~ ^[0-9]{3}-.* ]]; then + [[ -f ${F_NOMARK_UPGRADE} ]] && mv -f ${F_NOMARK_UPGRADE} $(tail -1 <<< ${PATH_BASE})/${NAME_NOMARK_UPGRADE/.upgrade/} + else + [[ -f ${F_NOMARK_UPGRADE} ]] && mv -f ${F_NOMARK_UPGRADE} $(tail -1 <<< ${PATH_MODULES})/${NAME_NOMARK_UPGRADE/.upgrade/} + fi + done + + # Обновление найденных модулей ядра + find ${PATH_UPGRADE} -type f -regextype sed -regex ".*/vmlinuz-[0-9.]\{5,8\}-[0-9]\{1,4\}" -exec mv -ft ${PATH_KERNEL} {} + + find ${PATH_UPGRADE} -type f -regextype sed -regex ".*/ublinux-[0-9.]\{5,8\}-[0-9]\{1,4\}" -exec mv -ft ${PATH_KERNEL} {} + + + rm -f ${F_UPGRADE_CONF} + + diff --git a/ublinux/rc.halt.pre/85-chmod b/ublinux/rc.halt.pre/85-chmod new file mode 100755 index 0000000..bf6c997 --- /dev/null +++ b/ublinux/rc.halt.pre/85-chmod @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +chmod_ublinux() { + local PATH_UBLINUX=$1 + if [[ -w ${PATH_UBLINUX} ]]; then + chown -fR root:root "${PATH_UBLINUX}"/{base,machines,modules,optional,upgrade} 2>/dev/null + chown -f root:root "${PATH_UBLINUX}"/{cache,changes,rootcopy,homes} 2>/dev/null + chmod -f 0750 "${PATH_UBLINUX}"/{base,machines,modules,machines/dynamic,machines/static,optional,upgrade} 2>/dev/null + chmod -f 0755 "${PATH_UBLINUX}"/{cache,changes,rootcopy,homes} 2>/dev/null + + find "${PATH_UBLINUX}"/{base,machines,modules,optional,upgrade}/ -type f -exec chmod -f 0640 {} + 2>/dev/null + chmod -f 0644 "${PATH_UBLINUX}"/LICENSE*; chown -f root:root "${PATH_UBLINUX}"/LICENSE* + chmod -f 0640 "${PATH_UBLINUX}"/VERSION*; chown -f root:root "${PATH_UBLINUX}"/VERSION* + chmod -f 0640 "${PATH_UBLINUX}"/boot*; chown -f root:root "${PATH_UBLINUX}"/boot* + chmod -f 0640 "${PATH_UBLINUX}"/ublinux*; chown -f root:root "${PATH_UBLINUX}"/ublinux* + chmod -f 0640 "${PATH_UBLINUX}"/vmlinuz*; chown -f root:root "${PATH_UBLINUX}"/vmlinuz* + fi +} + + for ITEM_LAYER in $(find /memory/layer-base/* -maxdepth 0); do + chmod_ublinux ${ITEM_LAYER} 2>/dev/null + done diff --git a/ublinux/rc.halt.pre/90-deactivate b/ublinux/rc.halt.pre/90-deactivate new file mode 100755 index 0000000..9d50555 --- /dev/null +++ b/ublinux/rc.halt.pre/90-deactivate @@ -0,0 +1,26 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=/usr/lib/ublinux/scripts:${PATH} +EXT="ubm" + +COREMODS=".*/[0-9]{3}-core-[0-9]{4}-.*\.${EXT}|.*/[0-9]{3}-ublinux-[0-9]{4}-.*\.${EXT}" +#IMAGES=/mnt/live/memory/images +IMAGES=/memory/bundles +[ -f /etc/initvars ] && . /etc/initvars && IMAGES=${SYSMNT}/bundles + +sync; sync; sync; echo 3 > /proc/sys/vm/drop_caches +# umount any modules squashfs +#egrep " squashfs" /proc/mounts | cut -d " " -f2 | while read i ; do +egrep " squashfs" /proc/mounts | cut -d " " -f2 | sed '1!G;h;$!d' | egrep -v " ${COREMODS}" | while read ITEM ; do + mount -t aufs -o remount,del:"${ITEM}" aufs / 2>/dev/null +# umount ${ITEM} 2>/dev/null || umount -l ${ITEM} 2>/dev/null + umount -l ${ITEM} >/dev/null 2>&1 +done + +# umount any modules from /memory/bundles +#egrep "${IMAGES}" /proc/mounts | cut -d " " -f2 | egrep -v " ${COREMODS}" | while read ITEM ; do +# mount -t aufs -o remount,del:"${ITEM}" aufs / 2>/dev/null +#done diff --git a/ublinux/rc.halt.pre/95-umount b/ublinux/rc.halt.pre/95-umount new file mode 100755 index 0000000..7e63eb4 --- /dev/null +++ b/ublinux/rc.halt.pre/95-umount @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=/usr/lib/ublinux/scripts:$PATH + +# swapoff -a >/dev/null 2>&1 + +# umount network fs +egrep "[ ]nfs[ ]|[ ]cifs[ ]" /proc/mounts | awk '{print $2}' | egrep -v '^/mnt/live|^/memory/' | xargs umount -lf + +# umount any enc files from /media /mnt +find /dev/mapper/* | sed s=.*/== | grep -v ^control$ | while read i ;do + cryptsetup status ${i} 2>/dev/null | grep "[[:space:]]loop:[[:space:]]" | grep -v /mnt/live/ | egrep -q "[[:space:]]/media/|[[:space:]]/mnt/" && umount /dev/mapper/${i} && cryptsetup close ${i} +done + +# umount any loops from /media /mnt +losetup -a | tr -d :\)\( | egrep " /media/| /mnt/" | grep -v " /mnt/live" | awk '{print $1}' | xargs umount -d >/dev/null 2>&1 + +# then free any /media +egrep " /media/| /mnt/" /proc/mounts | awk '{print $2}' | grep -v ^/mnt/live | sort -r | xargs umount >/dev/null 2>&1 + +# umount any fs from /memory +egrep " /memory.*" /proc/mounts | awk '{print $2}' | sed '1!G;h;$!d' | xargs umount -l >/dev/null 2>&1 + +# umount any aufs from /media /mnt +egrep " /mnt/.* aufs | /media/.* aufs " /proc/mounts | awk '{print $2}' | xargs umount -l >/dev/null 2>&1 diff --git a/ublinux/rc.halt/20-timesave b/ublinux/rc.halt/20-timesave new file mode 100755 index 0000000..2e5cfd3 --- /dev/null +++ b/ublinux/rc.halt/20-timesave @@ -0,0 +1,14 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config +[ "$HALTSAVETIME" = "no" ] && exit 0 + +#Setting clock +SOURCE=${SYSCONF}/clock; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +HWCLOCKOPIONS="--utc" +[ "$UTC" = "false" ] && HWCLOCKOPIONS="--localtime" +hwclock -w $HWCLOCKOPIONS diff --git a/ublinux/rc.halt/99-sync b/ublinux/rc.halt/99-sync new file mode 100755 index 0000000..253259b --- /dev/null +++ b/ublinux/rc.halt/99-sync @@ -0,0 +1,5 @@ +#!/bin/bash +echo -n "Syncing block devices..." +sync +sync +sync && echo " done." diff --git a/ublinux/rc.local.d/01-background b/ublinux/rc.local.d/01-background new file mode 100755 index 0000000..6b67e7a --- /dev/null +++ b/ublinux/rc.local.d/01-background @@ -0,0 +1,12 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/theme; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null diff --git a/ublinux/rc.local.d/10-sudoers b/ublinux/rc.local.d/10-sudoers new file mode 100755 index 0000000..12f2c03 --- /dev/null +++ b/ublinux/rc.local.d/10-sudoers @@ -0,0 +1,21 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +ALLOWEDSUDO=ldconfig,ubupdate,ntpdate +PATH=/usr/lib/ublinux/scripts:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin: + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +debug_mode "$0" "$@" + +echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers.d/ubwheel +for a in $(echo $ALLOWEDSUDO | tr ',;' ' ') ;do + b=$(which $a 2>/dev/null) + grep -sq "NOPASSWD: $b" /etc/sudoers.d/ubnopasswd || echo "%users ALL=NOPASSWD: $b" >> /etc/sudoers.d/ubnopasswd +done diff --git a/ublinux/rc.local.d/31-sound b/ublinux/rc.local.d/31-sound new file mode 100755 index 0000000..2c039bd --- /dev/null +++ b/ublinux/rc.local.d/31-sound @@ -0,0 +1,62 @@ +#!/bin/bash + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +SNDMIX_MASTER_N=Master +SNDMIX_MASTER_VOL=35% +SNDMIX_DEFAULT_VOL=90% +SNDMIX_SWITCH_ON="IEC958 Playback Default,IEC958 Playback Switch" +SNDMIX_SWITCH_OFF="Beep Playback Switch,Mic Playback Switch" + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +# in case of card 0 is HDMI, card 1 is audiocard +if [ "$SNDFINCARD" != "no" ] ;then + if [ -z "$ALSACARD" -o -z "$ALSADEVICE" ] && LC_ALL=C aplay -l | grep -qi "card 0.*HDMI" ;then + ALSACARD=$(aplay -l | grep -v "card 0:" | grep -m1 "card .:.*device " | sed s/"card "// | sed s/":.*"//) + ALSADEVICE=$(LC_ALL=C aplay -l | grep -m1 "card $ALSACARD:.*device " | sed s/".* device "// | sed s/:.*//) + fi +fi + +# setting default alsa card if its specified +if [ "$ALSACARD" -a "$ALSADEVICE" ] ;then + echo -e "#you can specify default alsa device, check output of aplay -l\\ndefaults.pcm.card $ALSACARD\\ndefaults.pcm.device $ALSADEVICE" >/etc/skel/.asoundrc + for a in /home/* ;do + if [ ! -f $a/.asoundrc ] ;then + cp /etc/skel/.asoundrc $a + chmod 666 $a/.asoundrc + fi + done +fi + +# default settings for mixer +if [ "$SNDMIXSET" != "no" ] ;then + amixer controls | awk -F, '{print $1}' | while read a ;do + SNDNAME=$(LC_ALL=C amixer cget "$a" | grep -m1 name= | awk -F'name='\' '{print $2}' | awk -F\' '{print $1}') + SNDTYPE=$(LC_ALL=C amixer cget "$a" | grep -m1 type= | awk -F'type=' '{print $2}' | awk -F, '{ print $1}') + if [ "$SNDTYPE" = "INTEGER" ] ;then + if echo $SNDNAME | grep -qi "$SNDMIX_MASTER_N" ;then + [ "$DEBUG" = "on" ] && echo setting $SNDNAME to $SNDMIX_MASTER_VOL + amixer cset "$a" "$SNDMIX_MASTER_VOL" >/dev/null 2>&1 + else + [ "$DEBUG" = "on" ] && echo setting $SNDNAME to $SNDMIX_DEFAULT_VOL + amixer cset "$a" "$SNDMIX_DEFAULT_VOL" >/dev/null 2>&1 + fi + elif [ "$SNDTYPE" = "BOOLEAN" ] ;then + if echo $SNDMIX_SWITCH_ON | grep -q "$SNDNAME" ;then + [ "$DEBUG" = "on" ] && echo setting $SNDNAME to ON + amixer cset "$a" on >/dev/null 2>&1 + fi + if echo $SNDMIX_SWITCH_OFF | grep -q "$SNDNAME" ;then + [ "$DEBUG" = "on" ] && echo setting $SNDNAME to OFF + amixer cset "$a" off >/dev/null 2>&1 + fi + fi + done +fi diff --git a/ublinux/rc.local.d/40-pacman-keyring b/ublinux/rc.local.d/40-pacman-keyring new file mode 100755 index 0000000..647c874 --- /dev/null +++ b/ublinux/rc.local.d/40-pacman-keyring @@ -0,0 +1,21 @@ +#!/usr/bin/bash + +ENABLED=yes +[[ ${ENABLED} == yes ]] || exit 0 + +DEBUGMODE=no +. /usr/lib/ublinux/functions +debug_mode "$0" "$@" + +init_pacman_gpg() { + pacman-key --init &>/dev/null + pacman-key --populate $(ls /usr/share/pacman/keyrings/*.gpg | sed 's%.*/%%;s%\.[^.]*$%%') &>/dev/null + #usr/bin/pacman-key --updatedb +} + + [[ -d /etc/pacman.d/gnupg ]] || init_pacman_gpg + if ! /usr/bin/pacman-key -l &>/dev/null 2>&1; then + rm -rdf /etc/pacman.d/gnupg + init_pacman_gpg + fi + diff --git a/ublinux/rc.local.d/41-x11vnc b/ublinux/rc.local.d/41-x11vnc new file mode 100755 index 0000000..9aa5b42 --- /dev/null +++ b/ublinux/rc.local.d/41-x11vnc @@ -0,0 +1,116 @@ +#!/bin/bash + +ENABLED=yes +[[ ${ENABLED} == yes ]] || exit 0 +DEBUGMODE=no + +SOURCE=/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/desktop; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + +debug_mode "$0" "$@" + + systemctl --quiet --wait is-system-running + if [[ -n ${X11VNC[@]} ]]; then + OPTION_GLOBAL="-many -shared -no6" +# OPTION_GLOBAL="-many -shared -no6 -forever -dontdisconnect -noxdamage -xkb -rfbport 590%i " + if [[ -n ${X11VNC[password]} ]]; then + [[ -d /root/.vnc ]] || mkdir -p /root/.vnc + /usr/bin/x11vnc -quiet -storepasswd "$(base64 -d <<< "${X11VNC[password]}")" /root/.vnc/.passwd &>/dev/null + chmod 600 /root/.vnc/.passwd + ## Show obscured password + #/usr/bin/x11vnc -showrfbauth /root/.vnc/passwd + OPTION_PASSWD="-rfbauth /root/.vnc/.passwd" + fi + if [[ -z ${X11VNC[disable]} && -z ${X11VNC[nodisplay]} && ${X11VNC[display]} != "disable" && ${X11VNC[display]} != "no" ]]; then + if systemctl --quiet is-enabled lightdm.service &>/dev/null || systemctl --quiet is-enabled lightdm-plymouth.service &>/dev/null; then + for ID_DISPLAY in /var/run/lightdm/root/:*; do + FILE_X11VNC_SERVICE="/usr/lib/systemd/system/x11vnc-ublinux:${ID_DISPLAY##*:}.service" + OPTION_DISPLAY="-display :${ID_DISPLAY##*:} -auth /var/run/lightdm/root/:${ID_DISPLAY##*:}" + OPTION_LOG="-o /var/log/x11vnc-ublinux:${ID_DISPLAY##*:}.log" + OPTION_PORT="-autoport 590${ID_DISPLAY##*:}" + mkdir -p "${FILE_X11VNC_SERVICE%/*}" + cat << EOF > "${FILE_X11VNC_SERVICE}" +[Unit] +Description=VNC Server for X11:${ID_DISPLAY##*:} +Requires=graphical.target +After=graphical.target + +[Service] +#ExecStartPre=/bin/sh -c 'while ! pgrep -U "root" Xorg; do sleep 2; done' +ExecStart= +ExecStart=/usr/bin/x11vnc ${OPTION_GLOBAL} ${OPTION_PORT} ${OPTION_DISPLAY} ${OPTION_PASSWD} ${OPTION_LOG} ${X11VNC[options]} +Restart=always +RestartSec=5 +SuccessExitStatus=2 + +[Install] +WantedBy=graphical.target +EOF + systemctl --quiet is-enabled ${FILE_X11VNC_SERVICE##*/} &>/dev/null && systemctl daemon-reload &>/dev/null + [[ -f ${FILE_X11VNC_SERVICE} ]] && systemctl --quiet enable ${FILE_X11VNC_SERVICE##*/} &>/dev/null && systemctl --quiet restart ${FILE_X11VNC_SERVICE##*/} &>/dev/null + done + elif systemctl --quiet is-enabled gdm.service &>/dev/null || systemctl --quiet is-enabled gdm-plymouth.service &>/dev/null; then + true + elif systemctl --quiet is-enabled lxdm.service &>/dev/null || systemctl --quiet is-enabled lxdm-plymouth.service &>/dev/null; then + true + elif systemctl --quiet is-enabled sddm.service &>/dev/null || systemctl --quiet is-enabled sddm-plymouth.service &>/dev/null; then + true + elif systemctl --quiet is-enabled slim.service &>/dev/null || systemctl --quiet is-enabled slim-plymouth.service &>/dev/null; then + true + fi + fi + ## Создаём сервисы пользовательские + for X11VNC_NEW in "${!X11VNC[@]}"; do + if [[ ${X11VNC_NEW} =~ ^new[0-9]{1,2}$ || ${X11VNC_NEW} =~ ^tty[0-9]{1,2}$ ]]; then + ## Настройка VNC для TTY + if [[ ${X11VNC_NEW} =~ ^tty[0-9]{1,2}$ ]]; then + NUM_TTY=$(sed "s/tty//" <<< ${X11VNC_NEW}) + X11VNC[${X11VNC_NEW}]="${OPTION_GLOBAL} -rfbauth /root/.vnc/.passwd -rawfb vt${NUM_TTY} ${X11VNC[${X11VNC_NEW}]}" + fi + FILE_X11VNC_SERVICE="/usr/lib/systemd/system/x11vnc-ublinux-${X11VNC_NEW}.service" + OPTION_LOG="-o /var/log/x11vnc-ublinux-${X11VNC_NEW}.log" + OPTION_PORT="-autoport 5900" + if NUM_TTY=$(egrep --only-matching -- "-rawfb vt[0-9]{1,2}" <<< ${X11VNC[${X11VNC_NEW}]} | head -1 | sed "s/-rawfb vt//") && [[ -n ${NUM_TTY} ]]; then + systemctl start getty@tty${NUM_TTY}.service + fi + if grep --quiet -- "-display" <<< ${X11VNC[${X11VNC_NEW}]}; then + SERVICE_UNIT="[Unit] +Description=VNC Server ${X11VNC_NEW} +Requires=graphical.target +After=graphical.target" + SERVICE_INSTALL="[Install] +WantedBy=graphical.target" + else + SERVICE_UNIT="[Unit] +Description=VNC Server - ${X11VNC_NEW}" + SERVICE_INSTALL="[Install] +WantedBy=multi-user.target" + fi + mkdir -p "${FILE_X11VNC_SERVICE%/*}" + cat << EOF > "${FILE_X11VNC_SERVICE}" +${SERVICE_UNIT} + +[Service] +ExecStart= +ExecStart=/usr/bin/x11vnc ${OPTION_PORT} ${OPTION_LOG} ${X11VNC[${X11VNC_NEW}]} +Restart=always +RestartSec=5 +SuccessExitStatus=2 + +${SERVICE_INSTALL} +EOF + systemctl --quiet is-enabled ${FILE_X11VNC_SERVICE##*/} &>/dev/null && systemctl daemon-reload &>/dev/null + [[ -f ${FILE_X11VNC_SERVICE} ]] && systemctl --quiet enable ${FILE_X11VNC_SERVICE##*/} &>/dev/null && systemctl --quiet restart ${FILE_X11VNC_SERVICE##*/} &>/dev/null + fi + done + else + ## Если в режиме полного сохранения настройку убрали, то отключаем + for FILE_X11VNC_SERVICE in /usr/lib/systemd/system/x11vnc-ublinux*.service; do + if [[ -e ${FILE_X11VNC_SERVICE} ]]; then + systemctl --quiet disable --now ${FILE_X11VNC_SERVICE##*/} &>/dev/null + rm -f ${FILE_X11VNC_SERVICE} + fi + done + fi diff --git a/ublinux/rc.local.d/42-domain_join b/ublinux/rc.local.d/42-domain_join new file mode 100755 index 0000000..7321ef5 --- /dev/null +++ b/ublinux/rc.local.d/42-domain_join @@ -0,0 +1,29 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +SOURCE=/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/network; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + +debug_mode "$0" "$@" + + if [[ ${DOMAIN} != "" ]]; then + ## Указать доменных пользователей AccountsService, что-бы были видны для выбора логина в DM + systemctl --quiet --wait is-system-running + ls -d /home/*@*/ 2>/dev/null | xargs -ri basename {} | xargs -ri dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts.CacheUser string:{} + cp -af /mnt/livemedia/ublinux-data/rootcopy/etc/krb5.conf /etc/ +# ls -d /home/*@*/ 2>/dev/null | xargs -ri basename {} | xargs -ri touch /var/lib/AccountsService/users/{} + if /usr/bin/systemctl --wait is-active network-online.target; then + touch /var/log/ubdomain-client.log + date >> /var/log/ubdomain-client.log +# /usr/bin/ubdomain-client configure &>> /var/log/ubdomain-client.log +# /usr/bin/systemctl enable sssd.service +# /usr/bin/systemctl restart sssd.service +# /usr/bin/adcli update -v --domain=${DOMAIN} --show-details &>> /var/log/ubdomain-client.log + fi + + fi diff --git a/ublinux/rc.local.d/50-update-cache-gdk-pixbuf b/ublinux/rc.local.d/50-update-cache-gdk-pixbuf new file mode 100755 index 0000000..fd74d3c --- /dev/null +++ b/ublinux/rc.local.d/50-update-cache-gdk-pixbuf @@ -0,0 +1,10 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +debug_mode "$0" "$@" + + +[ -d "/usr/lib/gdk-pixbuf-2.0/" ] && gdk-pixbuf-query-loaders --update-cache diff --git a/ublinux/rc.local.d/50-update-cache-gtk-icon b/ublinux/rc.local.d/50-update-cache-gtk-icon new file mode 100755 index 0000000..b96fab6 --- /dev/null +++ b/ublinux/rc.local.d/50-update-cache-gtk-icon @@ -0,0 +1,17 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +UPDATEGTKICONOPTS="-fit /usr/share/icons/hicolor" + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +#[ "$UPDATEGTKICONCACHE" != "no" ] && [ -d "/usr/share/icons/hicolor/" ] && gtk-update-icon-cache $UPDATEGTKICONOPTS >/dev/null 2>&1 + +[ "$UPDATEGTKICONCACHE" != "no" ] && find /usr/share/icons -mindepth 1 -maxdepth 1 -type d | while read -r THEME; do + [ -f "$THEME/index.theme" ] && gtk-update-icon-cache -f -q "$THEME" 2>/dev/null +done \ No newline at end of file diff --git a/ublinux/rc.local.d/50-update-desktop-database b/ublinux/rc.local.d/50-update-desktop-database new file mode 100755 index 0000000..3ae641c --- /dev/null +++ b/ublinux/rc.local.d/50-update-desktop-database @@ -0,0 +1,13 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +#. /usr/lib/ublinux/functions +#. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +if [ -d "/usr/share/applications/" -o -d "/usr/local/share/applications/" ]; then + update-desktop-database -q 2>/dev/null + touch /usr/share/applications/screensavers +fi diff --git a/ublinux/rc.local.d/50-update-glib-compile-schemas b/ublinux/rc.local.d/50-update-glib-compile-schemas new file mode 100755 index 0000000..8b45cfc --- /dev/null +++ b/ublinux/rc.local.d/50-update-glib-compile-schemas @@ -0,0 +1,10 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +#. /usr/lib/ublinux/functions +#. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +[ -d "/usr/share/glib-2.0/schemas/" ] && glib-compile-schemas /usr/share/glib-2.0/schemas/ diff --git a/ublinux/rc.local.d/50-update-mime b/ublinux/rc.local.d/50-update-mime new file mode 100755 index 0000000..0488076 --- /dev/null +++ b/ublinux/rc.local.d/50-update-mime @@ -0,0 +1,10 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +#. /usr/lib/ublinux/functions +#. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +[ -d "/usr/share/mime/" ] && update-mime-database /usr/share/mime \ No newline at end of file diff --git a/ublinux/rc.local.d/51-mozilla_extensions b/ublinux/rc.local.d/51-mozilla_extensions new file mode 100755 index 0000000..ec5ea29 --- /dev/null +++ b/ublinux/rc.local.d/51-mozilla_extensions @@ -0,0 +1,25 @@ +#!/bin/bash + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +# Registering mozilla extentions (firefox and thunderbird) +if [ "$REGISTERMOZEXT" != "no" ] ;then + for i in firefox thunderbird ; do + if [ -d /usr/lib/mozilla/$i/extensions ] ;then + for a in $(ls -d /usr/lib/mozilla/$i/extensions/* ) ; do + for f in /usr/lib/$i* ;do + [ -d $f/extensions ] && ln -sf $a $f/extensions + [ -d $f/browser/extensions ] && ln -sf $a $f/browser/extensions + done + done + fi + done +fi diff --git a/ublinux/rc.local.d/52-consolesetup b/ublinux/rc.local.d/52-consolesetup new file mode 100755 index 0000000..722c34e --- /dev/null +++ b/ublinux/rc.local.d/52-consolesetup @@ -0,0 +1,20 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +SOURCE=/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + +debug_mode "$0" "$@" + + + [ "$NUMLOCK" = "yes" ] && for tty in /dev/tty[1-8]; do setleds -D +num < $tty ; done + [ "$NUMLOCK" = "no" ] && for tty in /dev/tty[1-8]; do setleds -D -num < $tty ; done + +# kill -RTMIN+21 1 || busybox kill -RTMIN+21 1 + [[ -x /usr/bin/plymouth ]] && /usr/bin/plymouth --wait quit + [[ -x /lib/systemd/systemd-vconsole-setup ]] && /lib/systemd/systemd-vconsole-setup + readlink -f /etc/systemd/system/default.target 2>/dev/null | grep -q multi-user.target && chvt 2 diff --git a/ublinux/rc.local.d/54-plymouth b/ublinux/rc.local.d/54-plymouth new file mode 100755 index 0000000..dc4fb13 --- /dev/null +++ b/ublinux/rc.local.d/54-plymouth @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +debug_mode "$0" "$@" + +PLYMOUTHTHEME=$(/usr/lib/ubboot/ubdistconv -p 2>/dev/null | tail -1) +[[ -n ${PLYMOUTHTHEME} ]] || PLYMOUTHTHEME="ublinux-logo-pulse" + +[[ -f /etc/plymouth/plymouthd.conf ]] && sed -i "s/\(Theme=\).*/\1${PLYMOUTHTHEME}/" /etc/plymouth/plymouthd.conf diff --git a/ublinux/rc.local.d/55-x2go b/ublinux/rc.local.d/55-x2go new file mode 100755 index 0000000..dcb179a --- /dev/null +++ b/ublinux/rc.local.d/55-x2go @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +#. /usr/lib/ublinux/functions +#. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + + + command -v x2godbadmin >/dev/null && x2godbadmin --updatedb diff --git a/ublinux/rc.local.d/91-cts b/ublinux/rc.local.d/91-cts new file mode 100755 index 0000000..cc051a6 --- /dev/null +++ b/ublinux/rc.local.d/91-cts @@ -0,0 +1,18 @@ +#!/bin/bash +# +# Software: Continent AP +# + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +#. /usr/lib/ublinux/functions +debug_mode "$0" "$@" + +if [ -d /etc/cts ] ;then + if ! systemctl is-active cts 2>/dev/null; then + ldconfig /usr/lib/cts && systemctl restart cts + fi +fi + +exit 0 diff --git a/ublinux/rc.local.d/91-eula b/ublinux/rc.local.d/91-eula new file mode 100755 index 0000000..2e351d2 --- /dev/null +++ b/ublinux/rc.local.d/91-eula @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +#PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +#. usr/lib/ublinux/functions +#. usr/lib/ublinux/os-config +EULA_DB="/usr/share/ublinux/agreement/EULA_DB.txt" +EULA="/usr/share/ublinux/agreement/EULA.txt" +debug_mode "$0" "$@" + +#. .$SYSCONF/config 2>/dev/null || . $SYSCONF/config 2>/dev/null + +[[ $(cat /etc/os-release | grep "VERSION_CODENAME" | cut -d= -f2) = "ublinux_db" ]] && mv ${EULA_DB} ${EULA} +rm -f ${EULA_DB} \ No newline at end of file diff --git a/ublinux/rc.local.d/99-1c-enterprise b/ublinux/rc.local.d/99-1c-enterprise new file mode 100755 index 0000000..36e46fc --- /dev/null +++ b/ublinux/rc.local.d/99-1c-enterprise @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Software: 1C:Enterprise +# + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +#. /usr/lib/ublinux/functions +#debug_mode "$0" "$@" + +#if pacman -Qqs xfce4- >/dev/null ; then echo ok; fi + +#if [ -d /etc/cts ] ;then +# if ! systemctl is-active cts 2>/dev/null; then +# ldconfig /usr/lib/cts && systemctl restart cts +# fi +#fi + +exit 0 diff --git a/ublinux/rc.network.d/10-network b/ublinux/rc.network.d/10-network new file mode 100755 index 0000000..5cbf4b3 --- /dev/null +++ b/ublinux/rc.network.d/10-network @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +SOURCE=/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/network; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + +debug_mode "$0" "$@" + + # mount ublinux-server + +## Переделать authselect и связать с опциями домена + # Name Service Switch Win Avahi nsswitch.conf +# if [[ ${NSSWITCHAVAHI,,} == "yes" ]]; then +# file_nss=$(grep hosts /etc/nsswitch.conf) +# grep -q "mdns4_minimal" <<< "${file_nss}" || sed "/^hosts: /s/ resolve/ mdns4_minimal [NOTFOUND=return] resolve/" -i /etc/nsswitch.conf +# grep -q "mdns4" <<< "${file_nss}" || sed "/^hosts: /s/ dns/ dns mdns4/" -i /etc/nsswitch.conf +# fi +# if [[ ${NSSWITCHWINS,,} == "yes" ]]; then +# [[ -z ${file_nss} ]] && file_nss=$(grep hosts /etc/nsswitch.conf) +# grep -q "wins" <<< "${file_nss}" || sed "/^hosts:/s/ dns/ dns wins/" -i /etc/nsswitch.conf +# fi + + # Network configuration + while read CONNECTION; do + CON_DEVICE=${CONNECTION%%:*}; CONNECTION=${CONNECTION#*:} + CON_UUID=${CONNECTION%%:*}; CONNECTION=${CONNECTION#*:} + CON_NAME=${CONNECTION%%:*} + CON_TYPE=${CONNECTION#*:} + for NETWORK_ITEM in "${!NETWORK[@]}"; do + unset NETWORK_DEVICE NETWORK_CONNECTION + NETWORK_NAME=${NETWORK_ITEM%%:*} + NETWORK_TYPE=${NETWORK_ITEM#*:} + if [[ ${NETWORK_TYPE,,} == "device" || ${NETWORK_TYPE,,} == "dev" ]]; then + [[ ${NETWORK_NAME,,} == ${CON_DEVICE,,} ]] && nmcli device modify "${CON_DEVICE}" ${NETWORK[${NETWORK_ITEM}]} + else + [[ ${NETWORK_NAME,,} == "all" || ${NETWORK_NAME,,} == "any" \ + || ${NETWORK_NAME,,} == "connection" || ${NETWORK_NAME,,} == "con" \ + || ${NETWORK_NAME,,} == ${CON_DEVICE,,} || ${NETWORK_NAME,,} == ${CON_UUID,,} \ + || ${NETWORK_NAME,,} == ${CON_NAME,,} || ${NETWORK_NAME,,} == ${CON_TYPE,,} ]] \ + && nmcli connection modify "${CON_UUID}" ${NETWORK[${NETWORK_ITEM}]} + systemctl restart NetworkManager.service + fi + done + done < <(nmcli -g device,uuid,name,type connection show) diff --git a/ublinux/rc.network.d/81-samba b/ublinux/rc.network.d/81-samba new file mode 100755 index 0000000..2c033fd --- /dev/null +++ b/ublinux/rc.network.d/81-samba @@ -0,0 +1,46 @@ +#!/bin/bash + +# Description: This script will generate initial passwords for samba users +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +# Machine only +SMBRANDOMSTR=$(lspci -nmm | cat - /etc/machine-id /proc/cmdline | md5sum | awk '{print $1}') +SMBUSERS=$(grep ^users: /etc/group | awk -F: '{print $4}' | tr ';,' ' ') +SMBGUEST="yes" + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +[ "$SMBGUEST" != "yes" ] && GUESTOPT=e || GUESTOPT=d + +addusers() +{ + for a in $SMBUSERS ;do + PASS=$(echo "$a $SMBRANDOMSTR" | md5sum | cut -c 1-6) + echo -e $PASS\\n$PASS\\n | smbpasswd -Lsa $a >/dev/null 2>&1 + done + smbpasswd -Lan nobody >/dev/null 2>&1 + smbpasswd -L$GUESTOPT nobody >/dev/null 2>&1 +} + +show() +{ + echo "Default samba passwords:" + for a in $SMBUSERS ;do + PASS=$(echo "$a $SMBRANDOMSTR" | md5sum | cut -c 1-6) + echo $a $PASS + done + [ "$SMBGUEST" = "yes" ] && echo "guest account is enabled on default" || echo "guest account is disabled on default" +} + + +if [ "$MKSMBPWD" != "no" ] ;then + smbpasswd -L$GUESTOPT nobody >/dev/null 2>&1 || addusers +fi + +[ "$UID" = "0" -a "$1" = "show" ] && $1 diff --git a/ublinux/rc.network.d/90-ublinuxupdate b/ublinux/rc.network.d/90-ublinuxupdate new file mode 100755 index 0000000..511f3a7 --- /dev/null +++ b/ublinux/rc.network.d/90-ublinuxupdate @@ -0,0 +1,18 @@ +#!/bin/bash + +# Description: This script will generate + +ENABLED= +[ "$ENABLED" != "yes" ] && exit 0 + +DEBUGMODE=no +. /usr/lib/ublinux/functions +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +echo $UBLINUXUPDATE | grep -qi ^auto$ || exit 0 + +/usr/lib/ublinux/scripts/ubupdate --auto >/dev/null 2>&1 + +exit 0 diff --git a/ublinux/rc.post.d/01-system b/ublinux/rc.post.d/01-system new file mode 100755 index 0000000..63b31e3 --- /dev/null +++ b/ublinux/rc.post.d/01-system @@ -0,0 +1,25 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +DEBUGMODE=no +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +# sysctl variables +[ -f /etc/sysctl.conf ] && sysctl -p /etc/sysctl.conf +[ -f /etc/sysctl.d/ublinux.conf ] && sysctl -p /etc/sysctl.d/ublinux.conf + +# If Linux installed on n[t]fs we have to omit killing rootfilesystem mounter when system halt +ps -A | egrep 'ntfsmount|rpciod|nfsiod|httpfs|curlftpfs' | awk '{ print $1 }' >> /var/run/sendsigs.omit + +# Creating /etc/mtab +#rm -f /etc/mtab +#ln -sf /proc/mounts /etc/mtab + +[ -z "$KDEVARTMP" ] || mkdir -p "$KDEVARTMP" +[ -d "$KDEVARTMP" ] && chmod 777 "$KDEVARTMP" + +[[ -d /memory/run ]] && cp -fr /memory/run/* /run/ && rm -rf /memory/run diff --git a/ublinux/rc.post.d/02-hwclock b/ublinux/rc.post.d/02-hwclock new file mode 100755 index 0000000..fcb20d7 --- /dev/null +++ b/ublinux/rc.post.d/02-hwclock @@ -0,0 +1,16 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +[ "$SETCLKATSTART" = "no" ] && exit 0 + +SOURCE=${SYSCONF}/clock; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +HWCLOCKOPIONS="--utc" +[ "$UTC" = "false" ] && HWCLOCKOPIONS="--localtime" +hwclock -s $HWCLOCKOPIONS diff --git a/ublinux/rc.post.d/03-modprobepreload b/ublinux/rc.post.d/03-modprobepreload new file mode 100755 index 0000000..639c0d1 --- /dev/null +++ b/ublinux/rc.post.d/03-modprobepreload @@ -0,0 +1,14 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +[ "$MODPROBEPRELOAD" = "no" ] && exit 0 + +cat /etc/modprobe.preload | sed s/'#.*'// | sed /^$/d | while read a ;do + modprobe $a +done \ No newline at end of file diff --git a/ublinux/rc.post.d/09-automount b/ublinux/rc.post.d/09-automount new file mode 100755 index 0000000..07794f0 --- /dev/null +++ b/ublinux/rc.post.d/09-automount @@ -0,0 +1,34 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +#SMBOPTSDEF="vers=3,nolock,users,noauto" + +# Everybody will have full read/write access +# OPTSDEF="noperm" +OPTSDEF="" + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + + if [[ -n "${AUTOMOUNT_SHARE[@]}" ]]; then + for SHARE in "${!AUTOMOUNT_SHARE[@]}"; do + if [[ "$(cut -d: -f1 <<< ${AUTOMOUNT_SHARE[${SHARE}]})" == "direct" ]]; then + PATH_MOUNT_FROM="$(cut -d: -f2 <<< ${AUTOMOUNT_SHARE[${SHARE}]})" + [[ -d ${SHARE} ]] && umount -qRlf "${SHARE}" || mkdir -p "${SHARE}" + GROUP="$(cut -d: -f3 <<< ${AUTOMOUNT_SHARE[${SHARE}]})" + [[ -n ${GROUP} ]] && chown -f root:${GROUP} ${SHARE} + MOD="$(cut -d: -f4 <<< ${AUTOMOUNT_SHARE[${SHARE}]})" + [[ -n ${MOD} ]] && chmod -f ${MOD} "${SHARE}" + OPTS="$(cut -d: -f5 <<< ${AUTOMOUNT_SHARE[${SHARE}]})" + [[ -z ${OPTS} ]] && OPTS="${OPTSDEF}" + [[ -n ${OPTS} ]] && OPTS=" -o ${OPTS}" + mount ${PATH_MOUNT_FROM} ${SHARE} ${OPTS} + fi + done + fi diff --git a/ublinux/rc.post.d/10-backgrounds b/ublinux/rc.post.d/10-backgrounds new file mode 100755 index 0000000..fffa23f --- /dev/null +++ b/ublinux/rc.post.d/10-backgrounds @@ -0,0 +1,428 @@ +#!/usr/bin/env bash +## +## ./script ${RESOLUTION} ${VERSION_CODENAME} ${STATE_MODE} +## RESOLUTION: +## 1024x768 #(4:3) +## 2048x1536 #(4:3) +## 1440x1080 #(4:3) +## 2560x2048 #(5:4) +## 1920x1080 #(16:9) +## 3840x2160 #(16:9) +## 3440x1440 #(21:9) +## 1440x900 #(16:10) +## 2560x1600 #(16:10) +## VERSION_CODENAME: +## ublinux_db +## ublinux_de +## ublinux_edu +## ublinux_srv +## ublinux_exp +## ublinux_de_adara +## ublinux_srv_adara +## ublinux_de_sibsutis +## ublinux_edu_sibsutis +## ublinux_srv_sibsutis +## ublinux_liveoffice +## ublinux_unknown +## STATE_MODE +## "changes" # Полное сохранение ub.mode=changes +## "toxzm" or "machines" # Сохранение в модуль ub.mode=toxzm ub.mode=machines +## "/" # Песочница с сохранением профиля пользователя ub.mode= ; ub.home=/ublinux-data/homes +## "" # Полная песочница RAM ub.mode= (clean); ub.home= +## "" # Полная песочница HDD ub.mode=clear; ub.home= +## + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/desktop; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/video; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +[[ ${DISPLAYMANAGER} == "none" ]] && exit + + ROOTDIR= #`pwd` + [[ -n $1 ]] && [[ -n $2 ]] && build_manual=yes + source_img_dir=${ROOTDIR}/usr/share/ublinux/backgrounds/source #Каталог с исходниками изображений + wallpapers_tmp=${ROOTDIR}/tmp/ublinux_bg #Каталог скомпиллированных изображений + wallpapers_dst=${ROOTDIR}/usr/share/backgrounds/ublinux #Каталог скомпиллированных изображений + default_de_img=${wallpapers_dst%/*}/background.jpg + default_dm_img=${wallpapers_dst%/*}/dm.jpg + bg_desktop_basic=bg_db.png # Фон для Desktop Basic + bg_desktop_enterprise=bg_de.png # Фон для Desktop Enterprise + bg_education=bg_edu.png # Фон для Education + bg_expert=bg_exp.png # Фон для Expert + bg_server=bg_srv.png # Фон для Server + shadow_img=shadow.png # Затенение + hex_img=hex.png # Сетка из шестигранников + transparent=transparent.png # Изображение прозрачный пиксель + logo_img=logo.png # Логотип исходный + logo_desktop_basic=logo_db.png # Изображение редакции дистрибутива + logo_desktop_enterprise=logo_de.png # Изображение редакции дистрибутива + logo_education=logo_edu.png # Изображение редакции дистрибутива + logo_expert=logo_exp.png # *Deprecated* Изображение редакции дистрибутива + logo_server=logo_srv.png # Изображение редакции дистрибутива + logo_light=logo_light.png # Изображение свечения логотипа + logo_adara=logo_adara.png # Изображение редакции дистрибутива Adara + logo_sibsutis=logo_sibsutis.png # Изображение редакции дистрибутива SibSUTIS + logo_liveoffice=logo_liveoffice.png # Изображение редакции дистрибутива LiveOffice + logo_clue_img=logo_clue.png # Имя склееного логотипа с редакцией дистрибутива + + img_state_bg_de=bg_icon_state_de.png # Фон для иконки режима сохранения (рабочий стол) + img_state_bg_dm=bg_icon_state_dm.png # Фон для иконки режима сохранения (гритер) + img_nosave=icon_state_ro.png # Иконка для режима "без сохранения" + img_fullsave=icon_state_rw.png # Иконка для режима "полное сохранение" + img_homesave=icon_state_uw.png # Иконка для режима "сохранение home" + img_modulesave=icon_state_mw.png # Иконка для режима "сохранение в модуль" + + passwd_block_img=passwd_text.png # Изображение с текстом для FirstSart + wp_de_filename=tmp_wp_de.jpg # Имя файла обоев + wp_dm_filename=tmp_wp_dm.jpg # Имя файла фона гритера + shadow_level=175 # Степень затенения обоев рабочего стола в %, где 100 - исходная яркость, <100 - светлее, >100 - темнее + declare -A monitors + RESOLUTION= + +# Функция получения всех видеовыходов с максимальными разрешениями +# В теле основном: +# declare -A monitors +# Входной параметр: имя переменной массива +# get_max_resolution "monitors" +# Выходной параметр: заполненный массив, вида +# card0-HDMI-A-1:1920x2000 +# card0-DP-1:1920x1080 +# card0-VGA-1:1280x720 +# RESOLUTION:1920x2000 +get_max_resolution() { + local max_mode # Максимальное разрешение из всех мониторов + # Метод определения разрешения №1, подходит для свободных драйверов KMS + # Без драйверов по VGA не находит разрешение + if ls /sys/class/drm/*/status &>/dev/null; then + for video_output in /sys/class/drm/*/status; do + if [[ $(cat ${video_output}) == "connected" ]]; then + video_name="${video_output%/*}"; video_name="${video_name##*/}" + video_modes="${video_output%/*}/modes" + [[ -f ${video_modes} ]] || break + max_mode="0" + while read line_mode; do + pixel_line_mode=$(echo ${line_mode} | tr -d "i" | tr x "*" | bc) + [[ "${line_mode}" == "1440x900" ]] && pixel_line_mode=$( echo ${pixel_line_mode} + 14721 | bc) # fix 1440x900 > 1280x1024 + pixel_max_mode=$(echo ${max_mode} | tr -d "i" | tr x "*" | bc) + [[ ${pixel_line_mode} -gt ${pixel_max_mode} ]] && max_mode=$(echo ${line_mode} | tr -d "i") + pixel_max_mode_all=$(echo ${RESOLUTION} | tr -d "i" | tr x "*" | bc) + [[ ${pixel_line_mode} -gt ${pixel_max_mode_all} ]] && RESOLUTION=$(echo ${line_mode} | tr -d "i") + done < ${video_modes} + monitors[${video_name}]=${max_mode} + fi + done + fi + # Метод определения разрешения №2 + # из конфига /etc/ublinux/video по статическим заданным разрешениям + [[ -n "${XORG_MONITOR[@]}" ]] && declare -n MONITOR=XORG_MONITOR + [[ -n "${XRANDR_MONITOR[@]}" ]] && declare -n MONITOR=XRANDR_MONITOR + if [[ -n "${MONITOR[@]}" ]]; then + for VIDEO_PORT in "${!MONITOR[@]}"; do + while read VIDEO_PORT_PARAM; do + if egrep -iq "^[0-9]*x[0-9]*$|^[0-9]*x[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + RESOLUTION="$(sed 's/\([0-9]*\*[0-9]*\) .*/\1/' <<< ${VIDEO_PORT_PARAM//x/*})" + # fix 1440x900 > 1280x1024 + [[ "${RESOLUTION}" == "1440*900" ]] && pixel_line_mode=$(bc <<< "${RESOLUTION}+14721") || pixel_line_mode=$(bc <<< ${RESOLUTION}) + [[ ${pixel_line_mode} -gt ${pixel_max_mode} ]] && pixel_max_mode=${pixel_line_mode} && RESOLUTION_MAX=${RESOLUTION} + fi + done < <(tr ',' '\n' <<< "${MONITOR[${VIDEO_PORT}]}") + done + RESOLUTION=${RESOLUTION_MAX//\*/x} + fi + + # Метод определения разрешения №99, при условии запущенного lightdm + local PATH_XAUTHORITY="/var/lib/lightdm/.Xauthority" + [[ -z ${RESOLUTION} && -f ${PATH_XAUTHORITY} && -n $(ls /tmp/.X11-unix/X* 2>/dev/null) ]] && \ + RESOLUTION=$(XAUTHORITY=${PATH_XAUTHORITY} xrandr -d $(ls /tmp/.X11-unix | tr 'X' ':' | head -n 1) 2>/dev/null | grep "*" | xargs | cut -d" " -f1) +# $(xrandr -d :0 --current | sed -n 's/.* connected \([0-9]*\)x\([0-9]*\)+.*/\1x\2/p') + # Если не обнаружено ни одно разрешение, то статическое + [[ -z ${RESOLUTION} ]] && RESOLUTION=${WALLPAPERSRES} + [[ -z ${RESOLUTION} ]] && RESOLUTION="1920x1080" +} + +build_logo_ublinux_all(){ +# Склейка логотипа UBLinux со свечением + [[ -n ${logo_light} ]] && convert $source_img_dir/$logo_light $source_img_dir/$logo_img -gravity center -background none +smush -710 $wallpapers_tmp/tmp_$logo_clue_img \ + || cp $source_img_dir/$logo_img $wallpapers_tmp/tmp_$logo_clue_img +# Конвеер вставки логотипа редакции ОС + [[ -n ${edition_img} ]] && composite -geometry $geometry_edition_wp -gravity east $source_img_dir/$edition_img $wallpapers_tmp/tmp_$logo_clue_img $wallpapers_tmp/tmp_$logo_clue_img + +# Конвеер вставки логотипа суббренда + if [ ${geometry_adara_wp} ]; then + img_logo_width=$(identify $wallpapers_tmp/tmp_$logo_clue_img | cut -d" " -f3 | cut -d"x" -f1) + img_adara_width=$(identify $source_img_dir/$logo_adara | cut -d" " -f3 | cut -d"x" -f1) + let img_logo_width=($img_logo_width+$img_adara_width) + convert $wallpapers_tmp/tmp_$logo_clue_img -gravity west -background none -extent $img_logo_width'x' $wallpapers_tmp/tmp_$logo_clue_img + composite -geometry $geometry_adara_wp -gravity east $source_img_dir/$logo_adara $wallpapers_tmp/tmp_$logo_clue_img $wallpapers_tmp/tmp_$logo_clue_img + elif [ ${geometry_sibsutis_wp} ]; then + img_logo_width=$(identify $wallpapers_tmp/tmp_$logo_clue_img | cut -d" " -f3 | cut -d"x" -f1) + convert $wallpapers_tmp/tmp_$logo_clue_img -gravity west -background none -extent $img_logo_width'x' $wallpapers_tmp/tmp_$logo_clue_img + composite -geometry $geometry_sibsutis_wp -gravity north $source_img_dir/$logo_sibsutis $wallpapers_tmp/tmp_$logo_clue_img $wallpapers_tmp/tmp_$logo_clue_img + fi +} + +build_background_all(){ +# Наложение градиентного затемнения DE + convert -composite $background $source_img_dir/$shadow_img $wallpapers_tmp/$wp_de_filename +# Наложение градиентного затемнения DM + cp $wallpapers_tmp/$wp_de_filename $wallpapers_tmp/$wp_dm_filename +} + +build_background_de(){ +# Наложение сетки шестигранников DE + convert -composite $wallpapers_tmp/$wp_de_filename $source_img_dir/$hex_img $wallpapers_tmp/$wp_de_filename +# Конвеер вставки объединенного логотипа на фон DE + composite -geometry $geometry_logo_wp -gravity west $wallpapers_tmp/tmp_$logo_clue_img $wallpapers_tmp/$wp_de_filename $wallpapers_tmp/$wp_de_filename +# Затенения обоев рабочего стола + convert $wallpapers_tmp/$wp_de_filename -level 0,$shadow_level% $wallpapers_tmp/$wp_de_filename +} + +build_background_dm(){ +# Вычисление коэффициента скейлинга + img_hight=$(identify $background | cut -d" " -f3 | cut -d"x" -f2) + ratio_scale=$(echo "scale=2;$img_hight/$hight" | bc) +# echo RS=$ratio_scale + tmp_logo_clue_hight=$(identify $wallpapers_tmp/tmp_$logo_clue_img | cut -d" " -f3 | cut -d"x" -f2) + nsize_logo_clue_hight=$(echo "scale=0;$tmp_logo_clue_hight/$ratio_scale" | bc) +# echo RSCF Logo=$nsize_logo_clue_hight + convert $wallpapers_tmp/tmp_$logo_clue_img -resize x$nsize_logo_clue_hight $wallpapers_tmp/tmp_dm_$logo_clue_img + convert $wallpapers_tmp/tmp_dm_$logo_clue_img -resize 35% $wallpapers_tmp/tmp_dm_$logo_clue_img + x_shift=$(echo "scale=0;150/$ratio_scale" | bc) + y_shift=$(echo "scale=0;170/$ratio_scale" | bc) +# echo "LOGO $x_shift on $y_shift px" +# Конвеер вставки объединенного уменьшенного логотипа на фон DM + composite -geometry +$x_shift+$y_shift $wallpapers_tmp/tmp_dm_$logo_clue_img $wallpapers_tmp/$wp_dm_filename $wallpapers_tmp/$wp_dm_filename +} + +insert_background_dm_txtpass(){ +# Вычисление коэффициента скейлинга + img_hight=$(identify $background | cut -d" " -f3 | cut -d"x" -f2) + ratio_scale=$(echo "scale=2;$img_hight/$hight" | bc) + tmp_passwd_text_hight=$(identify $source_img_dir/$passwd_block_img | cut -d" " -f3 | cut -d"x" -f2) + nsize_passwd_text_hight=$(echo "scale=0;$tmp_passwd_text_hight/$ratio_scale" | bc) + x_shift_text=$(echo "scale=0;0/$ratio_scale" | bc) + y_shift_text=$(echo "scale=0;370/$ratio_scale" | bc) +# echo "TXT $x_shift_text on $y_shift_text px" +# echo RSCF first=$nsize_passwd_text_hight + convert $source_img_dir/$passwd_block_img -resize x$nsize_passwd_text_hight -colorspace RGB $wallpapers_tmp/tmp_$passwd_block_img + composite -geometry +$x_shift_text+$y_shift_text -gravity NorthEast $wallpapers_tmp/tmp_$passwd_block_img $default_dm_img $default_dm_img +} + +# $1 Файл иконки для вставки +insert_background_icon(){ +# Вычисление коэффициента скейлинга + img_hight=$(identify $background | cut -d" " -f3 | cut -d"x" -f2) + ratio_scale=$(echo "scale=2;$img_hight/$hight" | bc) +# DM + # bg icon + tmp_state_icon_bg_hight=$(identify $source_img_dir/$img_state_bg_dm | cut -d" " -f3 | cut -d"x" -f2) + nsize_state_icon_bg_hight=$(echo "scale=0;$tmp_state_icon_bg_hight/$ratio_scale" | bc) + x_shift_img_bg=$(echo "scale=0;-160/$ratio_scale" | bc) + y_shift_img_bg=$(echo "scale=0;170/$ratio_scale" | bc) + convert $source_img_dir/$img_state_bg_dm -resize x$nsize_state_icon_bg_hight -colorspace RGB $wallpapers_tmp/tmp_$img_state_bg_dm + composite -geometry +$x_shift_img_bg+$y_shift_img_bg -gravity NorthEast $wallpapers_tmp/tmp_$img_state_bg_dm $default_dm_img $default_dm_img + # icon + tmp_state_icon_hight=$(identify $source_img_dir/$1 | cut -d" " -f3 | cut -d"x" -f2) + nsize_state_icon_hight=$(echo "scale=0;$tmp_state_icon_hight/($ratio_scale*1.5)" | bc) + x_shift_img=$(echo "scale=0;120/$ratio_scale" | bc) + y_shift_img=$(echo "scale=0;168/$ratio_scale" | bc) + convert $source_img_dir/$1 -resize x$nsize_state_icon_hight -colorspace sRGB $wallpapers_tmp/tmp_state.png + composite -geometry +$x_shift_img+$y_shift_img -gravity NorthEast $wallpapers_tmp/tmp_state.png $default_dm_img $default_dm_img +# DE + # bg icon + tmp_state_icon_bg_hight=$(identify $source_img_dir/$img_state_bg_de | cut -d" " -f3 | cut -d"x" -f2) + nsize_state_icon_bg_hight=$(echo "scale=0;$tmp_state_icon_bg_hight/$ratio_scale" | bc) + x_shift_img_bg=$(echo "scale=0;1785/$ratio_scale" | bc) + y_shift_img_bg=$(echo "scale=0;0/$ratio_scale" | bc) + convert $source_img_dir/$img_state_bg_de -resize x$nsize_state_icon_bg_hight -colorspace RGB $wallpapers_tmp/tmp_$img_state_bg_de + composite -geometry +$x_shift_img_bg+$y_shift_img_bg -gravity NorthWest $wallpapers_tmp/tmp_$img_state_bg_de $default_de_img $default_de_img + # icon + tmp_state_icon_hight=$(identify $source_img_dir/$1 | cut -d" " -f3 | cut -d"x" -f2) + nsize_state_icon_hight=$(echo "scale=0;$tmp_state_icon_hight/($ratio_scale*1.5)" | bc) + x_shift_img=$(echo "scale=0;1940/$ratio_scale" | bc) + y_shift_img=$(echo "scale=0;50/$ratio_scale" | bc) + convert $source_img_dir/$1 -resize x$nsize_state_icon_hight -colorspace sRGB $wallpapers_tmp/tmp_state.png + composite -geometry +$x_shift_img+$y_shift_img -gravity NorthWest $wallpapers_tmp/tmp_state.png $default_de_img $default_de_img +} + +# Test get resolution || Проверить массив мониторов с разрешениями +# get_max_resolution "array_monitor_modes" +# for key in "${!monitors[@]}"; do +# echo "${key}:${monitors[${key}]}" +# done +# echo "${RESOLUTION}" + + mkdir -p ${wallpapers_tmp} + +# [[ -L ${wallpapers_dst} ]] || mkdir -p ${wallpapers_dst} + if [[ ! -e ${wallpapers_dst} ]]; then + mkdir -p $(readlink ${wallpapers_dst}) || mkdir -p ${wallpapers_dst} + fi + + grep -q xres= /proc/cmdline && RESOLUTION=$(cat /proc/cmdline | awk -F xres= '{print $2}' | awk '{print $1}') +# xres=$(cmdline_value desktop) && [[ ! -z ${xres} ]] && RESOLUTION=${xres} +# Определение разрешения экрана + [[ -z $1 ]] || RESOLUTION=$1 + [[ -z "${RESOLUTION}" ]] && get_max_resolution + [[ -z "${RESOLUTION}" ]] && echo "ERROR: resolution not detect" && exit 1 +# Определение редакции ОС + [[ -z $2 ]] && edition_os=$(cat /etc/os-release | grep VERSION_CODENAME | cut -d"=" -f2 2>/dev/null) || edition_os=$2 + + width=${RESOLUTION%x*} + hight=${RESOLUTION#*x} +#echo "${width} on ${hight}" +# Вычисление соотношения сторон экрана + ratio=$(bc <<< "scale=2;${width:=1024}/${hight:=768}") + if [ $(bc -l <<< "$ratio==1.33") -eq 1 ]; then + fname_ratio="4:3" + elif [ $(bc -l <<< "$ratio==1.25") -eq 1 ]; then + fname_ratio="5:4" + elif [ $(bc -l <<< "$ratio==1.77") -eq 1 ]; then + fname_ratio="16:9" + elif [ $(bc -l <<< "$ratio==1.6") -eq 1 ]; then + fname_ratio="16:10" + elif [ $(bc -l <<< "$ratio==2.38") -eq 1 ]; then + fname_ratio="21:9" + else + exit 0 + fi + +#echo "==> ${width}x${hight} :: $ratio :: $fname_ratio" && exit 1 + +# Установка значений переменных для графических ресурсов, исходя из типа редакции ОС + geometry_logo_wp=+69-52 + case "$edition_os" in + ublinux_db) + background=$source_img_dir/$bg_desktop_basic + edition_img=$logo_desktop_basic + geometry_edition_wp=+86+256 + ;; + ublinux_de) + background=$source_img_dir/$bg_desktop_enterprise + edition_img=$logo_desktop_enterprise + geometry_edition_wp=+86+256 + ;; + ublinux_edu) + background=$source_img_dir/$bg_education + edition_img=$logo_education + geometry_edition_wp=+70+256 + ;; + ublinux_srv) + background=$source_img_dir/$bg_server + edition_img=$logo_server + geometry_edition_wp=+86+256 + ;; + ublinux_exp) + background=$source_img_dir/$bg_exp + edition_img=$logo_expert + geometry_edition_wp=+72+256 + ;; + ublinux_de_adara) + background=$source_img_dir/$bg_desktop_enterprise + edition_img=$logo_desktop_enterprise + geometry_edition_wp=+86+256 + geometry_adara_wp=+130+42 + ;; + ublinux_srv_adara) + background=$source_img_dir/$bg_server + edition_img=$logo_server + geometry_edition_wp=+86+256 + geometry_adara_wp=+130+42 + ;; + ublinux_de_sibsutis) + background=$source_img_dir/$bg_desktop_enterprise + edition_img=$logo_desktop_enterprise + geometry_edition_wp=+86+256 + geometry_sibsutis_wp=+470+166 + ;; + ublinux_edu_sibsutis) + background=$source_img_dir/$bg_education + edition_img=$logo_education + geometry_edition_wp=+70+256 + geometry_sibsutis_wp=+470+166 + ;; + ublinux_srv_sibsutis) + background=$source_img_dir/$bg_server + edition_img=$logo_server + geometry_edition_wp=+86+256 + geometry_sibsutis_wp=+470+166 + ;; + ublinux_liveoffice) + background=$source_img_dir/$bg_desktop_enterprise + logo_img=$logo_liveoffice + geometry_logo_wp=+260-130 + unset logo_light + ;; + ublinux_unknown | *) + background=$source_img_dir/$bg_desktop_basic + edition_img=$logo_desktop_basic + geometry_edition_wp=+86+256 + ;; + esac + CHECK_BOOT_FILE=$(find $wallpapers_dst/ -name "${edition_os}_boot_${fname_ratio}_${RESOLUTION}.jpg" | wc -l) + CHECK_BACKGROUND_FILE=$(find $wallpapers_dst/ -name "${edition_os}_background_${fname_ratio}_${RESOLUTION}.jpg" | wc -l) + if [[ ${CHECK_BOOT_FILE} -eq 0 ]] || [[ ${CHECK_BACKGROUND_FILE} -eq 0 ]]; then + [[ ! -x /usr/bin/composite ]] && [[ ! -x /usr/bin/convert ]] && echo "Error: not fount /usr/bin/composite or /usr/bin/convert" && exit 0 + build_logo_ublinux_all + build_background_all + build_background_de +# Изменение разрешения фонов DM DE + case ${fname_ratio} in + "4:3" | "5:4" | "16:10" ) # Изменить размер по высоте (hight) + for filename in $wp_de_filename $wp_dm_filename; do + convert -resize x$hight $wallpapers_tmp/${filename} $wallpapers_tmp/${filename} + convert -crop $width\x+0+0 $wallpapers_tmp/${filename} $wallpapers_tmp/${filename} + done + ;; + "21:9") # Изменить размер по ширине (width) + for filename in $wp_de_filename $wp_dm_filename; do + convert -resize $width $wallpapers_tmp/${filename} $wallpapers_tmp/${filename} + out_img_hight=$(identify $wallpapers_tmp/${filename} | cut -d" " -f3 | cut -d"x" -f2) + let crop_top=($out_img_hight-$hight)/2 + convert -crop x$hight+0+$crop_top $wallpapers_tmp/${filename} $wallpapers_tmp/${filename} + done + ;; + "16:9") # Изменить размер пропорционально + for filename in $wp_de_filename $wp_dm_filename; do + convert -resize x$hight $wallpapers_tmp/${filename} $wallpapers_tmp/${filename} + done + ;; + esac + build_background_dm + [[ -z ${build_manual} ]] && mv $wallpapers_tmp/$wp_de_filename $wallpapers_dst/${edition_os}_background_${fname_ratio}_${RESOLUTION}.jpg || mv $wallpapers_tmp/$wp_de_filename $wallpapers_tmp/${edition_os}_background_${fname_ratio}_${RESOLUTION}.jpg + [[ ${build_manual} ]] && mogrify -format png -write $wallpapers_tmp/${edition_os}_boot_${fname_ratio}_${RESOLUTION}.png $wallpapers_tmp/$wp_dm_filename + [[ -z ${build_manual} ]] && mv $wallpapers_tmp/$wp_dm_filename $wallpapers_dst/${edition_os}_boot_${fname_ratio}_${RESOLUTION}.jpg || mv $wallpapers_tmp/$wp_dm_filename $wallpapers_tmp/${edition_os}_boot_${fname_ratio}_${RESOLUTION}.jpg + fi + [[ -z ${build_manual} ]] && cp -pf $wallpapers_dst/${edition_os}_background_${fname_ratio}_${RESOLUTION}.jpg $default_de_img + [[ -z ${build_manual} ]] && cp -pf $wallpapers_dst/${edition_os}_boot_${fname_ratio}_${RESOLUTION}.jpg $default_dm_img + +# Если пароли по умолчанию ublinux, то вывести подсказку пароля + [[ -z ${build_manual} ]] && grep -q "^root:$DEFAULTROOTPASSWD:" /etc/shadow && grep -q "^$(getent passwd "${ADMUID}" | cut -d: -f1):$DEFAULTPASSWD:" /etc/shadow && insert_background_dm_txtpass + if [[ -z ${build_manual} ]] && [[ "$GRAFFITI" != "no" ]]; then + [[ -z $3 ]] && state_mode="$(cmdline_value ub.mode)" || state_mode=$3 + [[ -z $3 ]] && state_home="$(cmdline_value ub.home)" || state_home=$3 +# Полное сохранение ub.mode=changes + if [[ $state_mode =~ ^"changes"$ ]]; then + insert_background_icon $img_fullsave +# Сохранение в модуль ub.mode=toxzm ub.mode=machines + elif [[ $state_mode =~ ^("toxzm"|"machines")$ ]]; then + insert_background_icon $img_modulesave +# Песочница с сохранением профиля пользователя ub.mode= ; ub.home=/ublinux-data/homes + elif [[ $state_home =~ ^"/" ]]; then + insert_background_icon $img_homesave +# Полная песочница RAM ub.mode= (clean); ub.home= +# Полная песочница HDD ub.mode=clear; ub.home= + else + insert_background_icon $img_nosave + fi + fi + [[ -n ${build_manual} ]] || rm -rdf $wallpapers_tmp + \ No newline at end of file diff --git a/ublinux/rc.post.d/11-xorg b/ublinux/rc.post.d/11-xorg new file mode 100755 index 0000000..87145ed --- /dev/null +++ b/ublinux/rc.post.d/11-xorg @@ -0,0 +1,132 @@ +#!/usr/bin/env bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +#. $HARDCONF +#echo "$XDRIVER" | grep -q "nvidia" || rmmod nvidia +#STEAMNODPMS=yes + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/video; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/desktop; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/keyboard; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + + [[ ${DISPLAYMANAGER} == "none" ]] && exit + + # Auto VGA driver loader + if [[ -n ${VGADRV_AUTO} ]]; then + while read LSPCI_DEVICE; do + while read KERNEL_MODULE; do + [[ ${KERNEL_MODULE} != "nouveau" ]] && modprobe ${KERNEL_MODULE} 2>/dev/null && break + done < <(lspci -ks ${LSPCI_DEVICE%% *} | grep 'Kernel modules:' | cut -d: -f2 | tr ',' '\n' | tac) + done < <(lspci | egrep -i 'vga|3d') + if lsmod | grep nvidia &>/dev/null; then + #[[ -f /usr/bin/nvidia-xconfig ]] && nvidia-xconfig -s --no-logo --no-composite --no-dynamic-twinview --force-generate --output-xconfig=/etc/X11/xorg.conf + [[ -e /etc/X11/xorg.conf.d/20-nvidia-ubconfig.conf ]] || ln -sf /usr/lib/ublinux/xorg.conf.d/20-nvidia-ubconfig.conf /etc/X11/xorg.conf.d/ + #[[ -e /etc/udev/rules.d/70-nvidia-ubconfig.rules ]] || ln -sf /usr/lib/ublinux/udev/70-nvidia-ubconfig.rules /etc/udev/rules.d/ + /usr/bin/nvidia-modprobe -c0 -umsl + modprobe nvidia_drm + modprobe nvidia_uvm + modprobe nvidia_modeset + #modprobe drm_kms_helper + #modprobe drm + #echo -e nvidia_drm\\nvidia_uvm\\nnvidia_modeset > usr/lib/modules-load.d/nvidia-dkms.conf + fi + else + rm -f /etc/X11/xorg.conf.d/20-nvidia-ubconfig.conf + rm -f /etc/udev/rules.d/70-nvidia-ubconfig.rules + fi + + + #[ ! -z "$VGAID" ] && grep -q $VGAID /usr/share/ublinux/hwdata/deleteconf && rm -f /etc/X11/xorg.conf + [[ -n "${DELETE_XORG_CONF}" ]] && rm -f /etc/X11/xorg.conf + + +## Parametrs: +## cvt | gtf | reduced|r | dpms | nodpms | enable | disable | ignore | primary | +## lo|LeftOf:{name} | ro|RightOf:{name} | ab|Above:{name} | be|Below:{name} | +## rotate:normal | rotate:left | rotate:right | rotate:invert + grep -q xres= /proc/cmdline && XORG_MONITOR=$(cat /proc/cmdline | awk -F xres= '{print $2}' | awk '{print $1}') + if [[ "${SETXORGRES}" != "no" ]] && [[ -n "${XORG_MONITOR[@]}" ]]; then + XORG_FILE_MONITOR="/etc/X11/xorg.conf.d/10-monitor.conf" + for VIDEO_PORT in "${!XORG_MONITOR[@]}"; do + SOFT_MODELINE="gtf" + SOFT_MODELINE_R= + PREFERRED_MODE= + XORG_STR_MONITOR= + while read VIDEO_PORT_PARAM; do + if egrep -iq "^[0-9]*x[0-9]*$|^[0-9]*x[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + if [[ -n ${SOFT_MODELINE_R} ]]; then + XORG_STR_MONITOR+="$(cvt -r $(sed 's/\([0-9]* [0-9]*\) .*/\1/' <<< ${VIDEO_PORT_PARAM//x/ }))\n" + SOFT_MODELINE_R= + elif [[ ${SOFT_MODELINE} == "cvt" ]]; then + XORG_STR_MONITOR+="$(cvt ${VIDEO_PORT_PARAM//x/ })\n" + else + if egrep -iq "^[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+="$(gtf ${VIDEO_PORT_PARAM//x/ } 60 | grep -v '^\s*$')\n" + else + XORG_STR_MONITOR+="$(gtf ${VIDEO_PORT_PARAM//x/ } | grep -v '^\s*$')\n" + fi + fi + elif egrep -iq "^cvt$" <<< "${VIDEO_PORT_PARAM}"; then + SOFT_MODELINE="cvt" + elif egrep -iq "^gtf$" <<< "${VIDEO_PORT_PARAM}"; then + SOFT_MODELINE="gtf" + elif egrep -iq "^reduced|r$" <<< "${VIDEO_PORT_PARAM}"; then + SOFT_MODELINE_R="reduced" + elif egrep -iq "^nodpms$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=' Option "DPMS" "false"\n' + elif egrep -iq "^dpms$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=' Option "DPMS" "true"\n' + elif egrep -iq "^enable$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=' Option "Enable" "true"\n' + elif egrep -iq "^disable$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=' Option "Enable" "false"\n' + elif egrep -iq "^ignore$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=' Option "Ignore" "true"\n' + elif egrep -iq "^primary$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=' Option "Primary" "true"\n' + elif egrep -iq "^lo:[A-z0-9]*$|^LeftOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=" Option \"LeftOf\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n" + elif egrep -iq "^ro:[A-z0-9]*$|^RightOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=" Option \"RightOf\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n" + elif egrep -iq "^ab:[A-z0-9]*$|^Above:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=" Option \"Above\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n" + elif egrep -iq "^be:[A-z0-9]*$|^Below:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=" Option \"Below\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n" + elif egrep -iq "^Rotate:[A-z]*$" <<< "${VIDEO_PORT_PARAM}"; then + XORG_STR_MONITOR+=" Option \"Rotate\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n" + fi + [[ -z ${PREFERRED_MODE} ]] && PREFERRED_MODE=$(grep Modeline <<< "${XORG_STR_MONITOR}" | cut -d'"' -f2) + done < <(tr ',' '\n' <<< "${XORG_MONITOR[${VIDEO_PORT}]}") + if [[ -n ${XORG_STR_MONITOR} && ${VIDEO_PORT} != 0 ]]; then + XORG_STR+='Section "Monitor"\n' + XORG_STR+=" Identifier \"${VIDEO_PORT^^}\"\n" + XORG_STR+="${XORG_STR_MONITOR}" + [[ -n ${PREFERRED_MODE} ]] && XORG_STR+=" Option \"PreferredMode\" \"${PREFERRED_MODE}\"\n" + XORG_STR+='EndSection\n\n' + fi + done + [[ -n ${XORG_STR} ]] && echo -e "${XORG_STR}" > "${XORG_FILE_MONITOR}" + fi + + if [ "$MKKBDFXORG" != "no" ] ;then + if ! grep -sqi XkbOptions /etc/X11/xorg.conf; then + cat > /etc/X11/xorg.conf.d/00-keyboard.conf </dev/null +SOURCE=${SYSCONF}/kiosk; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + + rm -f /etc/polkit-1/rules.d/kiosk-* + if [[ -n ${POLKIT[@]} ]]; then + for RULES in "${!POLKIT[@]}"; do + RULES_GROUP= + RULES_FILE="/etc/polkit-1/rules.d/kiosk-$(sed 's/\([A-z0-9]*.[A-z0-9]*.[A-z0-9]*\)\..*/\1/' <<< ${RULES}).rules" + RULES_RESULT=$(cut -d: -f1 <<< ${POLKIT[${RULES}]}) + for GROUP in $(cut -d: -f2 <<< ${POLKIT[${RULES}]} | tr ',' '\n'); do + RULES_GROUP+="&& subject.isInGroup(\"${GROUP}\") " + done + cat >> ${RULES_FILE} </dev/null | grep -q off ;then + ln -sf /mnt/livemedia/ublinux/vmlinuz /boot + ln -sf /mnt/livemedia/ublinux/ublinux /boot + ln -sf /mnt/livemedia/ublinux/addon /boot + else + cp -pf /mnt/livemedia/ublinux/vmlinuz /boot + cp -pf /mnt/livemedia/ublinux/ublinux /boot + cp -pf /mnt/livemedia/ublinux/addon /boot + fi +fi diff --git a/ublinux/rc.post.d/23-publicdir b/ublinux/rc.post.d/23-publicdir new file mode 100755 index 0000000..08cc7ce --- /dev/null +++ b/ublinux/rc.post.d/23-publicdir @@ -0,0 +1,29 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +#PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +# Дирректория доступная всем локальным пользователям и при разрешении сетевым +#[ ! -z ${PUBLICDIR} ] && mkdir -p ${PUBLICDIR#/*} && chmod -R 2777 ${PUBLICDIR#/*} && chgrp -R 985 ${PUBLICDIR#/*} +[ ! -z ${PUBLICDIR} ] && mkdir -p ${PUBLICDIR} && chmod -R 2777 ${PUBLICDIR} && chgrp -R users ${PUBLICDIR} + +USERSHARES="/var/lib/samba/usershares" +[ ! -d ${USERSHARES} ] && mkdir -p ${USERSHARES} && chmod -R 1770 ${USERSHARES} && chown -R root:sambashare ${USERSHARES} + +USERSHARESPUB="/home/usershares" +[ ! -d ${USERSHARESPUB} ] && mkdir -p ${USERSHARESPUB} && chmod -R 2770 ${USERSHARESPUB} && chown -R root:sambashare ${USERSHARESPUB} +usermod -a -G sambashare nobody \ No newline at end of file diff --git a/ublinux/rc.post.d/30-network b/ublinux/rc.post.d/30-network new file mode 100755 index 0000000..affa2b9 --- /dev/null +++ b/ublinux/rc.post.d/30-network @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +SOURCE=/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/network; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + +debug_mode "$0" "$@" + + #[ "$DNS_RENEW" = "yes" -a -f /mnt/live/etc/resolv.conf ] && cat /mnt/live/etc/resolv.conf >> /etc/resolvconf/resolv.conf.d/head + + NETDEV=$(grep "e.*:[[:space:]]*[1-9]" /proc/net/dev | awk -F: '{print $1}' | head -1 | tr -d ' ') + [[ -z ${NETDEV} ]] && NETDEV=$(ls /sys/class/net/e*/address | awk -F/ '{print $5}' | head -1) + #[ -z "$NETDEV" ] || sed -i s/DEVICE=.*/DEVICE=$NETDEV/ /etc/ublinux/network-scripts/ifcfg-eth0 + +# if egrep -q " nfs |httpfs|ftpfs|sshfs| cifs " /proc/mounts ;then +# sed -i s/ONBOOT=.*/ONBOOT=no/ /etc/ublinux/network-scripts/ifcfg-eth0 +# sed -i s/NM_CONTROLLED=.*/NM_CONTROLLED=no/ /etc/ublinux/network-scripts/ifcfg-eth0 +# fi + + [[ -n $(cmdline_parameter flightmode) ]] && rfkill block all + diff --git a/ublinux/rc.post.d/35-soundprofile b/ublinux/rc.post.d/35-soundprofile new file mode 100755 index 0000000..99b8489 --- /dev/null +++ b/ublinux/rc.post.d/35-soundprofile @@ -0,0 +1,40 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +DEBUGMODE=no +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +[ -z "$PULSEAUDIO" ] && PULSEAUDIO=default + +function pulse() { + ln -sfT /etc/sound/profiles/pulse /etc/alternatives/soundprofile + sed -i 's|^.*autospawn.*$|autospawn = yes|' /etc/pulse/client.conf +# sed -i 's|^.*PULSE_SERVER_TYPE.*$|PULSE_SERVER_TYPE=personal|' /etc/ublinux/pulseaudio + echo " Soundprofile switched to PULSEAUDIO" +} + +function alsa() { + ln -sfT /etc/sound/profiles/alsa /etc/alternatives/soundprofile + sed -i 's|^.*autospawn.*$|autospawn = no|' /etc/pulse/client.conf +# sed -i 's|^.*PULSE_SERVER_TYPE.*$|PULSE_SERVER_TYPE=none|' /etc/ublinux/pulseaudio + echo " Soundprofile switched to ALSA" +} + +function default() { + /bin/true +} + +case "$PULSEAUDIO" in + "default" | "DEFAULT" ) + default ;; + "no" | "NO" | "disable" | "DISABLE" | "off" | "OFF" ) + alsa ;; + * ) + pulse ;; +esac diff --git a/ublinux/rc.post.d/50-update-fonts b/ublinux/rc.post.d/50-update-fonts new file mode 100755 index 0000000..205535e --- /dev/null +++ b/ublinux/rc.post.d/50-update-fonts @@ -0,0 +1,26 @@ +#!/bin/bash + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +#. /usr/lib/ublinux/functions +#. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +#for font_dir in /usr/share/fonts{,/default}/TTF /usr/X11R6/lib/X11/fonts/TTF; do +# if [ -d "${font_dir}" ]; then +# fcneed=on +# mkfontscale ${font_dir} +# mkfontdir ${font_dir} +# fi +#done +#[ $fcneed ] && fc-cache -f -s + +for font_dir in /usr/share/fonts/*; do + if [ -d "${font_dir}" ]; then + mkfontscale "${font_dir}" + mkfontdir "${font_dir}" + fi +done + +fc-cache -s 2>&1 &>/dev/null diff --git a/ublinux/rc.post.d/51-theme b/ublinux/rc.post.d/51-theme new file mode 100755 index 0000000..ea0897d --- /dev/null +++ b/ublinux/rc.post.d/51-theme @@ -0,0 +1,112 @@ +#!/bin/bash + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +DEBUGMODE=no +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +DIRGTK=gtk-2.0 +DIRGTK3=gtk-3.0 +DIRMETACITY=metacity-1 +DIROPENBOX=openbox-3 + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +CMDLINETHEME=$(cmdline_value theme) +[ -z "$CMDLINETHEME" ] || THEME=$CMDLINETHEME + +if ! [ -z "$THEME" ] ;then + case "$THEME" in + "ublinux" | "ublinux-dark" | "ublinux-green" | "ublinux-grey" ) + THEMEGTK=${THEMEGTK-$THEME} + THEMEGTK3=${THEMEGTK3-$THEME} + THEMEMETACITY=${THEMEMETACITY-$THEME} + THEMELXQT=${THEMELXQT-$THEME} + THEMEOPENBOX=${THEMEOPENBOX-$THEME} + THEMEEMERALD=${THEMEEMERALD-$THEME} + THEMEKDE=${THEMEKDE-$THEME} + THEMEKDEWIDGET=${THEMEKDEWIDGET-oxygen} + THEMEKDEKWIN=${THEMEKDEKWIN-kwin3_oxygen} + THEMEKDEPLASMA=${THEMEKDEPLASMA-Aya} + THEMEPLASMA=${THEMEPLASMA-org.ublinux.desktop} + THEMEPLASMACOLORS=${THEMEPLASMACOLORS-$THEME} + ;; + esac +fi + +#GTK & Gnome +if [ "$THEMEGTK" != "" -a -d "/usr/share/themes/$THEMEGTK/$DIRGTK" ] ;then + rm -fr "/usr/share/themes/Default/$DIRGTK" + ln -sf "../$THEMEGTK/$DIRGTK" "/usr/share/themes/Default/$DIRGTK" +fi +if [ "$THEMEGTK3" != "" -a -d "/usr/share/themes/$THEMEGTK3/$DIRGTK3" ] ;then + rm -fr "/usr/share/themes/Default/$DIRGTK3" + ln -sf "../$THEMEGTK3/$DIRGTK3" "/usr/share/themes/Default/$DIRGTK3" +fi +if [ "$THEMEMETACITY" != "" -a -d "/usr/share/themes/$THEMEMETACITY/$DIRMETACITY" ] ;then + rm -fr "/usr/share/themes/Default/$DIRMETACITY" + ln -sf "../$THEMEMETACITY/$DIRMETACITY" "/usr/share/themes/Default/$DIRMETACITY" +fi +if [ "$THEMEICONGNOME" != "" ] ;then + sed -i s/"IconTheme=.*"/"IconTheme=$THEMEICONGNOME"/ /usr/share/themes/Default/index.theme +fi + + +#KDE4 themes +#if [ -f /etc/X11/wmsession.d/01KDE4 ] ;then + if [ "$THEMEKDEPLASMA" != "" ] ;then + echo -e "[Theme]\nname=$THEMEKDEPLASMA" > /usr/share/ublinux/kde4/share/config/plasmarc + if [ -d "/usr/share/apps/desktoptheme/$THEMEKDEPLASMA" ] ;then + if ! grep -q "defaultWallpaperTheme" "/usr/share/apps/desktoptheme/$THEMEKDEPLASMA/metadata.desktop" ;then + echo -e "\n[Wallpaper]\ndefaultWallpaperTheme=/usr/share/ublinux/wallpapers/default.jpg" >> "/usr/share/apps/desktoptheme/$THEMEKDEPLASMA/metadata.desktop" + else + sed -i 's|defaultWallpaperTheme=.*|defaultWallpaperTheme=/usr/share/ublinux/wallpapers/default.jpg|' "/usr/share/apps/desktoptheme/$THEMEKDEPLASMA/metadata.desktop" + fi + fi + fi + if [ "$THEMEKDE" != "" -a -f "/usr/share/apps/color-schemes/$THEMEKDE.colors" ] ;then + concatenate_ini /usr/share/ublinux/kde4/share/config/kdeglobals "/usr/share/apps/color-schemes/$THEMEKDE.colors" + fi + if [ "$THEMEKDEWIDGET" != "" ] ;then + sed -i s/widgetStyle=.*/widgetStyle=$THEMEKDEWIDGET/ /usr/share/ublinux/kde4/share/config/kdeglobals + fi + if [ "$THEMEKDEKWIN" != "" ] ;then + sed -i s/PluginLib=.*/"PluginLib=$THEMEKDEKWIN"/ /usr/share/ublinux/kde4/share/config/kwinrc + fi + if [ "$THEMEICONKDE" != "" ] ;then + sed -i s/"Theme=.*"/"Theme=$THEMEICONKDE"/ /usr/share/ublinux/kde4/share/config/kdeglobals + fi +#fi + +#LXQT & LXDE +if [ "$THEMEICONLXDE" != "" ] ;then + sed -i 's|sNet/IconThemeName=.*|sNet/IconThemeName='"$THEMEICONLXDE"'|' /etc/xdg/lxsession/LXDE/desktop.conf +fi +if [ "$THEMELXQT" != "" -a -d /usr/share/lxqt/themes ] ;then + rm -f /usr/share/lxqt/themes/Default + ln -sf "$THEMELXQT" "/usr/share/lxqt/themes/Default" +fi +if [ "$THEMEOPENBOX" != "" -a -d "/usr/share/themes/$THEMEOPENBOX/$DIROPENBOX" ] ;then + rm -fr "/usr/share/themes/Default/$DIROPENBOX" + ln -sf "../$THEMEOPENBOX/$DIROPENBOX" "/usr/share/themes/Default/$DIROPENBOX" +fi + +#PLASMA +if [ "$THEMEPLASMACOLORS" != "" -a -f "/usr/share/color-schemes/$THEMEPLASMACOLORS.colors" -a -f /etc/xdg/kdeglobals ] ;then + cp -pf /usr/share/ublinux/plasma/kdeglobals /etc/xdg/kdeglobals + sed -i s/^ColorScheme=.*/"ColorScheme=$THEMEPLASMACOLORS"/ /etc/xdg/kdeglobals + egrep -v "^\[General\]|^Name=|^\[KDE\]|^colorScheme=|^contrast=|^shadeSortColumn=" "/usr/share/color-schemes/$THEMEPLASMACOLORS.colors" >> /etc/xdg/kdeglobals +fi +if [ "$THEMEPLASMA" != "" -a -d "/usr/share/plasma/look-and-feel/$THEMEPLASMA" -a -f /etc/xdg/kdeglobals ] ;then + sed -i s/^LookAndFeelPackage=.*/"LookAndFeelPackage=$THEMEPLASMA"/ /etc/xdg/kdeglobals +fi + +#compiz +if [ "$THEMEEMERALD" != "" -a -d "/usr/share/emerald/themes/$THEMEEMERALD" ] ;then + rm -fr /usr/share/emerald/theme + ln -sf "themes/$THEMEEMERALD" /usr/share/emerald/theme +fi diff --git a/ublinux/rc.post.d/60-blacklistdkms b/ublinux/rc.post.d/60-blacklistdkms new file mode 100755 index 0000000..ec531b0 --- /dev/null +++ b/ublinux/rc.post.d/60-blacklistdkms @@ -0,0 +1,24 @@ +#!/bin/bash + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +DEBUGMODE=no +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +WHITELISTMODULES="$(cmdline_value whitelist | tr ',;' ' ')" +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +echo -n > /etc/modprobe.d/blacklist-ublinux-dkms.conf + +LC_ALL=C lspci -k | grep "Kernel modules: " | grep ", " | sed s/.*"Kernel modules: "// | sed s/", "/"\n"/g > /tmp/kernel_mods_lspci +find /var/lib/dkms-binary -type f | egrep -v "nvidia|virtualbox|vbox" | egrep .ko$"|".ko.xz | gawk -F/ '{print $NF}' | sed s/[.]ko.*// | sort -u | grep -f /tmp/kernel_mods_lspci | while read a ;do + lspci -nn | grep -q -f /usr/share/ublinux/hwdata/dkms/$a 2>/dev/null && continue + echo "$WHITELISTMODULES" | grep -q "$a" && continue + modprobe -r "$a" 2>/dev/null + echo "blacklist $a" >> /etc/modprobe.d/blacklist-ublinux-dkms.conf +done + +rm -f /tmp/kernel_mods_lspci diff --git a/ublinux/rc.post.d/90-kesl b/ublinux/rc.post.d/90-kesl new file mode 100755 index 0000000..3dea0f2 --- /dev/null +++ b/ublinux/rc.post.d/90-kesl @@ -0,0 +1,14 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +if [ -d /var/opt/kaspersky ] ;then + if [ -d /mnt/livedata/ublinux-data ] ;then + if [ ! -d /mnt/livedata/ublinux-data/cache/kaspersky ] ;then + mkdir -p /mnt/livedata/ublinux-data/cache/kaspersky + cp -pr /var/opt/kaspersky/* /mnt/livedata/ublinux-data/cache/kaspersky || exit 1 + fi + mount --bind /mnt/livedata/ublinux-data/cache/kaspersky /var/opt/kaspersky + fi +fi diff --git a/ublinux/rc.post/01-system b/ublinux/rc.post/01-system new file mode 100755 index 0000000..fd9cd74 --- /dev/null +++ b/ublinux/rc.post/01-system @@ -0,0 +1,8 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +. /usr/lib/ublinux/functions +debug_mode "$0" "$@" + diff --git a/ublinux/rc.post/10-ldconfig b/ublinux/rc.post/10-ldconfig new file mode 100755 index 0000000..e44ad7c --- /dev/null +++ b/ublinux/rc.post/10-ldconfig @@ -0,0 +1,11 @@ +#!/bin/bash + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +debug_mode "$0" "$@" + +[ "$RUNLDCONFIG" = "yes" ] && /usr/bin/ldconfig diff --git a/ublinux/rc.post/20-plymouth b/ublinux/rc.post/20-plymouth new file mode 100755 index 0000000..71411d8 --- /dev/null +++ b/ublinux/rc.post/20-plymouth @@ -0,0 +1,8 @@ +#!/bin/bash + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +debug_mode "$0" "$@" + +[ -f /usr/bin/plymouth ] || /usr/bin/pkill -f @lymouthd diff --git a/ublinux/rc.post/30-selinux b/ublinux/rc.post/30-selinux new file mode 100755 index 0000000..e121206 --- /dev/null +++ b/ublinux/rc.post/30-selinux @@ -0,0 +1,12 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +debug_mode "$0" "$@" + +# For SELinux, you need to tell SELinux that aufs supports XATTR by these commands. +# if [ "$SELINUXENABLE" = "yes" ]; then +# echo '(fsuse xattr aufs (system_u object_r fs_t ((s0)(s0))))' > /tmp/aufs.cil +# sudo semodule -i /tmp/aufs.cil +# fi \ No newline at end of file diff --git a/ublinux/rc.preinit.d/01-depmod b/ublinux/rc.preinit.d/01-depmod new file mode 100755 index 0000000..844f433 --- /dev/null +++ b/ublinux/rc.preinit.d/01-depmod @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Initial script for Linux Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +echo $SYSCONF | grep -q ^/ && SYSCONF=.$SYSCONF +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +[ $(cmdline_parameter depmod) ] && DEPMOD="yes" +[ "$DEPMOD" = "yes" ] && chroot . usr/bin/depmod -a + diff --git a/ublinux/rc.preinit.d/02-modulespreload b/ublinux/rc.preinit.d/02-modulespreload new file mode 100755 index 0000000..eaf4b37 --- /dev/null +++ b/ublinux/rc.preinit.d/02-modulespreload @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Initial script for Linux Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +MODULESPRELOAD="" +BLACKLISTMODULES="$(cmdline_value blacklist | tr ',;' ' ')" +echo ${SYSCONF} | grep -q ^/ && SYSCONF=.${SYSCONF} +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +for a in $(echo $MODULESPRELOAD | tr , " ") ;do + echo " $BLACKLISTMODULES " | grep -q " $a " || chroot . modprobe $a +done + +PFP=etc/modprobe.d/blacklist-ublinux.conf +for a in $BLACKLISTMODULES ;do + grep -q "^blacklist $a$" $PFP || echo "blacklist $a" >> $PFP +done + diff --git a/ublinux/rc.preinit.d/03-ldconfig b/ublinux/rc.preinit.d/03-ldconfig new file mode 100755 index 0000000..570e091 --- /dev/null +++ b/ublinux/rc.preinit.d/03-ldconfig @@ -0,0 +1,14 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +echo $SYSCONF | grep -q ^/ && SYSCONF=.$SYSCONF +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +#[ "$RUNLDCONFIG" = "yes" ] && /usr/bin/ldconfig +chroot . /usr/bin/ldconfig 2>&1 &>/dev/null diff --git a/ublinux/rc.preinit.d/04-update-fonts b/ublinux/rc.preinit.d/04-update-fonts new file mode 100755 index 0000000..602cd11 --- /dev/null +++ b/ublinux/rc.preinit.d/04-update-fonts @@ -0,0 +1,34 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +#. /usr/lib/ublinux/functions +#. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +#for font_dir in /usr/share/fonts{,/default}/TTF /usr/X11R6/lib/X11/fonts/TTF; do +# if [ -d "${font_dir}" ]; then +# fcneed=on +# mkfontscale ${font_dir} +# mkfontdir ${font_dir} +# fi +#done +#[ $fcneed ] && fc-cache -f -s + +for font_dir in usr/share/fonts{,/default}/TTF usr/X11R6/lib/X11/fonts/TTF; do + if [[ -d "${font_dir}" ]]; then + chroot . usr/bin/mkfontscale ${font_dir} + chroot . usr/bin/mkfontdir ${font_dir} + fi +done + +#for font_dir in /usr/share/fonts/*; do +# if [ -d "${font_dir}" ]; then +# xset +fp "${font_dir}" 2>&1 &>/dev/null +# mkfontscale "${font_dir}" +# mkfontdir "${font_dir}" +# fi +#done && xset fp rehash #2>&1 &>/dev/null + +chroot . usr/bin/fc-cache -s 2>&1 &>/dev/null diff --git a/ublinux/rc.preinit.d/10-system b/ublinux/rc.preinit.d/10-system new file mode 100755 index 0000000..bdd28e8 --- /dev/null +++ b/ublinux/rc.preinit.d/10-system @@ -0,0 +1,71 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=. +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +SYSCONF="${ROOTFS}/${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + + #PATHLIVEDATA=$(find /memory/layer-base/*/* -maxdepth 0 -type f -iname "ublinux-data*.sgn" -exec dirname {} \;) + PATHLIVEDATA=$(find /memory/data/from/*/* -maxdepth 0 -type d -iname "ublinux-data" -exec dirname {} \;) + [[ -d ${PATHLIVEDATA} ]] && [[ ! -d ${ROOTFS}/mnt/livedata ]] && ln -sf ${PATHLIVEDATA} ${ROOTFS}/mnt/livedata + + ps | grep ntfsmount | awk '{ print $1 }' >> ${ROOTFS}/var/run/sendsigs.omit + + #Setting up local time zone + [[ -f ${SYSCONF}/clock ]] && . ${SYSCONF}/clock + [[ -f ${ROOTFS}/usr/share/zoneinfo/${ZONE} ]] && ln -sf "/usr/share/zoneinfo/${ZONE}" ${ROOTFS}/etc/localtime + + #Setting machine-id + if [[ ! -f ${ROOTFS}/etc/machine-id ]]; then + echo "${MACHINEID}" | grep -qi ^random$ && MACHINEID=$(dd if=/dev/urandom count=1 bs=512 2>/dev/null | cat - /sys/class/net/*/address 2>/dev/null | md5sum | awk '{ print $1}') + [[ -z "${MACHINEID}" ]] && MACHINEID=$(lspci -nmm | grep ^00 | md5sum | awk '{ print $1}') + echo "${MACHINEID}" > ${ROOTFS}/etc/machine-id + fi + + #Setting UDEV + FILE_UDEV_99="/usr/lib/ublinux/udev/99-hide-partition-ubconfig.rules" + FILE_UDEV_70="/usr/lib/ublinux/udev/70-setup-prn-ubconfig.rules" + mkdir -p ${ROOTFS}/etc/udev/rules.d + ln -sf ${FILE_UDEV_99} ${ROOTFS}/etc/udev/rules.d/ + if [[ ${PRINTERADD} = "auto" ]] ;then + ln -sf ${FILE_UDEV_70} ${ROOTFS}/etc/udev/rules.d/ + else + rm -f "${ROOTFS}/etc/udev/rules.d/${FILE_UDEV_70##*/}" + fi + + ## Setting state mode + STATE_MODE="$(cmdline_value ub.mode)" + STATE_HOME="$(cmdline_value ub.home)" + ## Полное сохранение ub.mode=changes + if [[ ${STATE_MODE} =~ ^"changes"$ ]]; then + echo "SYSTEMBOOT_STATEMODE=changes" >> ${SYSCONF}/config + ## Сохранение в модуль ub.mode=toxzm ub.mode=machines + elif [[ ${STATE_MODE} =~ ^("toxzm"|"machines")$ ]]; then + echo "SYSTEMBOOT_STATEMODE=module" >> ${SYSCONF}/config + ## Полная песочница RAM ub.mode= ; ub.home= + elif [[ ${STATE_MODE} == "" && ${STATE_HOME} == "" ]]; then + echo "SYSTEMBOOT_STATEMODE=sandbox" >> ${SYSCONF}/config + ## Песочница с сохранением профиля пользователя ub.mode= ; ub.home=/ublinux-data/homes + elif [[ ${STATE_MODE} == "" && ${STATE_HOME} =~ ^"/" ]]; then + echo "SYSTEMBOOT_STATEMODE=sandbox_ram_home" >> ${SYSCONF}/config + ## Полная песочница HDD ub.mode=clear ; ub.home= + elif [[ ${STATE_MODE} == "clear" && ${STATE_HOME} == "" ]]; then + echo "SYSTEMBOOT_STATEMODE=sandbox_hdd" >> ${SYSCONF}/config + ## Полная песочница HDD с сохранением профиля пользователя ub.mode=clear ; ub.home= + elif [[ ${STATE_MODE} == "clear" && ${STATE_HOME} =~ ^"/" ]]; then + echo "SYSTEMBOOT_STATEMODE=sandbox_hdd_home" >> ${SYSCONF}/config + fi diff --git a/ublinux/rc.preinit.d/11-partitions b/ublinux/rc.preinit.d/11-partitions new file mode 100755 index 0000000..0918acf --- /dev/null +++ b/ublinux/rc.preinit.d/11-partitions @@ -0,0 +1,114 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +#. usr/lib/ublinux/scripts/liblinuxlive +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +echo $SYSCONF | grep -q ^/ && SYSCONF=.$SYSCONF +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +get_name() +{ + for b in "" $(seq 2 64) ;do + grep -q " /media/$1$b " etc/fstab || break + done + echo $1$b +} + +[ -z "$PARTITIONSMOUNTUID" ] && PARTITIONSMOUNTUID=500 +FSCKFLAG=0 +[ $(cmdline_parameter fsck) ] && FSCKFLAG=2 + +#Find and use swap partition. If not, use window$ swapfile. +if [ "$(cmdline_parameter findswap)" ] ;then + sed -i /FINDSWAP/d etc/fstab + debug_log "Find linux native patitions" + FSWAP=$(blkid -t TYPE="swap" -l | awk -F: '{print $1}') + if [ "$FSWAP" ] ;then + echo "$FSWAP none swap defaults 0 0 #FINDSWAP" >> etc/fstab + else + debug_log "Capturing windows swapfile" + FSWAP=$(find_in_computer /pagefile.sys /$UNION/mnt/windows) + if [ "$FSWAP" ] ;then + if [ -f "$FSWAP" ] ;then + mkswap "$FSWAP" + DSWAP=$(dirname $FSWAP) + DEV=$(grep /$UNION/mnt/windows /proc/mounts | awk '{ print $1 }') + DEVTYPE=$(blkid $DEV -s TYPE | awk -F\" '{print $2}' ) + if [ "$DSWAP" = "/$UNION/mnt/windows" -a -b "$DEV" ] ;then + DEVOPTS=$(fs_options $DEV fstab),uid=$PARTITIONSMOUNTUID + echo "$DEV /mnt/windows $DEVTYPE $DEVOPTS 0 $FSCKFLAG # FINDSWAP" >>etc/fstab + umount /$UNION/mnt/windows 2>/dev/null + fi + echo "$FSWAP none swap defaults 0 0 # FINDSWAP" | sed s-/$UNION-- >> etc/fstab + fi + fi + fi +fi + +#Creating partitions in /etc/fstab +if [ "$TMPFS" == "no" ] ;then + ln -sf /dev/null etc/systemd/system/tmp.mount +fi + + if [ "$VARTMPFS" = "no" -a -h var/tmp ] ;then + rm -f var/tmp 2>/dev/null + mkdir -m 1777 var/tmp + elif [ "$VARTMPFS" != "no" -a ! -h var/tmp ] ;then + rm -fr var/tmp 2>/dev/null + ln -s ../tmp var/tmp + fi +grep -q "tmpfs /media tmpfs" etc/fstab || echo "tmpfs /media tmpfs size=1M 0 0 # AutoUpdate" >>etc/fstab + +if [ "$PARTITIONSAUTOMOUNT" = "yes" ] ;then + sed -i /PARTITIONSAUTOMOUNT/d etc/fstab + blkid | egrep -v "loop|/dev/ram" | grep /dev/ | awk -F: '{ print $1 }' | while read a ; do + grep -q "^$a " etc/fstab && continue + if grep -q "^$a " /proc/mounts ;then + grep -m1 "^$a " /proc/mounts | grep /memory | sed s/$/" #PARTITIONSAUTOMOUNT=yes"/ >> etc/fstab + else + DEVTYPE=$(blkid $a | awk -FTYPE=\" '{print $2}'| sed s/\".*// ) + if [ "$DEVTYPE" != "" -a "$DEVTYPE" != "swap" -a "$DEVTYPE" != "udf" -a "$DEVTYPE" != "iso9660" ] ;then + DEVLABEL=$( blkid $a | awk -FLABEL=\" '{print $2}'| sed s/\".*// | tr -d [:cntrl:][:space:]) + [ -z "$DEVLABEL" ] && DEVLABEL=$(get_name disk) + [ -d media/"$DEVLABEL" ] && DEVLABEL=$(get_name $DEVLABEL) + echo " $PARTITIONSNOMOUNT " | tr ',;' ' ' | grep -q " $DEVLABEL " && continue + DEVOPTS=$(fs_options $a fstab) + [ "$DEVTYPE" = "vfat" -o "$DEVTYPE" = "ntfs" ] && DEVOPTS="$DEVOPTS,uid=$PARTITIONSMOUNTUID" + echo "$a /media/$DEVLABEL $DEVTYPE $DEVOPTS 0 $FSCKFLAG #PARTITIONSAUTOMOUNT=yes" >>etc/fstab + [ -d media/$DEVLABEL ] || mkdir -p media/$DEVLABEL + elif [ "$DEVTYPE" = "swap" ] ;then + grep -q "^$a none swap" etc/fstab || echo "$a none swap defaults 0 0 #PARTITIONSAUTOMOUNT=yes" >>etc/fstab + fi + fi + done +fi + +#Enable compcache if it is needed +#[ "$(grep " swap " etc/fstab)$(echo $SERVICESNOSTART | grep compcache)" = "" ] && chroot . chkconfig --add compcache >/dev/null 2<&1 + +#Exporting partitions +if [ "$PARTITIONSSHARE" = "yes" ];then + for a in $(grep " /media/" etc/fstab | awk '{print $2}' | sed s-/media/--) ;do + grep -q "^/media/$a " etc/exports && continue + echo " $PARTITIONSNOSHARE " | tr ',;' ' ' | grep -q " $a " && continue + echo "/media/$a 192.168.1.0/24(all_squash,anonuid=500,anongid=100,async,secure,no_subtree_check,rw)" >>etc/exports + done +fi + +if [ -d /mnt/livemedia/ublinux-data -a ! -d /mnt/livedata ] ;then + ln -sf livemedia mnt/livedata +fi + +[ "$MNT_BLOCK" = "yes" ] && chmod 600 /mnt diff --git a/ublinux/rc.preinit.d/12-save2module b/ublinux/rc.preinit.d/12-save2module new file mode 100755 index 0000000..48665c2 --- /dev/null +++ b/ublinux/rc.preinit.d/12-save2module @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +. usr/lib/ublinux/functions +debug_mode "$0" "$@" + +if [ $(cmdline_value savelist) ] ;then + echo -ne .savelist + for a in $(cmdline_value savelist | tr , " " ) ;do + echo $a >>.savelist + done +fi + diff --git a/ublinux/rc.preinit.d/13-release b/ublinux/rc.preinit.d/13-release new file mode 100755 index 0000000..28ae374 --- /dev/null +++ b/ublinux/rc.preinit.d/13-release @@ -0,0 +1,29 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[[ ${ENABLED} == "yes" ]] || exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no + +[ -d ${ROOTFS}usr/lib/ublinux ] || ROOTFS=/ +. ${ROOTFS}usr/lib/ublinux/functions + +debug_mode "$0" "$@" + +PATH_LIB_UBBOOT="${ROOTFS}usr/lib/ubboot" + +#Profile updating +OS_RELEASE_PRETTY_NAME="UBLinux 0000 Unknown (x)" +PATH_VERSION=$(ls /memory/layer-base/0/VERSION* 2>/dev/null | head -1) +[[ -n "${PATH_VERSION}" ]] || PATH_VERSION="$(ls /VERSION* 2>/dev/null | head -1)" +[[ -n "${PATH_VERSION}" ]] && OS_RELEASE_PRETTY_NAME=$(head -1 "${PATH_VERSION}" 2>/dev/null ) + +echo "${OS_RELEASE_PRETTY_NAME}" > ${ROOTFS}etc/ublinux-release +${PATH_LIB_UBBOOT}/ubdistconv -l ${OS_RELEASE_PRETTY_NAME} > ${ROOTFS}etc/lsb-release +${PATH_LIB_UBBOOT}/ubdistconv -o ${OS_RELEASE_PRETTY_NAME} > ${ROOTFS}usr/lib/os-release diff --git a/ublinux/rc.preinit.d/20-services b/ublinux/rc.preinit.d/20-services new file mode 100755 index 0000000..de92887 --- /dev/null +++ b/ublinux/rc.preinit.d/20-services @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +echo $SYSCONF | grep -q ^/ && SYSCONF=.$SYSCONF +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +[ -z "$(cmdline_value servicesstart)" ] || SERVICESSTART=$(cmdline_value servicesstart) +[ -z "$(cmdline_value servicesnostart)" ] || SERVICESNOSTART=$(cmdline_value servicesnostart) + +if [ ! -z "$SERVICESSTART$SERVICESNOSTART$SERVICESMASK$SERVICESUNMASK" ] ;then + mkdir -p proc + mount -o rbind /proc proc + ISSYSTEMD=$(readlink -fq usr/bin/init | grep /lib/systemd/systemd) + for a in $(echo $SERVICESUNMASK,$SERVICESSTART | tr , " ") ;do + [ $ISSYSTEMD ] && chroot . systemctl unmask $a + done + for a in $(echo $SERVICESSTART | tr , " ") ;do + if [ $ISSYSTEMD ] ;then + chroot . systemctl enable $a || true + else + true + fi + done + for a in $(echo $SERVICESNOSTART | tr , " ") ;do + if [ $ISSYSTEMD ] ;then + chroot . systemctl disable $a || true + else + true + fi + done + for a in $(echo $SERVICESMASK | tr , " ") ;do + [ $ISSYSTEMD ] && chroot . systemctl disable $a + [ $ISSYSTEMD ] && chroot . systemctl mask $a + done + umount proc +fi diff --git a/ublinux/rc.preinit.d/21-ntp b/ublinux/rc.preinit.d/21-ntp new file mode 100755 index 0000000..fbe7552 --- /dev/null +++ b/ublinux/rc.preinit.d/21-ntp @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=. + +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +SYSCONF="${ROOTFS}/${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/network; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + +NTPSERVERS_DEFAULT="ntp1.vniiftri.ru ntp2.vniiftri.ru ntp3.vniiftri.ru ntp4.vniiftri.ru ntp21.vniiftri.ru ru.pool.ntp.org" +NTPSERVERS_FALLBACK="0.ru.pool.ntp.org 1.ru.pool.ntp.org 2.ru.pool.ntp.org 3.ru.pool.ntp.org" + + [[ -n $1 ]] && NTPSERVERS=$1 + if [[ -n ${NTPSERVERS} && ${NTPSERVERS,,} != "dhcp" ]]; then + [[ ${NTPSERVERS,,} == "default" ]] && NTPSERVERS=${NTPSERVERS_DEFAULT} + mkdir -p ${ROOTFS}/etc/systemd/timesyncd.conf.d + echo "[Time]" > ${ROOTFS}/etc/systemd/timesyncd.conf.d/ubconfig.conf + echo "NTP=${NTPSERVERS}" | tr ',;' ' ' >> ${ROOTFS}/etc/systemd/timesyncd.conf.d/ubconfig.conf + echo "FallbackNTP=${NTPSERVERS_FALLBACK}" >> ${ROOTFS}/etc/systemd/timesyncd.conf.d/ubconfig.conf + fi diff --git a/ublinux/rc.preinit.d/22-samba b/ublinux/rc.preinit.d/22-samba new file mode 100755 index 0000000..1e314e1 --- /dev/null +++ b/ublinux/rc.preinit.d/22-samba @@ -0,0 +1,46 @@ +#!/usr/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=. + +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +SYSCONF="${ROOTFS}/${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/network; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + +if [[ -n ${ADSERVER} && -n ${DOMAIN} ]]; then + [[ -z ${KERBEROS_REALM} ]] && KERBEROS_REALM=${DOMAIN^^} + [[ -z ${SAMBADOMAIN} ]] && SAMBADOMAIN=$(echo ${KERBEROS_REALM} | awk -F . '{print $1}') + + sed -i s/kerberos.ublinux.ru/$ADSERVER/ etc/krb5.conf + sed -i s/LOCAL.UBLINUX.RU/$KERBEROS_REALM/ etc/krb5.conf + sed -i s/local.ublinux.ru/$DOMAIN/ etc/krb5.conf + + sed -i '/realm =/d' etc/samba/smb.conf + sed -i '/security =/d' etc/samba/smb.conf + sed -i '/password server =/d' etc/samba/smb.conf + sed -i '/\[global\]/ s/$/'"\n realm = ${KERBEROS_REALM}\n security = ADS\n password server = ${ADSERVER}"/ etc/samba/smb.conf + + + sed -i s/'^passwd:.*$'/'passwd: files winbind'/ etc/nsswitch.conf + sed -i s/'^shadow:.*$'/'shadow: files winbind'/ etc/nsswitch.conf + sed -i s/'^group:.*$'/'group: files winbind'/ etc/nsswitch.conf + cp -pf etc/pam.d/system-auth-krb etc/pam.d/system-auth +fi + +if [[ -n "${SAMBADOMAIN}" ]]; then + sed -i s/"workgroup = .*"/"workgroup = ${SAMBADOMAIN}"/ etc/samba/smb.conf + sed -i s/"^NT_DOMAIN=.*"/"NT_DOMAIN=${SAMBADOMAIN}"/ etc/ntlmaps.cfg +fi diff --git a/ublinux/rc.preinit.d/23-realmd b/ublinux/rc.preinit.d/23-realmd new file mode 100755 index 0000000..adbc502 --- /dev/null +++ b/ublinux/rc.preinit.d/23-realmd @@ -0,0 +1,46 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=. + +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +SYSCONF="${ROOTFS}/${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/network; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + +# [[ -z ${KERBEROS_REALM} ]] && KERBEROS_REALM=${DOMAIN^^} +# [[ -z ${SAMBADOMAIN} ]] && SAMBADOMAIN=$(echo ${KERBEROS_REALM} | awk -F . '{print $1}') + +# sed -i s/kerberos.ublinux.ru/$ADSERVER/ etc/krb5.conf +# sed -i s/LOCAL.UBLINUX.RU/$KERBEROS_REALM/ etc/krb5.conf +# sed -i s/local.ublinux.ru/$DOMAIN/ etc/krb5.conf +# +# sed -i '/realm =/d' etc/samba/smb.conf +# sed -i '/security =/d' etc/samba/smb.conf +# sed -i '/password server =/d' etc/samba/smb.conf +# sed -i '/\[global\]/ s/$/'"\n realm = ${KERBEROS_REALM}\n security = ADS\n password server = ${ADSERVER}"/ etc/samba/smb.conf +# +# + +#if [[ -n "${SAMBADOMAIN}" ]]; then +# sed -i s/"workgroup = .*"/"workgroup = ${SAMBADOMAIN}"/ etc/samba/smb.conf +# sed -i s/"^NT_DOMAIN=.*"/"NT_DOMAIN=${SAMBADOMAIN}"/ etc/ntlmaps.cfg +#fi + if [[ -n ${DOMAIN} && ${DOMAIN[client]} == "realmd_sssd" ]]; then + if [[ -f ${ROOTFS}/etc/krb5.keytab ]]; then + [[ -f etc/krb5.conf && -f sssd/sssd.conf ]] || chroot . usr/bin/ubdomain-client -q configure 2>/dev/null + [[ -f ${ROOTFS}/usr/lib/systemd/system/sssd.service ]] && ln -sf /usr/lib/systemd/system/sssd.service ${ROOTFS}/etc/systemd/system/multi-user.target.wants/sssd.service + fi + fi diff --git a/ublinux/rc.preinit.d/30-network b/ublinux/rc.preinit.d/30-network new file mode 100755 index 0000000..f7ecbc4 --- /dev/null +++ b/ublinux/rc.preinit.d/30-network @@ -0,0 +1,98 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +HOSTNAME=ublinux-live +unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=. + +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +SYSCONF="${ROOTFS}/${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/network; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + + + echo "127.0.0.1 sb-ssl.l.google.com safebrowsing.clients.google.com safebrowsing.cache.l.google.com" >> etc/hosts + grep -q "127\.0\.0\.1\s{1,}${HOSTNAME%%.*}\s*$" etc/hosts || echo "127.0.0.1 ${HOSTNAME%%.*}" >> etc/hosts + if [[ ${DOMAIN} != "" ]]; then + HOSTNAME="${HOSTNAME%%.*}.${DOMAIN}" + grep -q "127\.0\.0\.1\s{1,}${HOSTNAME}\s*$" etc/hosts || echo "127.0.0.1 ${HOSTNAME}" >> etc/hosts + ## Указать доменных пользователей AccountsService, что-бы были видны для выбора логина в DM + ls -d home/*@*/ 2>/dev/null | xargs -ri basename {} | xargs -ri touch var/lib/AccountsService/users/{} + ## Домен для сервера dhcpd + sed -i s/"option domain-name .*"/"option domain-name \"${DOMAIN}\";"/g etc/dhcpd.conf + sed -i s/"option nis-domain .*"/"option nis-domain \"${DOMAIN}\";"/g etc/dhcpd.conf + ## Имя хоста записать в конфиг с постфиксом домена + sed -i /^HOSTNAME=/d etc/ublinux/config + echo "HOSTNAME=${HOSTNAME}" >> etc/ublinux/config + fi + echo "${HOSTNAME}" > etc/hostname + + +#if [ "$UBLINUXSERVER" != "" ] ;then +# sed -i s/.*ublinux-server.*/"$UBLINUXSERVER UBLinux-Server"/ etc/hosts +# sed -i s/192.168.1.31/$UBLINUXSERVER/g etc/dhcpd.conf +#fi +#if [ "$NETWORKIP" != "" ] ;then +# sed -i s/192.168.1./$NETWORKIP/g etc/dhcpd.conf +# sed -i s/192.168.1./$NETWORKIP/g etc/pdnsd.conf +# sed -i s/192.168.1./$NETWORKIP/g etc/samba/smb.conf +# sed -i s/192.168.1.0/${NETWORKIP}0/g etc/exports +# sed -i s/192.168.1.0/${NETWORKIP}0/g etc/polipo/config +# sed -i s/192.168.1.0/${NETWORKIP}0/g etc/ntp.conf +# sed -i s/192.168.1.0/${NETWORKIP}0/g etc/ublinux/iptables +#fi + + ## Указать системные прокси + if [[ -n ${HTTP_PROXY} ]]; then + echo "setenv http_proxy $HTTP_PROXY" > etc/profile.d/proxy.csh + echo "setenv https_proxy $HTTPS_PROXY" >> etc/profile.d/proxy.csh + echo "http_proxy=$HTTP_PROXY" > etc/profile.d/proxy.sh + echo "https_proxy=$HTTPS_PROXY" >> etc/profile.d/proxy.sh + echo "export http_proxy https_proxy" >> etc/profile.d/proxy.sh + fi + if [[ -n ${FTP_PROXY} ]]; then + echo "setenv ftp_proxy $FTP_PROXY" >> etc/profile.d/proxy.csh + echo "ftp_proxy=$FTP_PROXY" >> etc/profile.d/proxy.sh + echo "export ftp_proxy" >> etc/profile.d/proxy.sh + fi + if [[ -n ${NO_PROXY} ]]; then + echo "setenv no_proxy $NO_PROXY" >> etc/profile.d/proxy.csh + echo "no_proxy=$NO_PROXY" >> etc/profile.d/proxy.sh + echo "export no_proxy" >> etc/profile.d/proxy.sh + fi + [[ -n ${HTTP_PROXY} || -n ${FTP_PROXY} || -n ${NO_PROXY} ]] && chmod 755 etc/profile.d/proxy.sh etc/profile.d/proxy.csh + + ## Режим полного WiFi радио молчания + if [ "$(cmdline_parameter flightmode)" ] ;then + for a in etc/ublinux/network-scripts/ifcfg-w* ;do + sed -i s/ONBOOT=yes/ONBOOT=no/ $a 2>/dev/null + done + chroot . /usr/bin/rfkill block all + [ "$BLOCKWPASS" = "yes" -a -f usr/lib/systemd/system/wpa_supplicant.service ] && ln -sf /dev/null etc/systemd/system/wpa_supplicant.service + fi + + if [ "$IPV6" = "yes" ] ;then + sed -i /ipv4/d usr/lib/systemd/network/90-enable.network 2>/dev/null + sed -i /ipv4/d usr/lib/systemd/network/90-wireless.network 2>/dev/null + sed -i /ipv6/d etc/modprobe.d/ublinux.conf 2>/dev/null + elif [ "$IPV6" = "no" ] ;then + sed -i /ipv4/d usr/lib/systemd/network/90-enable.network 2>/dev/null + sed -i /ipv4/d usr/lib/systemd/network/90-wireless.network 2>/dev/null + sed -i /ipv6/d etc/modprobe.d/ublinux.conf 2>/dev/null + echo "options ipv6 disable=1" >> etc/modprobe.d/ublinux.conf + echo "DHCP=ipv4" >> usr/lib/systemd/network/90-enable.network + echo "DHCP=ipv4" >> usr/lib/systemd/network/90-wireless.network + fi + diff --git a/ublinux/rc.preinit.d/31-iptables b/ublinux/rc.preinit.d/31-iptables new file mode 100755 index 0000000..bacf331 --- /dev/null +++ b/ublinux/rc.preinit.d/31-iptables @@ -0,0 +1,45 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +echo $SYSCONF | grep -q ^/ && SYSCONF=.$SYSCONF +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +[ -z "$IPTABLESTRUSTEDIP" ] || sed -i s-192.168.1.0/24-$IPTABLESTRUSTEDIP- etc/exports +[ -z "$IPTABLESTRUSTEDIP" ] && sed -i s_"^\[.*-A INPUT -s .* -j ACCEPT.*"_'#[0:0] -A INPUT -s $IPTABLESTRUSTEDIP -j ACCEPT'_ etc/ublinux/iptables +[ -z "$IPTABLESTRUSTEDIP" ] || sed -i s_".*-A INPUT -s .* -j ACCEPT.*"_"[0:0] -A INPUT -s $IPTABLESTRUSTEDIP -j ACCEPT"_ etc/ublinux/iptables +[ -z "$IPTABLESOPENPORTSTCP" ] && sed -i s_"^\[.*-A INPUT -p tcp -m multiport --dport.*-j ACCEPT.*"_'#[0:0] -A INPUT -p tcp -m multiport --dport $IPTABLESOPENPORTSTCP -j ACCEPT'_ etc/ublinux/iptables +[ -z "$IPTABLESOPENPORTSTCP" ] || sed -i s_".*-A INPUT -p tcp -m multiport --dport.*-j ACCEPT.*"_"[0:0] -A INPUT -p tcp -m multiport --dport $IPTABLESOPENPORTSTCP -j ACCEPT"_ etc/ublinux/iptables +[ -z "$IPTABLESOPENPORTSUDP" ] && sed -i s_"^\[.*-A INPUT -p udp -m multiport --dport.*-j ACCEPT.*"_'#[0:0] -A INPUT -p udp -m multiport --dport $IPTABLESOPENPORTSUDP -j ACCEPT'_ etc/ublinux/iptables +[ -z "$IPTABLESOPENPORTSUDP" ] || sed -i s_".*-A INPUT -p udp -m multiport --dport.*-j ACCEPT.*"_"[0:0] -A INPUT -p udp -m multiport --dport $IPTABLESOPENPORTSUDP -j ACCEPT"_ etc/ublinux/iptables +if [ -z "$TORUSERS" ] ;then + sed -i s_"^\[.* -A OUTPUT -d 192.168.1.0/16 -m owner --uid-owner .* -j RETURN.*"_'#TOR#[0:0] -A OUTPUT -d 192.168.1.0/16 -m owner --uid-owner $TORUSERS -j RETURN'_ etc/ublinux/iptables + sed -i s_"^\[.*-A OUTPUT -p udp -m owner --uid-owner .* -j DNAT --to-destination 127.0.0.1:5353.*"_'#TOR#[0:0] -A OUTPUT -p udp -m owner --uid-owner $TORUSERS -j DNAT --to-destination 127.0.0.1:5353'_ etc/ublinux/iptables + sed -i s_"^\[.*-A OUTPUT -p tcp -m owner --uid-owner .* -j DNAT --to-destination 127.0.0.1:9040.*"_'#TOR#[0:0] -A OUTPUT -p tcp -m owner --uid-owner $TORUSERS -j DNAT --to-destination 127.0.0.1:9040'_ etc/ublinux/iptables +else + sed -i s_".*-A OUTPUT -d 192.168.1.0/16 -m owner --uid-owner .* -j RETURN.*"_"[0:0] -A OUTPUT -d 192.168.1.0/16 -m owner --uid-owner $TORUSERS -j RETURN"_ etc/ublinux/iptables + sed -i s_".*-A OUTPUT -p udp -m owner --uid-owner .* -j DNAT --to-destination 127.0.0.1:5353.*"_"[0:0] -A OUTPUT -p udp -m owner --uid-owner $TORUSERS -j DNAT --to-destination 127.0.0.1:5353"_ etc/ublinux/iptables + sed -i s_".*-A OUTPUT -p tcp -m owner --uid-owner .* -j DNAT --to-destination 127.0.0.1:9040.*"_"[0:0] -A OUTPUT -p tcp -m owner --uid-owner $TORUSERS -j DNAT --to-destination 127.0.0.1:9040"_ etc/ublinux/iptables +fi +if [ "$ROUTER" = "yes" ] ;then + sed -i s/".* -A POSTROUTING -j MASQUERADE.*"/'[0:0] -A POSTROUTING -j MASQUERADE'/ etc/ublinux/iptables + PFP=etc/sysctl.conf + [ -f $PFP ] || PFP=etc/sysctl.d/ublinux.conf + sed -i /net.ipv4.ip_forward/d $PFP + echo "net.ipv4.ip_forward = 1" >>$PFP + sed -i '/-A FORWARD -i eth0 -o eth0 -j DROP/d' etc/ublinux/iptables +else + sed -i s/"^\[.* -A POSTROUTING -j MASQUERADE.*"/'#ROUTER#[0:0] -A POSTROUTING -j MASQUERADE'/ etc/ublinux/iptables +fi diff --git a/ublinux/rc.preinit.d/31-ufw b/ublinux/rc.preinit.d/31-ufw new file mode 100755 index 0000000..06aee32 --- /dev/null +++ b/ublinux/rc.preinit.d/31-ufw @@ -0,0 +1,50 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +echo $SYSCONF | grep -q ^/ && SYSCONF=.$SYSCONF +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +#[ -z "$IPTABLESTRUSTEDIP" ] || sed -i s-192.168.1.0/24-$IPTABLESTRUSTEDIP- etc/exports +#[ -z "$IPTABLESTRUSTEDIP" ] && sed -i s_"^\[.*-A INPUT -s .* -j ACCEPT.*"_'#[0:0] -A INPUT -s $IPTABLESTRUSTEDIP -j ACCEPT'_ etc/ublinux/iptables +#[ -z "$IPTABLESTRUSTEDIP" ] || sed -i s_".*-A INPUT -s .* -j ACCEPT.*"_"[0:0] -A INPUT -s $IPTABLESTRUSTEDIP -j ACCEPT"_ etc/ublinux/iptables +#[ -z "$IPTABLESOPENPORTSTCP" ] && sed -i s_"^\[.*-A INPUT -p tcp -m multiport --dport.*-j ACCEPT.*"_'#[0:0] -A INPUT -p tcp -m multiport --dport $IPTABLESOPENPORTSTCP -j ACCEPT'_ etc/ublinux/iptables +#[ -z "$IPTABLESOPENPORTSTCP" ] || sed -i s_".*-A INPUT -p tcp -m multiport --dport.*-j ACCEPT.*"_"[0:0] -A INPUT -p tcp -m multiport --dport $IPTABLESOPENPORTSTCP -j ACCEPT"_ etc/ublinux/iptables +#[ -z "$IPTABLESOPENPORTSUDP" ] && sed -i s_"^\[.*-A INPUT -p udp -m multiport --dport.*-j ACCEPT.*"_'#[0:0] -A INPUT -p udp -m multiport --dport $IPTABLESOPENPORTSUDP -j ACCEPT'_ etc/ublinux/iptables +#[ -z "$IPTABLESOPENPORTSUDP" ] || sed -i s_".*-A INPUT -p udp -m multiport --dport.*-j ACCEPT.*"_"[0:0] -A INPUT -p udp -m multiport --dport $IPTABLESOPENPORTSUDP -j ACCEPT"_ etc/ublinux/iptables +#if [ -z "$TORUSERS" ] ;then +# sed -i s_"^\[.* -A OUTPUT -d 192.168.1.0/16 -m owner --uid-owner .* -j RETURN.*"_'#TOR#[0:0] -A OUTPUT -d 192.168.1.0/16 -m owner --uid-owner $TORUSERS -j RETURN'_ etc/ublinux/iptables +# sed -i s_"^\[.*-A OUTPUT -p udp -m owner --uid-owner .* -j DNAT --to-destination 127.0.0.1:5353.*"_'#TOR#[0:0] -A OUTPUT -p udp -m owner --uid-owner $TORUSERS -j DNAT --to-destination 127.0.0.1:5353'_ etc/ublinux/iptables +# sed -i s_"^\[.*-A OUTPUT -p tcp -m owner --uid-owner .* -j DNAT --to-destination 127.0.0.1:9040.*"_'#TOR#[0:0] -A OUTPUT -p tcp -m owner --uid-owner $TORUSERS -j DNAT --to-destination 127.0.0.1:9040'_ etc/ublinux/iptables +#else +# sed -i s_".*-A OUTPUT -d 192.168.1.0/16 -m owner --uid-owner .* -j RETURN.*"_"[0:0] -A OUTPUT -d 192.168.1.0/16 -m owner --uid-owner $TORUSERS -j RETURN"_ etc/ublinux/iptables +# sed -i s_".*-A OUTPUT -p udp -m owner --uid-owner .* -j DNAT --to-destination 127.0.0.1:5353.*"_"[0:0] -A OUTPUT -p udp -m owner --uid-owner $TORUSERS -j DNAT --to-destination 127.0.0.1:5353"_ etc/ublinux/iptables +# sed -i s_".*-A OUTPUT -p tcp -m owner --uid-owner .* -j DNAT --to-destination 127.0.0.1:9040.*"_"[0:0] -A OUTPUT -p tcp -m owner --uid-owner $TORUSERS -j DNAT --to-destination 127.0.0.1:9040"_ etc/ublinux/iptables +#fi +#if [ "$ROUTER" = "yes" ] ;then +# sed -i s/".* -A POSTROUTING -j MASQUERADE.*"/'[0:0] -A POSTROUTING -j MASQUERADE'/ etc/ublinux/iptables +# PFP=etc/sysctl.conf +# [ -f $PFP ] || PFP=etc/sysctl.d/ublinux.conf +# sed -i /net.ipv4.ip_forward/d $PFP +# echo "net.ipv4.ip_forward = 1" >>$PFP +# sed -i '/-A FORWARD -i eth0 -o eth0 -j DROP/d' etc/ublinux/iptables +#else +# sed -i s/"^\[.* -A POSTROUTING -j MASQUERADE.*"/'#ROUTER#[0:0] -A POSTROUTING -j MASQUERADE'/ etc/ublinux/iptables +#fi + +# Сделать: +# Для ufw найти как добавить, что-бы в /etc/ufw/before.rules перед строчкой -A ufw-before-input -j ufw-not-local вставить: +# -A ufw-before-output -m owner --uid-owner tor -p tcp -j ACCEPT +# diff --git a/ublinux/rc.preinit.d/40-authpam b/ublinux/rc.preinit.d/40-authpam new file mode 100755 index 0000000..8c10f04 --- /dev/null +++ b/ublinux/rc.preinit.d/40-authpam @@ -0,0 +1,43 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=. + +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +SYSCONF="${ROOTFS}/${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + + [[ -n $1 && -n $2 ]] && AUTHPAM[$1]="$2" + if [[ -n ${AUTHPAM[@]} && ${AUTHPAM[@],,} != "disable" && ${AUTHPAM} != "-" && ${AUTHPAM,} != "no" && ${AUTHPAM,,} != "off" ]]; then + AUTHPAM_PROFILE=$(grep -h '^AUTHPAM\[' ${ROOTFS}/usr/lib/ublinux/os-config ${ROOTFS}/etc/ublinux/config | tail -1 | sed -E 's/AUTHPAM\[([a-z]*)\].*/\1/') #' + PROFILE_FEATURE=$(tr ',;' " " <<< ${AUTHPAM[${AUTHPAM_PROFILE}]}) + chroot . /usr/bin/authselect select ${AUTHPAM_PROFILE} ${PROFILE_FEATURE} --force --nobackup --quiet + fi + +# if [[ -n ${AUTHPAM[@]} && ${AUTHPAM[@],,} != "disable" && ${AUTHPAM} != "-" && ${AUTHPAM,} != "no" && ${AUTHPAM,,} != "off" && ${SYSTEMBOOT_STATEMODE,,} =~ ^"sandbox" ]]; then +# [[ ${#AUTHPAM[@]} -gt 1 ]] && unset AUTHPAM[minimal] +# for AUTHPAM_PROFILE in "${!AUTHPAM[@]}"; do +# AUTHPAM_CURRENT_PROFILE=$(authselect current --raw) +# [[ $? != 0 ]] && unset AUTHPAM_CURRENT_PROFILE +# read -a AUTHPAM_CURRENT_PROFILE <<< ${AUTHPAM_CURRENT_PROFILE} +# PROFILE_FEATURE=$(tr ',;' " " <<< ${AUTHPAM[${AUTHPAM_PROFILE}]}) +# if [[ -z ${AUTHPAM_CURRENT_PROFILE} ]]; then +# authselect select ${AUTHPAM_PROFILE} ${PROFILE_FEATURE} --force --nobackup --quiet +# else +# if [[ ${AUTHPAM_PROFILE} == ${AUTHPAM_CURRENT_PROFILE[0]} ]]; then +# authselect enable-feature ${PROFILE_FEATURE} --force --nobackup --quiet +# else +# authselect select ${AUTHPAM_PROFILE} ${PROFILE_FEATURE} --force --nobackup --quiet +# fi +# +# fi +# done +# fi diff --git a/ublinux/rc.preinit.d/50-xorg b/ublinux/rc.preinit.d/50-xorg new file mode 100755 index 0000000..96b9ed5 --- /dev/null +++ b/ublinux/rc.preinit.d/50-xorg @@ -0,0 +1,235 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +LINKATI=/etc/ld.so.conf.d/GL/standard.conf +LINKNVIDIA96=/etc/nvidia96xx/ld.so.conf +LINKNVIDIA173=/etc/nvidia173/ld.so.conf +LINKNVIDIA304=/etc/nvidia304/ld.so.conf +LINKNVIDIA340=/etc/nvidia340/ld.so.conf +LINKNVIDIA360=/etc/nvidia360/ld.so.conf +LINKNVIDIACUR=/etc/nvidia-current/ld.so.conf +LINKFBDEV=/etc/ld.so.conf.d/GL/standard.conf +NVIDIATEST="nvidia-current nvidia340 nvidia304 nvidia" +FAILSAFENVIDIA=nouveau +CREATE_XORG_CONF=yes +GLLDCONFIG=yes +BUMBLEBEE=no +OPTIRUN= +PRIMUSRUN= +VGABUSID= +INTEGRATEDVGA=yes +SORTOPT= +XFILE=etc/X11/xorg.conf +DELETE_XORG_CONF=no + +DEBUGMODE=no +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +[ -f /memory/changes/etc/ld.so.cache ] && GLLDCONFIG=no +[ -f /memory/changes/etc/X11/xorg.conf ] && CREATE_XORG_CONF=no + +# forcing modes=auto for xorg.conf +#grep -q XORG_RES etc/ublinux/config || echo XORG_RES=auto >>etc/ublinux/config + +# reading last hw data VGAID CARDID XDRIVER +. $HARDCONF +# reading all values from etc/ublinux/config +echo $SYSCONF | grep -q ^/ && SYSCONF=.$SYSCONF +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/video; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +# cmdline parameter has the highest priority +CLXD=$(cmdline_value xdriver) +if [ "$CLXD" ] ;then + if [ "$CLXD" != "$XDRIVER" -a "$XDRIVER" ];then + unset VGAID VGAVEN DELETE_XORG_CONF VGABUSID + [ -f $XFILE ] && mv $XFILE $XFILE.$XDRIVER.bak + CREATE_XORG_CONF=yes && GLLDCONFIG=yes + fi + XDRIVER=$CLXD +fi + +# auto detecting hadware +[ "$INTEGRATEDVGA" != "yes" ] && SORTOPT='-r' +# scan all vga cards +NUM=$(lspci -nmm | sed s/"Class "// | grep -c '[.]. "0300"') +# using VGABUSID if specified +[ "$VGABUSID" ] && CARD=$(lspci -nmm | sed s/"Class "// | grep ^"$VGABUSID" | head -n1) +# trying to find VGA card for specidied XDRIVER +[ -z "$CARD" -a "$XDRIVER" = "intel" ] && CARD=$(lspci -nmm | sed s/"Class "// | grep '0300" "8086"' | sort $SORTOPT | head -n1) +[ -z "$CARD" -a "$XDRIVER" = "ati" ] && CARD=$(lspci -nmm | sed s/"Class "// | grep '0300" "1002"' | sort $SORTOPT | head -n1) +[ -z "$CARD" -a "$XDRIVER" = "nouveau" ] && CARD=$(lspci -nmm | sed s/"Class "// | grep '0300" "10de"' | sort $SORTOPT | head -n1) +echo "$XDRIVER" | grep -q nvidia && [ -z "$CARD" ] && CARD=$(lspci -nmm | sed s/"Class "// | grep '0300" "10de"' | sort $SORTOPT | head -n1) +# if card are not found we are getting first/last card (it depends of INTEGRATEDVGA) +[ -z "$CARD" ] && CARD=$(lspci -nmm | sed s/"Class "// | grep '[.]. "0300"' | sort $SORTOPT | head -n1) + +PCIID=$(echo $CARD | awk -F\" '{print $6}') +PCIVEN=$(echo $CARD | awk -F\" '{print $4}') + +# in case video was changed +if [ "$PCIID" != "$VGAID" -a "$VGAID" ] ;then + [ -f $XFILE ] && mv $XFILE $XFILE.$VGAVEN:$VGAID.bak + unset VGAID VGAVEN DELETE_XORG_CONF VGABUSID + CREATE_XORG_CONF=yes && GLLDCONFIG=yes + XDRIVER=$CLXD +fi + +# deleting xorg.conf when xdriver=xorg specified +[ "$XDRIVER" = "xorg" ] && DELETE_XORG_CONF=yes && CREATE_XORG_CONF=no && XDRIVER= + +# setting VGABUSID only on multicard hardware +[ "$NUM" != "1" ] && VGABUSID=$(echo $CARD | awk '{print $1}') + +# looking exceptions +if [ -z "$XDRIVER" ] ; then + XDRIVER=$(grep -im1 ^$PCIVEN:$PCIID usr/share/ublinux/hwdata/xdriver/* | awk -F: '{print $1}') + [ -z "$XDRIVER" ] || XDRIVER=$(basename $XDRIVER) +fi + +# detecting XDRIVER +if [ -z "$XDRIVER" ] ; then + [ "$PCIVEN" = "8086" ] && XDRIVER=intel + [ "$PCIVEN" = "1002" ] && XDRIVER=ati + [ "$PCIVEN" = "10de" ] && XDRIVER=nvidia +fi + +# testing nonfree nvidia modules (nvidia-current nvidia340 nvidia304 nvidia) +if echo "$XDRIVER" | grep -q "nvidia" ;then + XDRIVERTESTED= + XDRIVERCURRENT=$XDRIVER + [ "$XDRIVER" = "nvidia" ] && XDRIVERCURRENT= + for a in $XDRIVERCURRENT $NVIDIATEST ;do + chroot . modprobe $a + lsmod | grep -q nvidia && XDRIVERTESTED=$a + [ -z "$XDRIVERTESTED" ] || break + done + [ -z "$XDRIVERTESTED" ] || XDRIVER=$XDRIVERTESTED + # nouveau driver + [ -z "$XDRIVERTESTED" ] && XDRIVER=$FAILSAFENVIDIA +fi + +# storing data in config file +if [ ! -z "$XDRIVER" ] ;then + sed -i /^XDRIVER=/d $HARDCONF + sed -i /^VGAID=/d $HARDCONF + sed -i /^VGAVEN=/d $HARDCONF + sed -i /^VGABUSID=/d $HARDCONF + sed -i /DELETE_XORG_CONF=/d $HARDCONF + echo XDRIVER=$XDRIVER >> $HARDCONF + echo VGAID=$PCIID >> $HARDCONF + echo VGAVEN=$PCIVEN >> $HARDCONF + [ "$DELETE_XORG_CONF" = "yes" ] && echo DELETE_XORG_CONF=yes >> $HARDCONF + [ "$VGABUSID" ] && echo VGABUSID=$VGABUSID >> $HARDCONF +fi + +# removing blocking conflict modules if its forced +[ "$XDRIVER" = "nouveau" ] && sed -i /^blacklist.*nouveau/d etc/modprobe.d/blacklist-ublinux.conf +echo "$XDRIVER" | grep -q "nvidia" && sed -i /^blacklist.*nvidia/d etc/modprobe.d/blacklist-ublinux.conf + +# first run ldconfig tweak +if [ "$GLLDCONFIG" = "yes" ] ;then + LINK=$LINKFBDEV + [ "$XDRIVER" = "ati" ] && LINK=$LINKATI + [ "$XDRIVER" = "nvidia" -o "$XDRIVER" = "nvidia-current" ] && LINK=$LINKNVIDIACUR + [ "$XDRIVER" = "nvidia96" ] && LINK=$LINKNVIDIA96 + [ "$XDRIVER" = "nvidia173" ] && LINK=$LINKNVIDIA173 + [ "$XDRIVER" = "nvidia304" ] && LINK=$LINKNVIDIA304 + [ "$XDRIVER" = "nvidia340" ] && LINK=$LINKNVIDIA340 + [ "$XDRIVER" = "nvidia360" ] && LINK=$LINKNVIDIA360 + [ -x 'usr/sbin/alternatives' ] && chroot . /usr/sbin/alternatives --set gl_conf $LINK >/dev/null 2>&1 + LDCACHE=$XDRIVER + [ -z "$LDCACHE" -o ! -d usr/share/ublinux/ld.so.cache/$LDCACHE ] && LDCACHE=fbdev + [ -d "usr/share/ublinux/ld.so.cache/$LDCACHE" ] && cp -pfR usr/share/ublinux/ld.so.cache/$LDCACHE/* ./ +fi + +# create or delete xorg.conf +if [ "$DELETE_XORG_CONF" = "yes" ] ;then + rm -f etc/X11/xorg.conf +else + if [ "$CREATE_XORG_CONF" = "yes" ] ;then + [ ! -z "$XDRIVER" -a -d usr/share/ublinux/xorg/$XDRIVER ] && cp -pfR usr/share/ublinux/xorg/$XDRIVER/* etc/X11 + [ -d usr/share/ublinux/xorg/$PCIVEN ] && cp -pfR usr/share/ublinux/xorg/$PCIVEN/* etc/X11 + [ -d usr/share/ublinux/xorg/$PCIVEN$PCIID ] && cp -pfR usr/share/ublinux/xorg/$PCIVEN$PCIID/* etc/X11 + fi +fi + +# bumblebee service for nvidia optimus card +[ "$XDRIVER" = "intel" ] && lspci -nmm | sed s/"Class "// | grep -q '"0302" "10de"' && BUMBLEBEE=yes +[ -f etc/bumblebee/bumblebee.conf ] || BUMBLEBEE=no +if [ "$BUMBLEBEE" = "yes" ] ;then + rm -f etc/systemd/system/bumblebeed.service + ln -sf /lib/systemd/system/bumblebeed.service etc/systemd/system/graphical.target.wants/bumblebeed.service + + # test for kernel module + [ -z "$BUMBLEBEEDRIVER" ] && for a in $NVIDIATEST ;do + chroot . modprobe $a + lsmod | grep -q nvidia && BUMBLEBEEDRIVER=$a + [ -z "$BUMBLEBEEDRIVER" ] || break + done + [ -z "$BUMBLEBEEDRIVER" ] && BUMBLEBEEDRIVER=nouveau + + #settings for bumblebeed service + sed -i /^KernelDriver=/d etc/bumblebee/bumblebee.conf + sed -i "s/^\\[driver-nouveau\\]/\\[driver-nouveau\\]\\nKernelDriver=nouveau/" etc/bumblebee/bumblebee.conf + if [ "$BUMBLEBEEDRIVER" = "nouveau" ] ;then + sed -i "s/^Driver=.*/Driver=nouveau/" etc/bumblebee/bumblebee.conf + sed -i "s/^\\[driver-nvidia\\]/\\[driver-nvidia\\]\\nKernelDriver=nvidia-current/" etc/bumblebee/bumblebee.conf + else + sed -i "s/^Driver=.*/Driver=nvidia/" etc/bumblebee/bumblebee.conf + sed -i "s/^\\[driver-nvidia\\]/\\[driver-nvidia\\]\\nKernelDriver="$BUMBLEBEEDRIVER"/" etc/bumblebee/bumblebee.conf + [ -d "usr/lib/$BUMBLEBEEDRIVER" ] && [ ! -h usr/lib/nvidia ] && ln -s "$BUMBLEBEEDRIVER" usr/lib/nvidia + [ -d "usr/lib64/$BUMBLEBEEDRIVER" ] && [ ! -h usr/lib64/nvidia ] && ln -s "$BUMBLEBEEDRIVER" usr/lib64/nvidia + fi + [ -z "$BBBUSID" ] && BBBUSID=$(lspci -mn | sed s/'"Class '// | awk '{ print $1 " " $2 }' | grep -m1 0302 | awk '{print $1}' | tr . :) + [ -z "$BBBUSID" ] || sed -i s/PCI:..:..:./PCI:$BBBUSID/ etc/bumblebee/xorg.conf.nvidia + [ -z "$BBBUSID" ] || sed -i s/PCI:..:..:./PCI:$BBBUSID/ etc/bumblebee/xorg.conf.nouveau + + echo "$OPTIRUN" | tr ',;' \\n | while read a ;do + FILE=usr/share/applications/$a.desktop + [ -f $FILE ] || FILE=usr/share/applications/kde4/$a.desktop + if [ -f $FILE ] ;then + sed -i "s|Exec=primusrun |Exec=|" $FILE + grep -q optirun $FILE || sed -i "s|Exec=|Exec=optirun -b primus |" $FILE + fi + done + + echo "$PRIMUSRUN" | tr ',;' \\n | while read a ;do + FILE=usr/share/applications/$a.desktop + [ -f $FILE ] || FILE=usr/share/applications/kde4/$a.desktop + if [ -f $FILE ] ;then + sed -i "s|Exec=optirun -b primus |Exec=|" $FILE + grep -q primusrun $FILE || sed -i "s|Exec=|Exec=primusrun |" $FILE + fi + done + +fi + +#setting BusID option for multicard hardware +if [ -f $XFILE -a "$VGABUSID" ] ;then + VGABUSID=$(echo "$VGABUSID" | tr '.' :) + if ! grep -q "$VGABUSID" $XFILE ;then + a=$XDRIVER + echo $a | grep -q nvidia && a=nvidia + a=$(grep -i driver.*$a $XFILE) + sed -i /BusID/d $XFILE + sed -i /"$a"/s/$/\\n'BusID "PCI:'$VGABUSID'"'/ $XFILE + fi +fi + +#preloading kernel module to help xorg (all nvidia* modules are using one name 'nvidia') +if echo "$XDRIVER" | egrep -q 'nvidia|nouveau' ;then + sed -i /^nvidia/d etc/modprobe.preload + sed -i /^nouveau/d etc/modprobe.preload + echo "$XDRIVER" >> etc/modprobe.preload +fi diff --git a/ublinux/rc.preinit.d/51-autologin b/ublinux/rc.preinit.d/51-autologin new file mode 100755 index 0000000..65c2b62 --- /dev/null +++ b/ublinux/rc.preinit.d/51-autologin @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=. +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +SYSCONF="${ROOTFS}/${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + + if [[ "${AUTOLOGINUSER}" == "none" ]]; then + unset AUTOLOGINUSER + [[ -f ${ROOTFS}/etc/X11/gdm/custom.conf ]] && sed -i "s/^AutomaticLogin=.*//g" ${ROOTFS}/etc/X11/gdm/custom.conf + [[ -f ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc ]] && sed -i "s/^AutoLoginUser=.*//g" ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc + [[ -f ${ROOTFS}/etc/sddm.conf ]] && sed -i "s/^User=.*//g" ${ROOTFS}/etc/sddm.conf + [[ -f ${ROOTFS}/etc/slim.conf ]] && sed -i "s/^default_user[[:space:]].*//g" ${ROOTFS}/etc/slim.conf + [[ -f ${ROOTFS}/etc/X11/slim/slim.conf ]] && sed -i "s/^default_user[[:space:]].*//g" ${ROOTFS}/etc/X11/slim/slim.conf + [[ -f ${ROOTFS}/etc/lxdm/lxdm.conf ]] && sed -i "s/^autologin=.*//g" ${ROOTFS}/etc/lxdm/lxdm.conf + [[ -f ${ROOTFS}/etc/lightdm/lightdm.conf ]] && sed -i "s/^autologin-user=.*/#autologin-user=/g" ${ROOTFS}/etc/lightdm/lightdm.conf + else + if [[ -z "${DISPLAYMANAGER_DEFAULTUSER}" ]]; then + [[ -z "$(cmdline_value autologin)" ]] || AUTOLOGINUSER=$(cmdline_value autologin) + [[ -z "${AUTOLOGINUSER}" ]] && AUTOLOGINUSER=$(echo "${NEEDEDUSERS}" | awk -F: '{print $1}') + [[ -z "${AUTOLOGINUSER}" ]] && AUTOLOGINUSER=$(grep :${ADMUID}:${ADMUID}: ${ROOTFS}/etc/passwd | awk -F: '{print $1}') + fi + [[ -f ${ROOTFS}/etc/X11/gdm/custom.conf ]] && sed -i "s/^AutomaticLogin=.*/AutomaticLogin=${AUTOLOGINUSER}/g" ${ROOTFS}/etc/X11/gdm/custom.conf + [[ -f ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc ]] && sed -i "s/^AutoLoginUser=.*/AutoLoginUser=${AUTOLOGINUSER}/g" ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc + [[ -f ${ROOTFS}/etc/sddm.conf ]] && sed -i "s/^User=.*/User=${AUTOLOGINUSER}/g" ${ROOTFS}/etc/sddm.conf + [[ -f ${ROOTFS}/etc/slim.conf ]] && sed -i "s/^default_user[[:space:]].*/default_user ${AUTOLOGINUSER}/g" ${ROOTFS}/etc/slim.conf + [[ -f ${ROOTFS}/etc/X11/slim/slim.conf ]] && sed -i "s/^default_user[[:space:]].*/default_user ${AUTOLOGINUSER}/g" ${ROOTFS}/etc/X11/slim/slim.conf + [[ -f ${ROOTFS}/etc/lxdm/lxdm.conf ]] && sed -i "s/^#autologin=.*/autologin=${AUTOLOGINUSER}/g" ${ROOTFS}/etc/lxdm/lxdm.conf + if [[ -f ${ROOTFS}/etc/lightdm/lightdm.conf ]]; then + if grep -q "^#autologin-user=.*" ${ROOTFS}/etc/lightdm/lightdm.conf 2>/dev/null; then + sed -i "s/^#autologin-user=.*/autologin-user=${AUTOLOGINUSER}/g" ${ROOTFS}/etc/lightdm/lightdm.conf + else + sed -i "/\[Seat:\*\]/aautologin-user=${AUTOLOGINUSER}" ${ROOTFS}/etc/lightdm/lightdm.conf + fi +# sed -i "s/^#autologin-guest=.*/autologin-guest=false/" ${ROOTFS}/etc/lightdm/lightdm.conf +# sed -i "s/^#autologin-user-timeout=.*/autologin-user-timeout=0/" ${ROOTFS}/etc/lightdm/lightdm.conf + AUTOLOGIN_IDGROUP=$(grep -i "g\sautologin\s*[[:digit:]]\s*" ${ROOTFS}/usr/share/ublinux-sysusers/*.sysusers | cut -d: -f2 | xargs | cut -d " " -f3 | head -1) + [[ -n ${AUTOLOGIN_IDGROUP} ]] && ARG_AUTOLOGIN_IDGROUP="-g ${AUTOLOGIN_IDGROUP}" + if [[ -n ${ROOTFS} ]]; then + chroot . ${ROOTFS}/usr/bin/groupadd -f ${ARG_AUTOLOGIN_IDGROUP} autologin >/dev/null 2>&1 + chroot . ${ROOTFS}/usr/bin/gpasswd -a ${AUTOLOGINUSER} autologin >/dev/null 2>&1 + else + /usr/bin/groupadd -f ${ARG_AUTOLOGIN_IDGROUP} autologin >/dev/null 2>&1 + /usr/bin/gpasswd -a ${AUTOLOGINUSER} autologin >/dev/null 2>&1 + fi + fi + fi + diff --git a/ublinux/rc.preinit.d/52-desktop b/ublinux/rc.preinit.d/52-desktop new file mode 100755 index 0000000..653b9c2 --- /dev/null +++ b/ublinux/rc.preinit.d/52-desktop @@ -0,0 +1,177 @@ +#!/usr/bin/env bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=. +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +[ -f etc/inittab ] && sed -i 's/id:.:initdefault:/id:5:initdefault:/' etc/inittab + +SYSCONF="${ROOTFS}/${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/desktop; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + + +switch3don(){ + echo "COMPOSITING_SERVER_START=no" >$SYSCONF/compositing-server + #Gnome-shell does not supports compiz, so turn on it only in classic mode and only after desktop started + if [ -x usr/bin/gnome-shell ] ;then + echo -e "COMPOSITING_WM_START=no\nCOMPOSITING_WM=compiz-fusion" >$SYSCONF/compositing-wm + sed -i /COMPOSITING_WM_START/d $SYSCONF/config + echo COMPOSITING_WM_START=yes >> $SYSCONF/config + else + echo -e "COMPOSITING_WM_START=yes\nCOMPOSITING_WM=compiz-fusion" >$SYSCONF/compositing-wm + fi +# [ -f usr/lib/libDrakX/harddrake/autoconf.pm ] && sed -i 's/^ *Xconfig::glx::write({});$/# Xconfig::glx::write({});/' usr/lib/libDrakX/harddrake/autoconf.pm + [ -f etc/xdg/kwinrc ] && sed -i s/^Enabled=.*/Enabled=false/ etc/xdg/kwinrc +} + +switch3doff(){ + echo "COMPOSITING_SERVER_START=no" >$SYSCONF/compositing-server + echo -e "COMPOSITING_WM_START=no\nCOMPOSITING_WM=compiz-fusion" >$SYSCONF/compositing-wm + sed -i /COMPOSITING_WM_START/d $SYSCONF/config +# [ -f usr/lib/libDrakX/harddrake/autoconf.pm ] && sed -i 's/^# Xconfig::glx::write({});$/ Xconfig::glx::write({});/' usr/lib/libDrakX/harddrake/autoconf.pm + [ -f etc/xdg/kwinrc ] && sed -i s/^Enabled=.*/Enabled=true/ etc/xdg/kwinrc +} + +setupdm(){ + if [ -f lib/systemd/system/$1.service ] ;then + ln -sf /lib/systemd/system/$1.service etc/systemd/system/display-manager.service + ln -sf /lib/systemd/system/graphical.target etc/systemd/system/default.target + [[ -f $SYSCONF/desktop ]] && sed -i /DISPLAYMANAGER=/d $SYSCONF/desktop + echo "DISPLAYMANAGER=${1%%-plymouth*}" >> $SYSCONF/desktop + case ${1%%-plymouth*} in + lightdm) + # FIX lightdm-greater + mkdir -p usr/libexec + ln -sf /usr/lib/at-spi-bus-launcher usr/libexec/at-spi-bus-launcher + ln -sf init usr/bin/systemd + ;; + esac + fi +} + +setupde(){ + if [[ -f usr/share/xsessions/$1.desktop ]] ;then + sed -i /DESKTOP=/d $SYSCONF/desktop + echo "DESKTOP=$1" >> $SYSCONF/desktop +# ln -sf $1.desktop usr/share/xsessions/default.desktop +# cat > usr/share/xsessions/default.desktop <> $SYSCONF/desktop + DESKTOP=none + sed -i /DESKTOP=/d $SYSCONF/desktop + echo "DESKTOP=$DESKTOP" >> $SYSCONF/desktop +} + +[ "$(cmdline_parameter 3ddesktop)" ] && switch3don +[ "$(cmdline_parameter no3ddesktop)" ] && switch3doff + +for i in $(cmdline_value desktop | tr , " " ) ;do + case $i in + 3d) switch3don ;; + no3d) switch3doff ;; + xfce) DESKTOP=xfce ;; + kde) DESKTOP=kde4 ;; + gnome) DESKTOP=gnome ;; + gnome-shell|gnome3) DESKTOP=gnomeshell ;; + lxde) DESKTOP=lxde ;; + lxqt) DESKTOP=lxqt ;; + i3) DESKTOP=i3 ;; + steam) DESKTOP=steam ;; + plasma) DESKTOP=plasma ;; + mate) DESKTOP=mate ;; + ukui) DESKTOP=ukui ;; + none) DISPLAYMANAGER=none && DESKTOP=none ;; + lightdm) DISPLAYMANAGER=lightdm ;; + kdm) DISPLAYMANAGER=kdm ;; + gdm) DISPLAYMANAGER=gdm ;; + slim) DISPLAYMANAGER=slim ;; + xdm) DISPLAYMANAGER=xdm ;; + lxdm) DISPLAYMANAGER=lxdm ;; + sddm) DISPLAYMANAGER=sddm ;; + lan) sed -i s/ONBOOT=.*/ONBOOT=yes/ $SYSCONF/network-scripts/ifcfg-eth0 2>/dev/null ;; + nolan) sed -i s/ONBOOT=.*/ONBOOT=no/ $SYSCONF/network-scripts/ifcfg-eth0 2>/dev/null ;; + *) DESKTOP=${i,,} ;; + esac +done + +# Disable Display Manager + [[ "${DESKTOP}" == "none" || "${DISPLAYMANAGER}" == "none" ]] && DESKTOP="none" && DISPLAYMANAGER="none" && disabledmde + +# Autodetect Display Manager + [[ -z "${DISPLAYMANAGER}" ]] && for i in slim xdm lxdm kdm gdm sddm lightdm; do + [[ -f lib/systemd/system/$i.service ]] && DISPLAYMANAGER=$i + done +#echo "DISPLAYMANAGER=$DISPLAYMANAGER" >> $SYSCONF/test + [[ -f lib/systemd/system/${DISPLAYMANAGER}-plymouth.service ]] && setupdm ${DISPLAYMANAGER}-plymouth && rm -f lib/systemd/system/${DISPLAYMANAGER}.service || setupdm ${DISPLAYMANAGER} + +# Autodetect Display Environment +# /usr/share/xsessions/*.desktop for X's sessions and /usr/share/wayland-sessions/*.desktop for Wayland's. + [[ -z "${DESKTOP}" ]] && for i in i3 ukui steam lxde lxqt kde4 xfce mate gnome gnomeshell plasma; do + [[ -f usr/share/wayland-sessions/$i.desktop ]] && DESKTOP=$i + [[ -f usr/share/xsessions/$i.desktop ]] && DESKTOP=$i + done + setupde ${DESKTOP,,} + + [[ -z "${DISPLAYMANAGER}" && -z "${DESKTOP}" ]] && disabledmde + +# Autodetect FirstStart +# Если пароли по умолчанию ublinux, то FirstStart + grep -q "^root:${DEFAULTROOTPASSWD}:" etc/shadow && grep -q "^$(cat etc/passwd | grep ".*:x:${ADMUID}:" | cut -d: -f1):${DEFAULTPASSWD}:" etc/shadow && touch ${SYSCONF}/firststart + +# Set default user to Display Manager + if [[ "${DISPLAYMANAGER}" == "lightdm" && ${DISPLAYMANAGER_DEFAULTUSER} ]]; then + sed -i /DISPLAYMANAGER_DEFAULTUSER=/d $SYSCONF/desktop + echo "DISPLAYMANAGER_DEFAULTUSER=${DISPLAYMANAGER_DEFAULTUSER}" >> $SYSCONF/desktop + mkdir -p var/lib/lightdm/.cache/lightdm-gtk-greeter/ + echo "[greeter]" > var/lib/lightdm/.cache/lightdm-gtk-greeter/state + echo "last-user=${DISPLAYMANAGER_DEFAULTUSER}" >> var/lib/lightdm/.cache/lightdm-gtk-greeter/state + chown -Rf 41:41 var/lib/lightdm/ + chmod 1770 var/lib/lightdm/ + chmod 755 var/lib/lightdm/.cache/lightdm-gtk-greeter/ + chmod 644 var/lib/lightdm/.cache/lightdm-gtk-greeter/state + fi + + diff --git a/ublinux/rc.preinit.d/53-language b/ublinux/rc.preinit.d/53-language new file mode 100755 index 0000000..dbec378 --- /dev/null +++ b/ublinux/rc.preinit.d/53-language @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +echo $SYSCONF | grep -q ^/ && SYSCONF=.$SYSCONF +SOURCE=${SYSCONF}/keyboard; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/locale; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +NEWLANG=$(cmdline_value lang) +[[ -z ${NEWLANG} ]] || { LOCALE+=",${NEWLANG}" && LANG="${NEWLANG}"; } + +for I_LOCALE in ${LOCALE//,/ }; do + sed -i "s/^#${I_LOCALE} /${I_LOCALE} /g" etc/locale.gen +done + +chroot . env LANG=${LANG} locale > etc/locale.conf + +[[ -n ${FORCE_LOCARCHIVE} ]] && FORCEGEN=1 +[[ ! -f usr/lib/locale/locale-archive ]] && FORCEGEN=1 +#[[ "$(echo -e ${LOCALE//,/\\n} | sort -fu)" != "$(chroot . localedef --list-archive | sort -fu)" ]] && FORCEGEN=1 +[[ -n ${FORCEGEN} ]] && chroot . locale-gen &>/dev/null +#; unset LANG; source /etc/profile.d/locale.sh" + +# Если имеются языкозависимые файлы, то копируем в корень +[[ -d usr/share/ublinux/langs/${LANG} ]] && cp -pfr usr/share/ublinux/langs/${LANG}/* ./ + +echo FONT=${CONSOLE_FONT} > etc/vconsole.conf +echo KEYMAP=${KEYBOARD} >> etc/vconsole.conf +[[ -z ${KEYMAP_TOGGLE} ]] || echo KEYMAP_TOGGLE="${KEYMAP_TOGGLE}" >> etc/vconsole.conf diff --git a/ublinux/rc.preinit.d/54-backgrounds b/ublinux/rc.preinit.d/54-backgrounds new file mode 100755 index 0000000..90ffb67 --- /dev/null +++ b/ublinux/rc.preinit.d/54-backgrounds @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + + find /memory/layer-base/*/* -maxdepth 0 -iname "ublinux-data*.sgn" | while read location; do + mkdir -p $(dirname ${location})/backgrounds/ublinux + done + + [ -d usr/share/backgrounds ] || mkdir -p usr/share/backgrounds +# With masked /memory/* , with parametre kernel "ub.mask" + [[ $(cmdline_parameter ub.mask) || $(cmdline_parameter ub.hide) ]] && find /memory/layer-base/*/backgrounds/* -maxdepth 0 -exec cp -fru {} usr/share/backgrounds/ \; + +# With unmasked /memory/* , without parametre kernel "ub.mask" + [[ -z $(cmdline_parameter ub.mask) || -z $(cmdline_parameter ub.hide) ]] && find /memory/layer-base/*/backgrounds/* -maxdepth 0 -exec ln -s {} usr/share/backgrounds/ \; diff --git a/ublinux/rc.preinit.d/55-multiseat b/ublinux/rc.preinit.d/55-multiseat new file mode 100755 index 0000000..84a2cc4 --- /dev/null +++ b/ublinux/rc.preinit.d/55-multiseat @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=. +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +SYSCONF="${ROOTFS}/${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/desktop; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +FILE_UDEV_MULTISEAT="${ROOTFS}/etc/udev/rules.d/72-seat-ubconfig.rules" + + [[ ${DISPLAYMANAGER} == "none" ]] && exit 0 + if [[ -n "${MULTISEAT_SIMPLE[@]}" ]]; then + for SEAT in "${!MULTISEAT_SIMPLE[@]}"; do + while read SEAT_DEVICE; do + cat << EOF >> "${FILE_UDEV_MULTISEAT}" +TAG=="seat", ENV{DEVPATH}=="${SEAT_DEVICE#/sys*}", ENV{ID_SEAT}="${SEAT}", TAG+="${SEAT}" +EOF + done < <(tr ' ' '\n' <<< "${MULTISEAT_SIMPLE[${SEAT}]}") + done + else + rm -f ${FILE_UDEV_MULTISEAT} + fi diff --git a/ublinux/rc.preinit.d/60-virtualbox b/ublinux/rc.preinit.d/60-virtualbox new file mode 100755 index 0000000..07e1b5e --- /dev/null +++ b/ublinux/rc.preinit.d/60-virtualbox @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +if grep -qi virtualbox /sys/devices/virtual/dmi/id/*name; then + echo -e vboxguest\\nvboxsf\\nvboxvideo > usr/lib/modules-load.d/vbox-guest-additions.conf + [ -f usr/lib/systemd/system/vboxservice.service ] && ln -sf /usr/lib/systemd/system/vboxservice.service etc/systemd/system/multi-user.target.wants/vboxservice.service +else + rm -f usr/lib/modules-load.d/vbox-guest-additions.conf etc/systemd/system/multi-user.target.wants/vboxservice.service +fi diff --git a/ublinux/rc.preinit.d/61-vmware b/ublinux/rc.preinit.d/61-vmware new file mode 100755 index 0000000..e81b602 --- /dev/null +++ b/ublinux/rc.preinit.d/61-vmware @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +if grep -qi vmware /sys/devices/virtual/dmi/id/*name; then + [ -f usr/lib/systemd/system/vmtoolsd.service ] && ln -sf /usr/lib/systemd/system/vmtoolsd.service etc/systemd/system/multi-user.target.wants/vmtoolsd.service + [ -f usr/lib/systemd/system/vmware-vmblock-fuse.service ] && ln -sf /usr/lib/systemd/system/vmtoolsd.service etc/systemd/system/multi-user.target.wants/vmware-vmblock-fuse.service +else + rm -f etc/systemd/system/multi-user.target.wants/vmtoolsd.service + rm -f etc/systemd/system/multi-user.target.wants/vmware-vmblock-fuse.service +fi diff --git a/ublinux/rc.preinit.d/62-hyperv b/ublinux/rc.preinit.d/62-hyperv new file mode 100755 index 0000000..66e8e20 --- /dev/null +++ b/ublinux/rc.preinit.d/62-hyperv @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +if grep -qi Microsoft /sys/devices/virtual/dmi/id/*vendor; then + [ -f usr/lib/systemd/system/hv_fcopy_daemon.service ] && ln -sf /usr/lib/systemd/system/hv_fcopy_daemon.service etc/systemd/system/multi-user.target.wants/hv_fcopy_daemon.service + [ -f usr/lib/systemd/system/hv_kvp_daemon.service ] && ln -sf /usr/lib/systemd/system/hv_kvp_daemon.service etc/systemd/system/multi-user.target.wants/hv_kvp_daemon.service + [ -f usr/lib/systemd/system/hv_vss_daemon.service ] && ln -sf /usr/lib/systemd/system/hv_vss_daemon.service etc/systemd/system/multi-user.target.wants/hv_vss_daemon.service +else + rm -f etc/systemd/system/multi-user.target.wants/hv_fcopy_daemon.service + rm -f etc/systemd/system/multi-user.target.wants/hv_kvp_daemon.service + rm -f etc/systemd/system/multi-user.target.wants/hv_vss_daemon.service +fi diff --git a/ublinux/rc.preinit.d/90-apparmor b/ublinux/rc.preinit.d/90-apparmor new file mode 100755 index 0000000..4847677 --- /dev/null +++ b/ublinux/rc.preinit.d/90-apparmor @@ -0,0 +1,45 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +debug_mode "$0" "$@" + +echo $SYSCONF | grep -q ^/ && SYSCONF=.$SYSCONF +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +SERVICEAPPARMOR="apparmor.service" + +if ! [ "$APPARMOR"=="yes" ] ;then + mkdir -p proc + mount -o rbind /proc proc + ISSYSTEMD=$(readlink -fq usr/bin/init | grep /lib/systemd/systemd) + if [ $ISSYSTEMD ] ;then + chroot . systemctl unmask $SERVICEAPPARMOR + chroot . systemctl enable $SERVICEAPPARMOR || chroot . chkconfig --add $SERVICEAPPARMOR + else + chroot . chkconfig --add $SERVICEAPPARMOR + fi + umount proc + +cat > ${ROOTFS}etc/xdg/autostart/apparmor-notify.desktop << EOF +[Desktop Entry] +Type=Application +Name=AppArmor Notify +Comment=Receive on screen notifications of AppArmor denials +TryExec=aa-notify +Exec=aa-notify -p -s 1 -w 60 -f /var/log/audit/audit.log +StartupNotify=false +NoDisplay=true +EOF + +fi + + diff --git a/ublinux/rc.preinit.d/99-osinstall b/ublinux/rc.preinit.d/99-osinstall new file mode 100755 index 0000000..3a4b6d2 --- /dev/null +++ b/ublinux/rc.preinit.d/99-osinstall @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +#PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin + +unset ROOTFS; [[ -d /usr/lib/ublinux ]] || ROOTFS=. +SOURCE=${ROOTFS}/usr/lib/ublinux/functions; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${ROOTFS}/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +debug_mode "$0" "$@" + +SYSCONF="${ROOTFS}/${SYSCONF}" +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + +if [ "$(cmdline_parameter ub.osinstall)" ]; then + TTY_N=2 + EXEC_START="/usr/bin/ubinstall.cli" + sed -i "s/.*NAutoVTs=6.*/NAutoVTs=0/" etc/systemd/logind.conf + sed -i "s/.*ReserveVT=6.*/ReserveVT=0/" etc/systemd/logind.conf + mkdir -p etc/systemd/system/getty@tty${TTY_N}.service.d + echo "[Service]" > etc/systemd/system/getty@tty${TTY_N}.service.d/override.conf + echo "ExecStart=" >> etc/systemd/system/getty@tty${TTY_N}.service.d/override.conf + FONT=$(grep "FONT" etc/vconsole.conf | cut -d= -f2) + [[ -z ${FONT} ]] && FONT=${CONSOLE_FONT:-cyr-sun16} + echo "ExecStart=-bash -c \". /etc/locale.conf; export LANG; setfont ${FONT}; ${EXEC_START}\"" >> etc/systemd/system/getty@tty${TTY_N}.service.d/override.conf + echo "StandardInput=tty" >> etc/systemd/system/getty@tty${TTY_N}.service.d/override.conf + echo "StandardOutput=tty" >> etc/systemd/system/getty@tty${TTY_N}.service.d/override.conf + mkdir -p etc/systemd/system/getty.target.wants + ln -sf /usr/lib/systemd/system/getty@.service etc/systemd/system/getty.target.wants/getty@tty${TTY_N}.service + ln -sf /dev/null etc/systemd/system/getty.target.wants/getty@tty1.service +fi + diff --git a/ublinux/rc.preinit/01-inifile b/ublinux/rc.preinit/01-inifile new file mode 100755 index 0000000..212d6c2 --- /dev/null +++ b/ublinux/rc.preinit/01-inifile @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +INIGZFILE=$(find /memory -maxdepth 1 -iname "*.ini.gz") +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +[ -f $INIGZFILE ] || INIGZFILE=$(find /tmp -maxdepth 1 -iname "*.ini.gz") +[ -f $INIGZFILE ] || echo "Config file '*.ini.gz' not found!" +grep -q ^/ <<< "${SYSCONF}" && SYSCONF=.${SYSCONF} + + mkdir -p "${SYSCONF}" + +# ublinux.ini processing + FNAME="${SYSCONF}/config" + FMOD= + touch ${FNAME} + zcat $INIGZFILE | egrep '^DEFAULTPASSWD|^DEFAULTROOTPASSWD|^NEEDEDUSERS|^USERADD' > /tmp/.credential + while read LINE; do + if grep -q "^\[.*\][[:space:]]*" <<< ${LINE}; then + FNAME=$(echo "${LINE}" | tr '[]' '|' | cut -d'|' -f2 | sed s-^/--) + FMOD=$(echo "${LINE}" | tr '[]' '|' | cut -d'|' -f3 | tr -d ' ') + PATH_FNAME=$(dirname "${FNAME}") + [[ ${PATH_FNAME} == "." ]] && FNAME="${SYSCONF}/${FNAME}" + if [ -n "${FMOD}" ]; then + mkdir -p "${PATH_FNAME}" + [ -e "${FNAME}" ] || touch "${FNAME}" + chmod "${FMOD}" "${FNAME}" + fi + elif grep -q "^-" <<< "${LINE}"; then + LINE_NEW=$(echo "${LINE}" | sed 's/^-//') + sed -i /^"${LINE_NEW}"$/d "${FNAME}" + elif grep -q "^|" <<< "${LINE}"; then + echo "${LINE}" | sed 's/^|//' >> "${FNAME}" + elif grep -q "^+" <<< "${LINE}"; then + LINE_NEW=$(echo "${LINE}" | sed 's/^+//') + grep -q "${LINE_NEW}" "${FNAME}" || echo "${LINE_NEW}" >> "${FNAME}" + else + LINE_NEW=$(cut -d= -f1 <<< "${LINE}") + [ "${LINE_NEW}" = "" ] && continue + if ! grep -q "^[[:space:]]*${LINE_NEW}=" "${FNAME}" 2>/dev/null; then + grep -q "^${LINE}$" "${FNAME}" 2>/dev/null || echo "${LINE}" >> "${FNAME}" + else + sed -i 's|'"^[[:space:]]*${LINE_NEW}=.*$"'|'"${LINE}"'|' "${FNAME}" + fi + fi + done < <(zcat $INIGZFILE | egrep -v '^DEFAULTPASSWD|^DEFAULTROOTPASSWD|^NEEDEDUSERS|^USERADD|^\s*#|^\s*$') +# Mark associative array + for FILE_CONFIG in ${SYSCONF}/*; do + DECLARE_A=$(cat "${FILE_CONFIG}" | egrep "^[A-z0-9_]*\[.*\]=.*" | sed -E "s/\[.*//" | uniq | tr "\n" " ") + [[ -z ${DECLARE_A} ]] || sed -E -i "1i declare -A ${DECLARE_A}" -i "${FILE_CONFIG}" + done + \ No newline at end of file diff --git a/ublinux/rc.preinit/02-skel-adds b/ublinux/rc.preinit/02-skel-adds new file mode 100755 index 0000000..3dab780 --- /dev/null +++ b/ublinux/rc.preinit/02-skel-adds @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +INSTALLDESKTOP="ubinstall;ubinstall.cli" +echo "$INSTALLDESKTOP" | tr ',;' \\n | while read i; do + if [ -f usr/share/applications/"${i}".desktop ]; then + if ! [ -w /memory/layer-base/0 -o -d /mnt/livedata -o -w /mnt/livemedia ]; then + if ! grep -q ^Hidden=true usr/share/applications/"${i}".desktop ; then +# DESKTOPNAME=$(chroot . bash -c "xdg-user-dirs-update && xdg-user-dir DESKTOP | cut -d/ -f3") + DESKTOPNAME=$(chroot . gettext -d xdg-user-dirs "Desktop") + mkdir -p etc/skel/"${DESKTOPNAME}" + cp usr/share/applications/"${i}".desktop etc/skel/"${DESKTOPNAME}"/ && echodebug "${i}.desktop added to skel." + chmod 755 etc/skel/"${DESKTOPNAME}"/"${i}".desktop + fi + fi + fi +done + +if [ -f etc/ublinux/steam ] ;then + . etc/ublinux/steam + rm -f etc/skel/.steam etc/skel/.local/share/Steam 2>/dev/null + [ -z "$STEAMCONF" ] || ln -sf "$STEAMCONF" etc/skel/.steam + [ -z "$STEAMAPP" ] || ln -sf "$STEAMAPP" etc/skel/.local/share/Steam +fi diff --git a/ublinux/rc.preinit/03-initvars b/ublinux/rc.preinit/03-initvars new file mode 100755 index 0000000..8a667af --- /dev/null +++ b/ublinux/rc.preinit/03-initvars @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +debug_mode "$0" "$@" + + # Filter not variable sell symbols from param kernel + egrep -iv ".*-.*=.*|.*\..*=.*" etc/initvars > etc/initvars diff --git a/ublinux/rc.preinit/10-accounts b/ublinux/rc.preinit/10-accounts new file mode 100755 index 0000000..7647870 --- /dev/null +++ b/ublinux/rc.preinit/10-accounts @@ -0,0 +1,78 @@ +#!/bin/bash +# +# Initial script for Live operating system +# This script are launching before starting init from linux-live script. +# Current dir allways must be set to root (/) +# All system path must be relative, except initrd dirs + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +PATH=.:/:/usr/bin:/usr/local/bin:/usr/local/sbin +DEBUGMODE=no +. usr/lib/ublinux/functions +. usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +echo $SYSCONF | grep -q ^/ && SYSCONF=.$SYSCONF +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + +#$1 - username +#$2 - passwd +function set_passwd() { + sed -i /^$1:/d etc/shadow + echo "$1:$2:18652:0:99999:7:::" >> etc/shadow + sed -i s/$1:[!]*:/$1:x:/ etc/passwd +# if [ -d etc/tcb/$1 ] ;then +# sed -i /^$1:/d etc/tcb/$1/shadow +# echo "$1:$2:18652:0:99999:7:::" >> etc/tcb/$1/shadow +# fi +} + +for ITEM_USERGROUP in $(echo "${DEFAULTGROUP},${ADMGROUPS},${USERGROUPS}" | tr ",;" " " ); do + FINDGROUP=$(grep -i "g\s*${ITEM_USERGROUP}\s*[[:digit:]]\s*" usr/share/ublinux-sysusers/*.sysusers | cut -d ":" -f2 | xargs) + if [[ -n ${FINDGROUP} ]]; then + FINDGROUP_NAMEGROUP=$(echo ${FINDGROUP} | cut -d' ' -f2) + FINDGROUP_IDGROUP=$(echo ${FINDGROUP} | cut -d " " -f3) + chroot . usr/bin/groupadd -f -g ${FINDGROUP_IDGROUP} ${FINDGROUP_NAMEGROUP} + fi +done + +[ -f /tmp/.credential ] && . /tmp/.credential && rm -f /tmp/.credential +[ -z "$NEEDEDUSERS" ] && NEEDEDUSERS="$DEFAULTUSER:$ADMUID:$DEFAULTPASSWD:Администратор" +[ -z "$(cmdline_value users)" ] || NEEDEDUSERS=$(cmdline_value users) +[ "$NOSECUREROOTPASSWD" = "$DEFAULTROOTPASSWD" ] && ADDADM=yes + + +for a in $(echo $NEEDEDUSERS | tr ",;" " " ) ;do + NEEDEDUSER="$(echo $a | awk -F: '{ print $1 }')" + NEEDEDUID="$(echo $a | awk -F: '{ print $2 }')" + NEEDEDPASS="$(echo $a | awk -F: '{ print $3 }')" + NEEDEDCOMMENT="$(echo $a | awk -F: '{ print $4 }')" + [ "${NEEDEDPASS}" = "x" ] && NEEDEDPASS="${DEFAULTPASSWD}" + ADDGROUPS="${USERGROUPS}" + [ "$NEEDEDUID" = "$ADMUID" -a "$ADDADM" = "yes" ] && ADDGROUPS="${USERGROUPS}","${ADMGROUPS}" + # create user + if ! grep -q ^"${NEEDEDUSER}": etc/passwd ;then + chroot . usr/sbin/useradd -M -G "${DEFAULTGROUP}" -u "${NEEDEDUID}" -c "${NEEDEDCOMMENT}" "${NEEDEDUSER}" >/dev/null 2>&1 || chroot . usr/sbin/adduser -D -H -G "${DEFAULTGROUP}" -u "${NEEDEDUID}" -g "${NEEDEDCOMMENT}" "${NEEDEDUSER}" >/dev/null 2>&1 + fi + # add to groups + for b in $(echo "${ADDGROUPS}" | tr ",;" " " ) ;do + chroot . usr/sbin/usermod -a -G $b "${NEEDEDUSER}" >/dev/null 2>&1 + done + # set password + [ "${NEEDEDPASS}" = "" ] || set_passwd "${NEEDEDUSER}" "${NEEDEDPASS}" + # create home + if [ ! -d home/"${NEEDEDUSER}" ] ;then + cp -a etc/skel home/"${NEEDEDUSER}" + chroot . bin/chown -R "${NEEDEDUSER}":"${NEEDEDUSER}" home/"${NEEDEDUSER}" + chroot . chmod -fR u+rw,g-rwx,o-rwx home/"${NEEDEDUSER}"/ + chroot . chmod -f 700 home/"${NEEDEDUSER}" + elif [ "${UPDATEHOME}" = "yes" ] ;then + rsync -rlpt --ignore-existing etc/skel/ home/"${NEEDEDUSER}" + chroot . bin/chown -R "${NEEDEDUSER}":"${NEEDEDUSER}" home/"${NEEDEDUSER}" + chroot . chmod -fR u+rw,g-rwx,o-rwx home/"${NEEDEDUSER}"/ + chroot . chmod -f 700 home/"${NEEDEDUSER}" + fi +done +set_passwd root "${DEFAULTROOTPASSWD}" diff --git a/ublinux/rc.xorg/00-envvars b/ublinux/rc.xorg/00-envvars new file mode 100755 index 0000000..cdbb752 --- /dev/null +++ b/ublinux/rc.xorg/00-envvars @@ -0,0 +1,13 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +set -a +eval "$(systemctl --user show-environment)" +set +a + +systemctl --user import-environment DISPLAY XAUTHORITY +if command -v dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY +fi diff --git a/ublinux/rc.xorg/01-background b/ublinux/rc.xorg/01-background new file mode 100755 index 0000000..36edbea --- /dev/null +++ b/ublinux/rc.xorg/01-background @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# to be sourced +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/theme; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +FEHOPTIONS="-B black -x -Z --scale-down" +WPDEFFILE=/usr/share/ublinux/wallpapers/default.jpg +FEHKILLSWITCH="while ! ps -A | egrep -q 'splash|panel|xbindkeys|lightdm-gtk-gr|polybar' ;do sleep 1 ;done ; sleep 7 ; killall feh" +[ "$BACKGROUNDMODE" = "2" ] && FEHOPTIONS="-F --zoom fill" + +# get resolution of primary (or first) monitor +XORG_RES=$(LC_ALL=C /usr/bin/xrandr | awk -F" connected primary " '{print $2}' | sed s/+.*// | grep -m1 .) +[ -z "$XORG_RES" ] && XORG_RES=$(LC_ALL=C /usr/bin/xrandr | awk -F" connected " '{print $2}' | sed s/+.*// | grep -m1 .) +[ -z "$XORG_RES" ] && XORG_RES=1920x1080 + +# show wallpaper +[ -x /usr/bin/feh ] && /usr/bin/feh $FEHOPTIONS -g "$XORG_RES" $(dirname $WPDEFFILE)/default.orig.jpg & +# killswitch for feh +[ -x /usr/bin/feh ] && bash -c "$FEHKILLSWITCH" & + +if [ -x /usr/bin/convert ] ;then + # resizing wallpaper for monitor resolution (default is proportional on black background) + RESIZEOPT="-resize $XORG_RES -background black -gravity center -extent $XORG_RES" + [ "$BACKGROUNDMODE" = "1" ] && RESIZEOPT="-resize $XORG_RES!" + [ "$BACKGROUNDMODE" = "2" ] && RESIZEOPT="-resize $XORG_RES^ -gravity center -extent $XORG_RES" + convert $RESIZEOPT $(dirname $WPDEFFILE)/default.orig.jpg /tmp/background.jpg + # Graffiti effects + if [ "$GRAFFITI" = "yes" ] ;then + [ "$(cmdline_value changes)$(cmdline_value ub.changes)" ] && LABEL=ublinux.png || LABEL=clean.png + convert -resize x$(expr $(echo $XORG_RES | awk -Fx '{ print $2 }') / 10) /usr/share/ublinux/graffiti/$LABEL /tmp/logo.png + composite -gravity SouthWest /tmp/logo.png /tmp/background.jpg /tmp/background2.jpg + mv -f /tmp/background2.jpg /tmp/background.jpg + rm -f /tmp/logo.png + fi + # placing warning about default passwords + if [ "$GRAFFITI" != "no" -a -x /usr/bin/composite ] ;then + . /usr/lib/ublinux/os-config + A=0 + grep -q "^root:$DEFAULTROOTPASSWD:" /etc/shadow && A=1 + grep -q "^user:$DEFAULTPASSWD:" /etc/shadow && A=1 + [ "$A" = "1" ] && composite -gravity NorthWest /usr/share/ublinux/graffiti/warning.png /tmp/background.jpg /tmp/background2.jpg + [ -f /tmp/background2.jpg ] && mv -f /tmp/background2.jpg /tmp/background.jpg + fi + # replacing default wallpaper + [ -f /tmp/background.jpg ] && mv -f /tmp/background.jpg "$WPDEFFILE" + [ -d /usr/share/apps/ksplash ] && mkdir -p "/usr/share/apps/ksplash/Themes/Default/$XORG_RES" + [ -d /usr/share/apps/ksplash ] && convert "$WPDEFFILE" "/usr/share/apps/ksplash/Themes/Default/$XORG_RES/background.png" +fi + +exit 0 \ No newline at end of file diff --git a/ublinux/rc.xorg/02-xrandr b/ublinux/rc.xorg/02-xrandr new file mode 100755 index 0000000..9850a47 --- /dev/null +++ b/ublinux/rc.xorg/02-xrandr @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 +DEBUGMODE=no + +. /usr/lib/ublinux/functions +. /usr/lib/ublinux/os-config +debug_mode "$0" "$@" + +SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/video; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/desktop; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null + + [[ ${DISPLAYMANAGER} == "none" ]] && exit 0 + +## Parametrs: +## cvt , gtf , reduced|r , auto , preferred , off , primary , mode:1920x1080 +## lo|LeftOf:{name} , ro|RightOf:{name} , ab|Above:{name} , be|Below:{name} , rotate:normal|left|right|invert + [[ -z "${XRANDR_MONITOR[@]}" ]] || for VIDEO_PORT in "${!XRANDR_MONITOR[@]}"; do + SOFT_MODELINE="gtf" + SOFT_MODELINE_R= + while read VIDEO_PORT_PARAM; do + MODELINE= + if egrep -iq "^[0-9]*x[0-9]*$|^[0-9]*x[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + if [[ -n ${SOFT_MODELINE_R} ]]; then + MODELINE=$(cvt -r $(sed 's/\([0-9]* [0-9]*\) .*/\1/' <<< ${VIDEO_PORT_PARAM//x/ }) | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //') + SOFT_MODELINE_R= + elif [[ ${SOFT_MODELINE} == "cvt" ]]; then + MODELINE=$(cvt ${VIDEO_PORT_PARAM//x/ } | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //') + else + if egrep -iq "^[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + MODELINE=$(gtf ${VIDEO_PORT_PARAM//x/ } 60 | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //') + else + MODELINE=$(gtf ${VIDEO_PORT_PARAM//x/ } | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //') + fi + fi + elif egrep -iq "^cvt$" <<< "${VIDEO_PORT_PARAM}"; then + SOFT_MODELINE="cvt" + elif egrep -iq "^gtf$" <<< "${VIDEO_PORT_PARAM}"; then + SOFT_MODELINE="gtf" + elif egrep -iq "^reduced|r$" <<< "${VIDEO_PORT_PARAM}"; then + SOFT_MODELINE_R="reduced" + elif egrep -iq "^auto$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --auto + elif egrep -iq "^preferred$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --preferred + elif egrep -iq "^off$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --off + elif egrep -iq "^primary$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --primary + elif egrep -iq "^mode:[0-9x_]*$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --mode $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM}) + elif egrep -iq "^mode:[0-9x_]*:[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --mode $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM}) --rate $(cut -d: -f3 <<< ${VIDEO_PORT_PARAM}) + elif egrep -iq "^lo:[A-z0-9]*$|^LeftOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --left-of $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) + elif egrep -iq "^ro:[A-z0-9]*$|^RightOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --right-of $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) + elif egrep -iq "^ab:[A-z0-9]*$|^Above:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --above $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) + elif egrep -iq "^be:[A-z0-9]*$|^Below:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --below $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) + elif egrep -iq "^Rotate:[A-z]*$" <<< "${VIDEO_PORT_PARAM}"; then + xrandr --output ${VIDEO_PORT^^} --rotate $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) + fi + if [[ -n ${MODELINE} ]]; then + xrandr --newmode ${MODELINE} + xrandr --addmode ${VIDEO_PORT^^} $(cut -d" " -f1 <<< ${MODELINE}) + xrandr --output ${VIDEO_PORT^^} --mode $(cut -d" " -f1 <<< ${MODELINE}) + fi + done < <(tr ',' '\n' <<< "${XRANDR_MONITOR[${VIDEO_PORT}]}") + done diff --git a/ublinux/rc.xorg/10-fixkeyboard_layout b/ublinux/rc.xorg/10-fixkeyboard_layout new file mode 100755 index 0000000..5d2cb71 --- /dev/null +++ b/ublinux/rc.xorg/10-fixkeyboard_layout @@ -0,0 +1,23 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +. /usr/lib/ublinux/os-config + +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/keyboard; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +#setxkbmap $XkbLayout -model $XkbModel -option $XkbOptions + +# Automatic detection PC/notebooks +if [ -z "$NUMLOCK" ] ; then + if xinput list | grep -qi touchpad ; then + NUMLOCK=no + else + NUMLOCK=yes + fi +fi + +[ "$NUMLOCK" = "yes" -o "$NUMLOCK" = "on" ] && numlockx on +[ "$NUMLOCK" = "no" -o "$NUMLOCK" = "off" ] && numlockx off diff --git a/ublinux/rc.xorg/50-domain_join b/ublinux/rc.xorg/50-domain_join new file mode 100755 index 0000000..58b73c3 --- /dev/null +++ b/ublinux/rc.xorg/50-domain_join @@ -0,0 +1,36 @@ +#!/bin/bash +# to be sourced + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +SOURCE=/usr/lib/ublinux/os-config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 +SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/network; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null + + +if [ ! -z "$ADSERVER" ] ;then + + export PATH=$PATH:/usr/lib/ublinux/scripts:/opt/secretnet/sbin:/opt/secretnet/bin:/usr/lib/qt4/bin + + # Time synchronization + systemctl stop ntpd + /usr/sbin/ntpdate $ADSERVER >/dev/null 2>&1 + systemctl start ntpd + + if ! echo -e "\n\n\n" | net ads testjoin ;then + /usr/share/ublinux/ad_join/ad_join.pl + fi + + xsetroot -cursor_name left_ptr + systemctl restart smb + systemctl restart winbind + + # launch some rc scripts + for a in /usr/lib/ublinux/rc.domain/* ;do + [ -x $a ] && $a + done + for a in /usr/lib/ublinux/rc.domain.d/* ;do + [ -x $a ] && $a & + done +fi diff --git a/ublinux/rc.xorg/60-checknet b/ublinux/rc.xorg/60-checknet new file mode 100755 index 0000000..cafafac --- /dev/null +++ b/ublinux/rc.xorg/60-checknet @@ -0,0 +1,30 @@ +#!/bin/sh + +ENABLED=no +[ "$ENABLED" != "yes" ] && exit 0 + +SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null +SOURCE=${SYSCONF}/desktop; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null + +TESTNETWORK=yes +TESTNETTOOL="ping -c 1 " +TESTNETSERVER="77.88.8.8" +STARTNWTOOL=/usr/share/ublinux/i3term/zenWIFI +WM=marco +TESTINDE=i3term + +. /usr/lib/ublinux/os-config + +[ -f /run/$(basename $0)_started ] && exit 0 + +if [ "$DESKTOP" = "$TESTINDE" ] ;then + if [ "$TESTNETWORK" = "yes" ] ;then + if ! $TESTNETTOOL $TESTNETSERVER >/dev/null 2>/dev/null ;then + $WM & + pid=$! + su -l root -c "$STARTNWTOOL" + kill $pid + echo 1 >/run/$(basename $0)_started + fi + fi +fi diff --git a/ublinux/rc.xorg/90-secretnet b/ublinux/rc.xorg/90-secretnet new file mode 100755 index 0000000..b04bc4d --- /dev/null +++ b/ublinux/rc.xorg/90-secretnet @@ -0,0 +1,16 @@ +#!/bin/bash + +ENABLED=yes +[ "$ENABLED" != "yes" ] && exit 0 + +SNLIBS=/opt/secretnet/lib + +[ -d "$SNLIBS" ] || exit 0 +getent group snlogger || addgroup snlogger +getent group snadmin || addgroup snadmin +ldconfig $SNLIBS +systemctl is-active sn >/dev/null || systemctl restart sn + +export PATH=$PATH:/usr/lib/ublinux/scripts:/opt/secretnet/sbin:/opt/secretnet/bin:/usr/lib/qt4/bin +/opt/secretnet/bin/snaidectl -i +/opt/secretnet/sbin/snunblock diff --git a/ublinux/rootfs-patches/clean_distr.sh b/ublinux/rootfs-patches/clean_distr.sh new file mode 100755 index 0000000..2027ecd --- /dev/null +++ b/ublinux/rootfs-patches/clean_distr.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +rm -fr 2>/dev/null \ + etc/skel/tmp var/tmp proc sys tmp etc/fstab etc/mtab \ + boot/initrd* boot/initramfs* \ + etc/locale usr/share/locale/locale-archive usr/lib/locale/locale-archive \ + etc/machine-id \ + etc/modprobe.d/nvidia[0-9]* \ + etc/X11/xorg.conf etc/adjtime etc/localtime \ + etc/xdg/autostart/parcellite-startup.desktop \ + etc/xdg/autostart/org.kde.kgpg.desktop \ + etc/xdg/autostart/lxqt-xscreensaver-autostart.desktop \ + etc/xdg/autostart/hplip-systray.desktop \ + etc/xdg/plasma-workspace/env/gtk*.sh \ + usr/share/GeoIP/GeoLiteCity.dat \ + usr/share/apps/kio_desktop/DesktopLinks/* \ + usr/share/applications/gscriptor.desktop \ + usr/share/doc/proftpd/Configuration.pdf usr/share/doc/easytag/users_* usr/share/doc/easytag/*_Documentation_* \ + usr/share/doc/djvulibre/doc usr/share/doc/initscripts/ChangeLog* usr/share/doc/libglib2.0-devel/ChangeLog \ + usr/share/doc/plasma-applet-stackfolder usr/share/doc/glibc/ChangeLog* \ + usr/share/doc/HTML/ru/marble usr/share/doc/HTML/ru/kalzium usr/share/doc/HTML/ru/kigo \ + usr/share/doc/HTML/ru/kstars usr/share/doc/HTML/ru/kbruch usr/share/doc/HTML/ru/akregator \ + usr/share/help/C/cheese/figures/effects.png \ + usr/share/doc/perl-Libconf/html/Libconf/Libconf \ + usr/share/backgrounds/gnome usr/share/backgrounds/mate \ + usr/share/xsessions/openbox*.desktop usr/share/kio_desktop/DesktopLinks/* \ + usr/share/sddm/themes/elarun/images/background.png +# etc/samba/passdb.tdb etc/samba/secrets.tdb \ +# usr/share/GeoIP/GeoLiteCity.dat 2>/dev/null + + +#wallpapers +[ -d usr/share/wallpapers ] && for a in usr/share/wallpapers/* ;do [ -d "$a" ] && rm -fr "$a" ; done + +#Kill big icons to save some space +[ -d usr/share/icons ] && for a in `find usr/share/icons -type d | egrep -e '[x/]512$|[x/]256$|/128x128$' ` ;do rm -fr "$a" ; done + +#KDE +rm -fr 2>/dev/null usr/share/autostart/kaddressbookmigrator.desktop \ + usr/share/autostart/kalarm.autostart.desktop \ + usr/share/autostart/konqy_preload.desktop \ + usr/share/autostart/nepomukcontroller.desktop \ + usr/share/autostart/nepomukserver.desktop \ + usr/share/apps/ksplash/Themes + +#openbox +rm -fr 2>/dev/null "usr/share/themes/Default/openbox-3" + +#emerald +rm -fr 2>/dev/null usr/share/emerald/theme + +#GTK themes +DIRGTK=gtk-2.0 +DIRGTK3=gtk-3.0 +DIRMETACITY=metacity-1 +rm -fr 2>/dev/null "usr/share/themes/Default/$DIRGTK" "usr/share/themes/Default/$DIRGTK3" "usr/share/themes/Default/$DIRMETACITY" +rm -fr 2>/dev/null "etc/$DIRGTK/gtkrc" "etc/$DIRGTK/apps" "etc/$DIRGTK/images" + +#pulseaudio +rm -f 2>/dev/null etc/alternatives/soundprofile etc/xdg/autostart/pulseaudio.desktop + +exit 0 diff --git a/ublinux/rootfs-patches/ublinux/ublinux-00-install.sh b/ublinux/rootfs-patches/ublinux/ublinux-00-install.sh new file mode 100755 index 0000000..688b151 --- /dev/null +++ b/ublinux/rootfs-patches/ublinux/ublinux-00-install.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +unset ROOTFS && [ -d ${ROOTFS}usr/lib/ublinux ] || ROOTFS=/ + +#/sbin +#grep -q ifup-pre-local ${ROOTFS}etc/ublinux/network-scripts/ifup 2>/dev/null && ln -sf /usr/lib/ublinux/sbin/ifup-pre-local ${ROOTFS}sbin + +#/etc/rc.d +INITD=${ROOTFS}etc/rc.d/init.d +[ -d $INITD ] || INITD=${ROOTFS}etc/init.d +[ -d $INITD ] && find ${ROOTFS}usr/lib/ublinux/rc.d/init.d -type f | sed s%${ROOTFS}usr/lib/ublinux/rc.d/init.d/%% | while read a ;do + ln -sf /usr/lib/ublinux/rc.d/init.d/$a $INITD +done + +#systemd +SYSTEMDFILES=${ROOTFS}usr/lib/systemd/system +[ -d $SYSTEMDFILES ] || SYSTEMDFILES=${ROOTFS}lib/systemd/system +[ -d $SYSTEMDFILES ] && find ${ROOTFS}usr/lib/ublinux/systemd -type f | sed s%${ROOTFS}usr/lib/ublinux/systemd/%% | while read a ;do + ln -sf /usr/lib/ublinux/systemd/$a $SYSTEMDFILES +done +[ -d $SYSTEMDFILES ] && ls -1d ${ROOTFS}usr/lib/ublinux/systemd/*.wants | sed s%${ROOTFS}usr/lib/ublinux/systemd/%% | while read a ;do + mkdir -p $SYSTEMDFILES/$a + cp -df ${ROOTFS}usr/lib/ublinux/systemd/$a/* $SYSTEMDFILES/$a +done + +ln -sf /usr/lib/ublinux/rc.d/rc.xorg ${ROOTFS}etc/X11/xinit/xinitrc.d/00-ublinux-rc-xorg + +cat > ${ROOTFS}etc/xdg/autostart/ublinux-rc.desktop << EOF +[Desktop Entry] +Categories= +Comment=Run applications at system start +Comment[ru]=Автозапуск приложений при старте +Exec=/usr/lib/ublinux/rc.d/rc.desktop +GenericName[ru]= +GenericName= +Icon= +MimeType= +Name=UBLinux autoexec +Name[ru]=Автозапуск UBLinux +Path= +StartupNotify=false +Terminal=false +Type=Application +X-DBUS-ServiceName= +X-DBUS-StartupType=unique +X-KDE-StartupNotify=false +X-KDE-SubstituteUID=false +X-KDE-Username= +EOF + +exit 0 diff --git a/ublinux/rootfs-patches/ublinux_db_patch_distr.sh b/ublinux/rootfs-patches/ublinux_db_patch_distr.sh new file mode 100755 index 0000000..66827fa --- /dev/null +++ b/ublinux/rootfs-patches/ublinux_db_patch_distr.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo $0 +find /usr/lib/ublinux/rootfs-patches/ublinux_db -type f -name \*.sh | sort | while read a ;do + echo $a + bash $a +done diff --git a/ublinux/rootfs-patches/ublinux_de_patch_distr.sh b/ublinux/rootfs-patches/ublinux_de_patch_distr.sh new file mode 100755 index 0000000..f8dbc45 --- /dev/null +++ b/ublinux/rootfs-patches/ublinux_de_patch_distr.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo $0 +find /usr/lib/ublinux/rootfs-patches/ublinux_de -type f -name \*.sh | sort | while read a ;do + echo $a + bash $a +done diff --git a/ublinux/rootfs-patches/ublinux_edu_patch_distr.sh b/ublinux/rootfs-patches/ublinux_edu_patch_distr.sh new file mode 100755 index 0000000..8ed9316 --- /dev/null +++ b/ublinux/rootfs-patches/ublinux_edu_patch_distr.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo $0 +find /usr/lib/ublinux/rootfs-patches/ublinux_edu -type f -name \*.sh | sort | while read a ;do + echo $a + bash $a +done diff --git a/ublinux/rootfs-patches/ublinux_patch_distr.sh b/ublinux/rootfs-patches/ublinux_patch_distr.sh new file mode 100755 index 0000000..af54d36 --- /dev/null +++ b/ublinux/rootfs-patches/ublinux_patch_distr.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo $0 +find /usr/lib/ublinux/rootfs-patches/ublinux -type f -name \*.sh | sort | while read a ;do + echo $a + bash $a +done diff --git a/ublinux/rootfs-patches/ublinux_srv_patch_distr.sh b/ublinux/rootfs-patches/ublinux_srv_patch_distr.sh new file mode 100755 index 0000000..d30632d --- /dev/null +++ b/ublinux/rootfs-patches/ublinux_srv_patch_distr.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo $0 +find /usr/lib/ublinux/rootfs-patches/ublinux_srv -type f -name \*.sh | sort | while read a ;do + echo $a + bash $a +done diff --git a/ublinux/scripts/gpu_passthrough_revert.sh b/ublinux/scripts/gpu_passthrough_revert.sh new file mode 100755 index 0000000..8440263 --- /dev/null +++ b/ublinux/scripts/gpu_passthrough_revert.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -x + +# Re-Bind GPU to Nvidia Driver +virsh nodedev-reattach pci_0000_09_00_1 +virsh nodedev-reattach pci_0000_09_00_0 + +# Reload nvidia modules +modprobe nvidia +modprobe nvidia_modeset +modprobe nvidia_uvm +modprobe nvidia_drm + +# Rebind VT consoles +echo 1 > /sys/class/vtconsole/vtcon0/bind +# Some machines might have more than 1 virtual console. Add a line for each corresponding VTConsole +#echo 1 > /sys/class/vtconsole/vtcon1/bind + +nvidia-xconfig --query-gpu-info > /dev/null 2>&1 +echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind + +# Restart Display Manager +systemctl start display-manager.service \ No newline at end of file diff --git a/ublinux/scripts/gpu_passthrough_single.sh b/ublinux/scripts/gpu_passthrough_single.sh new file mode 100755 index 0000000..5e83c0e --- /dev/null +++ b/ublinux/scripts/gpu_passthrough_single.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# https://github.com/joeknock90/Single-GPU-Passthrough +# https://passthroughpo.st/simple-per-vm-libvirt-hooks-with-the-vfio-tools-hook-helper/ +# https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF +# https://pve.proxmox.com/wiki/Pci_passthrough +# set PARAM_KERNEL="video=vesafb:off,efifb:off rd.driver.pre=vfio_pci amd_iommu=on iommu=pt vfio-pci.ids=10de:1287,10de:0e0f vfio-pci.disable_vga=1 snd-hda-intel.enable_msi=1" + +# Helpful to read output when debugging +set -x + +# Stop display manager +systemctl stop display-manager.service +## Uncomment the following line if you use GDM +#killall gdm-x-session + +# Unbind VTconsoles +echo 0 > /sys/class/vtconsole/vtcon0/bind +echo 0 > /sys/class/vtconsole/vtcon1/bind + +# Unbind EFI-Framebuffer +echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind + +# Avoid a Race condition by waiting 2 seconds. This can be calibrated to be shorter or longer if required for your system +sleep 2 + +modprobe -r vfio-pci +modprobe -r nvidia_drm +modprobe -r nvidia_modeset +modprobe -r drm_kms_helper +modprobe -r drm +modprobe -r nvidia_uvm +modprobe -r nvidia + +# Unbind the GPU from display driver +virsh nodedev-detach pci_0000_09_00_0 +virsh nodedev-detach pci_0000_09_00_1 + +# Load VFIO Kernel Module +modprobe vfio-pci \ No newline at end of file diff --git a/ublinux/scripts/printers_setup.sh b/ublinux/scripts/printers_setup.sh new file mode 100755 index 0000000..0d6398b --- /dev/null +++ b/ublinux/scripts/printers_setup.sh @@ -0,0 +1,150 @@ +#!/usr/bin/env bash +## +## printers_setup.sh [$1 $2] +## without $1 $2 - Action=auto +## $1 - Action +## add +## remove +## $2 - Device name +## /dev/lp0 +## or +## sys/devices/pci0000:00/0000:00:14.0/usb1/1-8 +## + +# Проверка на суперпользователя +#[[ $USER != 'root' ]] && exec sudo "$0" + +LIST_PPD=$(cat </dev/null)" + DEV_IDPRODUCT="$(cat /${DEVNAME}/../idProduct)" +# DEV_IDVENDOR="$(echo "${INFODEV}" | grep ATTRS{idVendor} | head -1 | grep -o '".*"' | tr -d '"' 2>/dev/null)" + DEV_IDVENDOR="$(cat /${DEVNAME}/../idVendor)" +# DEV_SERIAL="$(echo "${INFODEV}" | grep ATTRS{serial} | head -1 | grep -o '".*"' | tr -d '"' 2>/dev/null)" + DEV_SERIAL="$(cat /${DEVNAME}/../serial)" +# DEV_IEEE1284_ID="$(echo "${INFODEV}" | grep ATTRS{ieee1284_id} | head -1 | grep -o '".*"' | tr -d '"' | tr ";" "\n" 2>/dev/null)" + DEV_IEEE1284_ID="$(cat /${DEVNAME}/ieee1284_id | head -1 | tr ";" "\n")" + PRINTER_MFG="$(echo "${DEV_IEEE1284_ID}" | grep MFG | head -1 | cut -d: -f2 2>/dev/null)" + PRINTER_MDL="$(echo "${DEV_IEEE1284_ID}" | grep MDL | head -1 | cut -d: -f2 2>/dev/null)" + PRINTER_CMD="$(echo "${DEV_IEEE1284_ID}" | grep CMD | head -1 | cut -d: -f2 2>/dev/null)" + PRINTER_CLS="$(echo "${DEV_IEEE1284_ID}" | grep CLS | head -1 | cut -d: -f2 2>/dev/null)" + PRINTER_NAME=$(echo "${PRINTER_MDL}" | tr " " "-" 2>/dev/null) + for WAIT_TIME in 1 2 3 4; do + PRINTER_LP=$(basename $(ls -Udb /${DEVNAME}/usbmisc/lp* 2>/dev/null | head -1) 2>/dev/null) + [[ -z ${PRINTER_LP} ]] && sleep ${WAIT_TIME} || break + done +# PRINTER_LP="/dev/$(cat /${DEVNAME}/usbmisc/*/uevent | grep DEVNAME | cut -d= -f2)" + PRINTER_LP="/dev/usb/${PRINTER_LP}" + echo "$(date '+%m.%d.%Y %T') : $0 : init_printer : ${ACTION} : ${DEVNAME} : ${DEV_IDPRODUCT}:${DEV_IDVENDOR} : ${PRINTER_MFG} : ${PRINTER_MDL} : ${PRINTER_CMD} : ${PRINTER_CLS} : ${DEV_SERIAL} : ${PRINTER_NAME} : ${PRINTER_LP}" + [[ ${PRINTER_CLS} == "PRINTER" ]] || exit 1 + [[ -z ${PRINTER_NAME} ]] && exit 1 +# PATH_LOG="/tmp/printer-${DEV_SERIAL}.log" +} + +add_printer(){ + echo "$(date '+%m.%d.%Y %T') : $0 : add_printer : ${ACTION} : ${DEVNAME} : ${DEV_IDPRODUCT}:${DEV_IDVENDOR} : ${PRINTER_MFG} : ${PRINTER_MDL} : ${PRINTER_CMD} : ${PRINTER_CLS} : ${DEV_SERIAL} : ${PRINTER_NAME} : ${PRINTER_LP}" +# echo "${LIST_PPD}" | while read STR_PRINTER; do +# if [[ ${PRINTER_MDL} == $(echo ${STR_PRINTER} | cut -d":" -f1) ]]; then +# NAME_URI=$(lpinfo -v | grep "direct" | grep "${DEV_SERIAL}" | cut -d" " -f2 | head -1) +# NAME_PPD=$(lpinfo --make-and-model "${PRINTER_MDL}" -m | head -1 | cut -d" " -f1) +# lpadmin -E -p ${PRINTER_NAME} -E -v "${NAME_URI}" -m ${NAME_PPD} -D "Info" -L "Office" -o "printer-is-shared=false" -m ${NAME_PPD} +# fi +# done + if [[ ${PRINTER_CMD} == "CAPT" ]]; then +# /usr/bin/bash -c "${PATH_SETUP_CAPT} ${DEVNAME} ${ACTION}" + echo "$(date '+%m.%d.%Y %T') : $0 : Forward to CAPT script : ${ACTION} : ${DEVNAME} : ${DEV_IDPRODUCT}:${DEV_IDVENDOR} : ${PRINTER_MFG} : ${PRINTER_MDL} : ${PRINTER_CMD} : ${PRINTER_CLS} : ${DEV_SERIAL} : ${PRINTER_NAME} : ${PRINTER_LP}" + /usr/bin/bash -c "/usr/lib/ublinux/scripts/printers_setup_capt.sh ${ACTION} ${DEVNAME} " + else +# NAME_URI=$(lpinfo -v | grep "direct" | grep "usb:" | grep "${DEV_SERIAL}" | cut -d" " -f2 | head -1) + NAME_URI=$(/usr/lib/cups/backend/usb | grep "direct usb:" | grep "${DEV_SERIAL}" | cut -d" " -f2 | head -1) +# Если принтер добавлен совпадает частично имя принтера и серийник, то выходим + LC_ALL=en_US.UTF-8 lpstat -v "${PRINTER_NAME}" 2>/dev/null | grep -q ${NAME_URI} && return + NAME_PPD=$(lpinfo --make-and-model "${PRINTER_MDL}" -m | head -1 | cut -d" " -f1) + lpadmin -E -p "${PRINTER_NAME}" -E -v "${NAME_URI}" -m "${NAME_PPD}" -D "${PRINTER_NAME}" -L "Office" -o "printer-is-shared=false" +# PageSize A4 +# PAGESIZE_OPT=$(lpoptions -l -p "${PRINTER_NAME}" | egrep "PageSize|Page Size|Media Size" | head -1 | cut -d: -f1) +# [[ -n ${PAGESIZE_OPT} ]] && echo "lpoptions -E -p "${PRINTER_NAME}" -o "${PAGESIZE_OPT%%/*}"=A4" +# Duplex On +# DUPLEX_OPT=$(lpoptions -l -p "${PRINTER_NAME}" | egrep "HPOption_Duplexer|Duplex Unit|Duplexing" | head -1 | cut -d: -f1) +# [[ -n ${DUPLEX_OPT} ]] && echo "lpoptions -p "${PRINTER_NAME}" -o "${DUPLEX_OPT%%/*}"=True" + + lpoptions -E -d "${PRINTER_NAME}" >/dev/null + lpadmin -E -d "${PRINTER_NAME}" + cupsenable -E "${PRINTER_NAME}" + cupsaccept -E "${PRINTER_NAME}" + echo "export PRINTER=\"${PRINTER_NAME}\"" > /etc/profile.d/ublinux-default-printer.sh + echo "export LPDEST=\"${PRINTER_NAME}\"" >> /etc/profile.d/ublinux-default-printer.sh + echo "$(date '+%m.%d.%Y %T') : $0 : end add_printer : ${ACTION} : ${DEVNAME} : ${DEV_IDPRODUCT}:${DEV_IDVENDOR} : ${PRINTER_MFG} : ${PRINTER_MDL} : ${PRINTER_CMD} : ${PRINTER_CLS} : ${DEV_SERIAL} : ${PRINTER_NAME} : ${PRINTER_LP}" + fi +} + +remove_printer(){ + /usr/lib/ublinux/scripts/printers_setup_capt.sh ${ACTION} ${DEVNAME} +# Удаляем все принтеры которые не обнаружены /usr/lib/cups/backend/usb + while read STR_PRINTER; do + PRINTER_NAME=$(echo ${STR_PRINTER%%:*}) + URI=$(echo ${STR_PRINTER#*: }) +# Если принтер CAPT + echo ${URI} | grep -q "ccp://" 2>/dev/null && break +## if ! lpinfo -v | grep "direct" | grep " usb:" | cut -d" " -f2 | grep "${URI}"; then + if ! /usr/lib/cups/backend/usb | grep "direct" | grep " usb:" | cut -d" " -f2 | grep -q "${URI}"; then + cupsdisable -E "${PRINTER_NAME}" 2>/dev/null + cupsreject -E "${PRINTER_NAME}" 2>/dev/null +# lpadmin -x "${PRINTER_NAME}" 2>/dev/null + grep -q "${PRINTER_NAME}" /etc/profile.d/ublinux-default-printer.sh 2>/dev/null && rm -f /etc/profile.d/ublinux-default-printer.sh + echo "$(date '+%m.%d.%Y %T') : $0 : remove_printer : ${ACTION} : ${DEVNAME} : ${PRINTER_NAME}" + fi + done <<< "$(LC_ALL=en_US.UTF-8 lpstat -v 2>/dev/null | grep "device for" | sed "s/device for //")" +} + +################################################################# +# # +# Main # +# # +################################################################# + + PATH_SETUP_CAPT="/usr/lib/ublinux/scripts/printers_setup_capt.sh" + PATH_LOG="/var/log/cups/printers_setup.log" + + exec 3>&1 4>&2 + trap 'exec 2>&4 1>&3' 0 1 2 3 + exec 1>>${PATH_LOG} 2>&1 + + [[ -z ${ACTION} ]] && ACTION=$1 + [[ -z ${DEVNAME} ]] && DEVNAME=$2 + ([[ -z ${DEVNAME} || -z ${ACTION} ]]) && exit 0 + echo; echo "-------------------------------------------------------------------------------------------------------------------" + echo "$(date '+%m.%d.%Y %T') : $0 : Start : ${ACTION} : ${DEVNAME}" + + case "${ACTION}" in + add) + sleep 5 + init_printer + add_printer + ;; + remove) +# echo "${DEVNAME}" +# echo $0 $@ called by $PPID + remove_printer + ;; + esac + echo "$(date '+%m.%d.%Y %T') : $0 : Finish : ${ACTION} : ${DEVNAME}" + + + +#udevadm info -a -n /dev/usb/lp0 | grep "ATTRS{ieee1284_id}" + +#lpstat -v +#lpadmin -p M405 -v usb://HP/LaserJet%20Pro%20M404-M405?serial=PHCL262970 -E -m everywhere +#lpadmin -p 'GroceryPrinter' -E -v socket://$prt01/ipp/print -L 'Grocery Office' -m everywhere +#lpstat -l -p GroceryPrinter +#sudo udevadm control --reload-rules && udevadm trigger +#sudo udevadm test '/devices/pci0000:00/0000:00:14.0/usb1/1-8' \ No newline at end of file diff --git a/ublinux/scripts/printers_setup_capt.sh b/ublinux/scripts/printers_setup_capt.sh new file mode 100755 index 0000000..cd492ce --- /dev/null +++ b/ublinux/scripts/printers_setup_capt.sh @@ -0,0 +1,250 @@ +#!/usr/bin/env bash +## +## printers_setup_capt.sh [$1 $2] +## without $1 $2 - Action=auto +## $1 - Action +## add +## remove +## $2 - Device name +## /dev/lp0 +## or +## sys/devices/pci0000:00/0000:00:14.0/usb1/1-8 +## + +# Проверка на суперпользователя +#[[ $USER != 'root' ]] && exec sudo "$0" + +init_printer(){ + echo "${DEVNAME}" | grep -q "/dev/usb/lp" && DEVNAME="sys$(udevadm info -a -n ${DEVNAME} 2>/dev/null | grep "looking at" | head -1 | cut -d\' -f2 | sed "s/\/usbmisc.*//")" + [[ -z "${DEVNAME}" ]] && echo "$(date '+%m.%d.%Y %T') : $0 : ${ACTION} : ERROR : Not found DEVICE ${DEVNAME}"; [[ -z "${DEVNAME}" ]] && exit 1 + DEV_IDPRODUCT="$(cat /${DEVNAME}/../idProduct)" + DEV_IDVENDOR="$(cat /${DEVNAME}/../idVendor)" + DEV_SERIAL="$(cat /${DEVNAME}/../serial)" + DEV_IEEE1284_ID="$(cat /${DEVNAME}/ieee1284_id | head -1 | tr ";" "\n")" + PRINTER_MFG="$(echo "${DEV_IEEE1284_ID}" | grep MFG | head -1 | cut -d: -f2 2>/dev/null)" + PRINTER_MDL="$(echo "${DEV_IEEE1284_ID}" | grep MDL | head -1 | cut -d: -f2 2>/dev/null)" + PRINTER_CMD="$(echo "${DEV_IEEE1284_ID}" | grep CMD | head -1 | cut -d: -f2 2>/dev/null)" + PRINTER_CLS="$(echo "${DEV_IEEE1284_ID}" | grep CLS | head -1 | cut -d: -f2 2>/dev/null)" +# PRINTER_NAME="$(echo "${PRINTER_MDL}" | tr "/" "-" | tr " " "-" 2>/dev/null)-CAPT" + PRINTER_NAME="$(echo "${PRINTER_MDL}" | tr "/" "-" | tr " " "-" 2>/dev/null)" + PRINTER_NAME_PPD="$(echo "${PRINTER_MDL}" | tr " " "-" 2>/dev/null)" + for WAIT_TIME in 1 2 3 4; do + PRINTER_LP=$(basename $(ls -Udb /${DEVNAME}/usbmisc/lp* 2>/dev/null | head -1) 2>/dev/null) + [[ -z ${PRINTER_LP} ]] && sleep ${WAIT_TIME} || break + done +# PRINTER_LP="/dev/$(cat /${DEVNAME}/usbmisc/*/uevent | grep DEVNAME | cut -d= -f2)" + PRINTER_LP="/dev/usb/${PRINTER_LP}" + [[ ${PRINTER_MDL} == "LBP810" ]] && PRINTER_MDL="LBP1120" + echo "$(date '+%m.%d.%Y %T') : $0 : init_printer : ${ACTION} : ${DEVNAME} : ${DEV_IDPRODUCT}:${DEV_IDVENDOR} : ${PRINTER_MFG} : ${PRINTER_MDL} : ${PRINTER_CMD} : ${PRINTER_CLS} : ${DEV_SERIAL} : ${PRINTER_NAME} : ${PRINTER_LP}" + [[ ${PRINTER_MDL} ]] || exit 1 + [[ ${PRINTER_CLS} == "PRINTER" ]] || exit 1 + [[ ${PRINTER_CMD} == "CAPT" ]] || exit 1 +# Установка в AppArmor профиля в щадящий режим для cupsd +# aa-complain /usr/sbin/cupsd +} + +auto_detect_capt_lp(){ + echo "$(date '+%m.%d.%Y %T') : $0 : auto_detect_lp" + for DEV_LP in /dev/usb/lp*; do + INFODEV="$(udevadm info -a -n ${DEV_LP} 2>/dev/null)" + DEV_IEEE1284_ID="$(echo "${INFODEV}" | grep ATTRS{ieee1284_id} | head -1 | grep -o '".*"' | tr -d '"' | tr ";" "\n" 2>/dev/null)" + PRINTER_MDL="$(echo "${DEV_IEEE1284_ID}" | grep MDL | head -1 | cut -d: -f2 2>/dev/null)" + PRINTER_CMD="$(echo "${DEV_IEEE1284_ID}" | grep CMD | head -1 | cut -d: -f2 2>/dev/null)" + [[ ${PRINTER_CMD} == "CAPT" ]] && DEVNAME="$(udevadm info -a -n ${DEV_LP} | grep "looking at" | head -1 | cut -d\' -f2 | sed "s/\/usbmisc.*//")" && echo "$(date '+%m.%d.%Y %T') : $0 : Auto detect CAPT printer: ${DEV_LP}" || echo "$(date '+%m.%d.%Y %T') : $0 : Printer: ${DE_LP} is not CAPT !" + done +} + +# Удалить CAPT принтер, который определился и установился автоматически без CCPD +remove_not_ccpdcapt(){ + echo "$(date '+%m.%d.%Y %T') : $0 : remove_not_ccpdcapt : ${PRINTER_NAME}" + PRINTER_NOTCCP=$(LC_ALL=en_US.UTF-8 lpstat -v 2>/dev/null | grep " usb://.*${DEV_SERIAL}.*" | head -1 | cut -d: -f1 | cut -d" " -f3) + [[ -n ${PRINTER_NOTCCP} ]] && lpadmin -x "${PRINTER_NOTCCP}" && echo "$(date '+%m.%d.%Y %T') : $0 : remove_not_ccpdcapt : REMOVE : ${PRINTER_NOTCCP}" +# LC_ALL=en_US.UTF-8 lpstat -v "${PRINTER_NAME}" 2>/dev/null | grep -q " usb://.*${DEV_SERIAL}.*" | head -1 && lpadmin -x "${PRINTER_NAME}" && echo "$(date '+%m.%d.%Y %T') : $0 : remove_not_ccpdcapt : REMOVE : ${PRINTER_NAME}" +} + +add_printer(){ +# Сделать проверку, если принтер существует с одинаковым именем, но другой адрес ${PRINTER_LP} + if ! LC_ALL=en_US.UTF-8 lpstat -v "${PRINTER_NAME}" &>/dev/null; then + echo "$(date '+%m.%d.%Y %T') : $0 : add_printer : ${PRINTER_NAME}" + NAME_URI="ccp://localhost:59687" + NAME_PPD=$(lpinfo --make-and-model ${PRINTER_NAME_PPD} -m | head -1 | cut -d" " -f1) +# NAME_PPD=$(basename -- $(grep -H ${PRINTER_NAME} /usr/share/cups/model/*.ppd | head -1 | cut -d: -f1)) + lpadmin -E -p "${PRINTER_NAME}" -E -v "${NAME_URI}" -m "${NAME_PPD}" -D "${PRINTER_NAME}" -L "Office" -o "printer-is-shared=false" + sleep 2 + ccpdadmin -p "${PRINTER_NAME}" -o "${PRINTER_LP}" + systemctl -q is-active ccpd.service 2>/dev/null && systemctl restart ccpd.service || systemctl enable --now ccpd.service 2>/dev/null + fi +# PageSize +# PAGESIZE_OPT=$(lpoptions -l -p ${PRINTER_NAME} | egrep "PageSize|Media Size" | head -1 | cut -d: -f1) +# [[ ${PAGESIZE_OPT} ]] && echo "lpoptions -E -p ${PRINTER_NAME} -o ${PAGESIZE_OPT%%/*}=A4" +# Duplex On +# DUPLEX_OPT=$(lpoptions -l -p ${PRINTER_NAME} | egrep "HPOption_Duplexer|Duplex Unit|Duplexing" | head -1 | cut -d: -f1) +# [[ ${DUPLEX_OPT} ]] && echo "lpoptions -p ${PRINTER_NAME} -o ${DUPLEX_OPT%%/*}=True" + lpoptions -E -d "${PRINTER_NAME}" &>/dev/null + lpadmin -E -d "${PRINTER_NAME}" + cupsenable -E "${PRINTER_NAME}" + cupsaccept -E "${PRINTER_NAME}" + echo "export PRINTER=\"${PRINTER_NAME}\"" > /etc/profile.d/ublinux-default-printer.sh + echo "export LPDEST=\"${PRINTER_NAME}\"" >> /etc/profile.d/ublinux-default-printer.sh +} + +remove_printer(){ + while read PRINTER_DEV_LP_CAPT; do + if [[ ! -e "${PRINTER_DEV_LP_CAPT}" ]] || echo "${DEVNAME}" | grep -q "/dev/usb/lp"; then + PRINTER_NAME=$(cat /etc/ccpd.conf | grep -B1 "^DevicePath" | head -1 | tr -d "<&>" | cut -d" " -f2) + echo "$(date '+%m.%d.%Y %T') : $0 : remove_printer : ${ACTION} : ${DEVNAME} : ${PRINTER_DEV_LP_CAPT} : ${PRINTER_NAME}" + cupsdisable -E "${PRINTER_NAME}" 2>/dev/null + cupsreject -E "${PRINTER_NAME}" 2>/dev/null +# ccpdadmin -x "${PRINTER_NAME}" +# lpadmin -x "${PRINTER_NAME}" 2>/dev/null + systemctl disable --now ccpd.service 2>/dev/null + pkill -9 -x ccpd + pkill -9 -x captmoncnabc + grep -q "${PRINTER_NAME}" /etc/profile.d/ublinux-default-printer.sh 2>/dev/null && rm -f /etc/profile.d/ublinux-default-printer.sh + fi + done <<< "$(systemctl -q is-enabled ccpd.service && [[ -f /etc/ccpd.conf ]] && cat /etc/ccpd.conf | grep "^DevicePath" | cut -d" " -f2 | xargs)" +# Удалить все принтеры CCP + while read PRINTER_CCP; do + echo "$(date '+%m.%d.%Y %T') : $0 : remove_printer : REMOVE PRINTER CCP: ${PRINTER_CCP}" +# cupsdisable -E "${PRINTER_CCP}" 2>/dev/null +# cupsreject -E "${PRINTER_CCP}" 2>/dev/null +# ccpdadmin -x "${PRINTER_CCP}" +# lpadmin -x "${PRINTER_CCP}" + done <<< "$(LC_ALL=en_US.UTF-8 lpstat -v 2>/dev/null | grep " ccp://" | cut -d: -f1 | cut -d" " -f3)" +# [[ -n "${PRINTER_NAME}" ]] && return 0 || return 1 +} + +start_captstatusui(){ + NAME_CAPTSTATUSUI="captstatusui-${PRINTER_NAME}" + DESKTOP_CAPTSTATUSUI="${NAME_CAPTSTATUSUI}.desktop" + SERVICE_CAPTSTATUSUI="${NAME_CAPTSTATUSUI}.service" +# Создаем кнопку запуска captstatusui + echo "$(date '+%m.%d.%Y %T') : $0 : start_captstatusui : ${PATH_APPLICATION}/${DESKTOP_CAPTSTATUSUI}" + echo '[Desktop Entry] +Type=Application +Exec=captstatusui -P '${PRINTER_NAME}' +Terminal=false +Icon=printer +Name=Satus Canon CAPT '${PRINTER_NAME}' +Name[ru]=Статус Canon CAPT '${PRINTER_NAME}' +GenericName=Status monitor for Canon CAPT Printer '${PRINTER_NAME}' +GenericName[ru]=Статус для принтера Canon CAPT '${PRINTER_NAME}' +Comment=Status monitor for Canon CAPT Printer '${PRINTER_NAME}' +Comment[ru]=Статус для принтера Canon CAPT '${PRINTER_NAME} > "${PATH_APPLICATION}/${DESKTOP_CAPTSTATUSUI}" + chmod 644 "${PATH_APPLICATION}/${DESKTOP_CAPTSTATUSUI}" +# ln -sf "${PATH_APPLICATION}/${DESKTOP_CAPTSTATUSUI}" "${XDG_AUTOSTART}" + find /home/*/"${XDG_DESKTOP_DIR}" -maxdepth 0 -type d -exec cp "${PATH_APPLICATION}/${DESKTOP_CAPTSTATUSUI}" {} \; + find /home/*/"${XDG_DESKTOP_DIR}" -maxdepth 1 -type f -iname "${DESKTOP_CAPTSTATUSUI}" -exec chmod 0777 {} \; + find /home/*/"${XDG_DESKTOP_DIR}" -maxdepth 1 -type f -iname "${DESKTOP_CAPTSTATUSUI}" -exec chown root:users {} \; +# Запуск captstatusui +# [[ -n "${DISPLAY}" && -n ${LOGIN_USER} ]] && su ${LOGIN_USER} -c "nohup captstatusui -P ${PRINTER_NAME} -e 2>&1 &" +# DISPLAY=:0 su superadmin -c "nohup captstatusui -P LBP2900 2>&1 &" +echo '[Unit] +Description=Start captstatusui for printer '${PRINTER_NAME}' +Requires=graphical-session.target +After=graphical-session.target + +[Service] +ExecStart=/usr/bin/captstatusui -P '${PRINTER_NAME}' -e +Restart=always +RestartSec=3s + +[Install] +WantedBy=default.target' > /usr/lib/systemd/user/${SERVICE_CAPTSTATUSUI} +# systemctl daemon-reload + systemctl --global enable ${SERVICE_CAPTSTATUSUI} +# [[ -n ${LOGIN_USER} ]] && systemctl --machine=${LOGIN_USER}@.host --user daemon-reload 2>/dev/null + [[ -n ${LOGIN_USER} ]] && systemctl --machine=${LOGIN_USER}@.host --user start --now ${SERVICE_CAPTSTATUSUI} 2>/dev/null +} + +stop_captstatusui(){ + [[ -z ${PRINTER_NAME} ]] && PRINTER_NAME=* + NAME_CAPTSTATUSUI="captstatusui-${PRINTER_NAME}" + DESKTOP_CAPTSTATUSUI="${NAME_CAPTSTATUSUI}.desktop" + SERVICE_CAPTSTATUSUI="${NAME_CAPTSTATUSUI}.service" + echo "$(date '+%m.%d.%Y %T') : $0 : stop_captstatusui : ${PATH_APPLICATION}/${DESKTOP_CAPTSTATUSUI}" + [[ -n ${LOGIN_USER} ]] && systemctl -q --machine=${LOGIN_USER}@.host --user disable --now ${SERVICE_CAPTSTATUSUI} 2>/dev/null + systemctl --global disable ${SERVICE_CAPTSTATUSUI} +# rm -f "${XDG_AUTOSTART}/${DESKTOP_CAPTSTATUSUI}" + find ${PATH_APPLICATION} -maxdepth 2 -iname ${DESKTOP_CAPTSTATUSUI} -delete + find /home/*/"${XDG_DESKTOP_DIR}"/ -maxdepth 2 -iname ${DESKTOP_CAPTSTATUSUI} -delete + find /usr/lib/systemd/user/ -maxdepth 2 -iname ${SERVICE_CAPTSTATUSUI} -delete + pkill -9 -x captstatusui +# [[ -n ${LOGIN_USER} ]] && systemctl --machine=${LOGIN_USER}@.host --user daemon-reload 2>/dev/null +# systemctl daemon-reload +} + +################################################################# +# # +# Main # +# # +################################################################# + + PATH_LOG="/var/log/cups/printers_setup.log" + exec 3>&1 4>&2 + trap 'exec 2>&4 1>&3' 0 1 2 3 + exec 1>>${PATH_LOG} 2>&1 + + [[ -n $1 ]] && ACTION="$1" || ACTION="add" + [[ -n $2 ]] && DEVNAME="$2" || auto_detect_capt_lp + + echo "$(date '+%m.%d.%Y %T') : $0 : Start: ${ACTION} : ${DEVNAME}" + +# Пользователь под которым мы вошли в ситему + LOGIN_USER=$(who | grep "(:[[:digit:]])" | grep "tty" | head -1 | cut -d" " -f1) #" +# [[ -z ${LOGIN_USER} ]] && LOGIN_USER="root" +# LOGIN_USER_HOME=$(su ${LOGIN_USER} -c env | grep -i "home=" | xargs | cut -d'=' -f2) +# export DISPLAY=$(ps -u $(id -u) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n' | grep -m1 '^DISPLAY=' | cut -d= -f2 2>/dev/null) +# echo $DISPLAY + XDG_AUTOSTART="/etc/xdg/autostart" + PATH_APPLICATION="/usr/share/applications" +# Подгружаем файл содержащий путь до рабочего стола + XDG_DESKTOP_DIR=$(cat $(find /home/*/.config/user-dirs.dirs -type f -print -quit) | grep XDG_DESKTOP_DIR | cut -d= -f2 | tr -d '"' | cut -d"/" -f2) + [[ -z ${XDG_DESKTOP_DIR} ]] && XDG_DESKTOP_DIR="Рабочий стол" + case "$ACTION" in + add) + sleep 2 + init_printer + remove_not_ccpdcapt + add_printer + start_captstatusui + sleep 20 + remove_not_ccpdcapt + ;; + remove) + remove_printer + stop_captstatusui + ;; + esac + echo "$(date '+%m.%d.%Y %T') : $0 : Finish : ${ACTION} : ${DEVNAME}" + +#udevadm info -a -n /dev/usb/lp0 | grep "ATTRS{ieee1284_id}" +#lpstat -v +#lpadmin -p M405 -v usb://HP/LaserJet%20Pro%20M404-M405?serial=PHCL262970 -E -m everywhere +#lpadmin -p 'GroceryPrinter' -E -v socket://$prt01/ipp/print -L 'Grocery Office' -m everywhere +#lpstat -l -p GroceryPrinter +#sudo udevadm control --reload-rules && udevadm trigger +#sudo udevadm test '/devices/pci0000:00/0000:00:14.0/usb1/1-8' + +#ссылки на утилиту autoshutdowntool +#declare -A URL_ASDT=([amd64]='https://drive.google.com/uc?export=download&confirm=no_antivirus&id=0Byemcyi98JRjc0s2YlJVZ0xBckk' \ +#[i386]='https://drive.google.com/uc?export=download&confirm=no_antivirus&id=0Byemcyi98JRjdzFlWjVnbGpBMFU') + +#соостветствие ppd файлов и моделей принтеров +#declare -A LASERSHOT=([LBP-810]=1120 [LBP-1120]=1120 [LBP-1210]=1210 \ +#[LBP2900]=2900 [LBP3000]=3000 [LBP3010]=3050 [LBP3018]=3050 [LBP3050]=3050 \ +#[LBP3100]=3150 [LBP3108]=3150 [LBP3150]=3150 [LBP3200]=3200 [LBP3210]=3210 \ +#[LBP3250]=3250 [LBP3300]=3300 [LBP3310]=3310 [LBP3500]=3500 [LBP5000]=5000 \ +#[LBP5050]=5050 [LBP5100]=5100 [LBP5300]=5300 [LBP6000]=6018 [LBP6018]=6018 \ +#[LBP6020]=6020 [LBP6020B]=6020 [LBP6200]=6200 [LBP6300n]=6300n [LBP6300]=6300 \ +#[LBP6310]=6310 [LBP7010C]=7018C [LBP7018C]=7018C [LBP7200C]=7200C [LBP7210C]=7210C \ +#[LBP9100C]=9100C [LBP9200C]=9200C) + +#отсортированные имена принтеров +#NAMESPRINTERS=$(echo "${!LASERSHOT[@]}" | tr ' ' '\n' | sort -n -k1.4) + +#список моделей, которые поддерживаются утилитой автоотключения +#declare -A ASDT_SUPPORTED_MODELS=([LBP6020]='MTNA002001 MTNA999999' \ +#[LBP6020B]='MTMA002001 MTMA999999' [LBP6200]='MTPA00001 MTPA99999' \ +#[LBP6310]='MTLA002001 MTLA999999' [LBP7010C]='MTQA00001 MTQA99999' \ +#[LBP7018C]='MTRA00001 MTRA99999' [LBP7210C]='MTKA002001 MTKA999999') diff --git a/ublinux/scripts/ubxswitcher.sh b/ublinux/scripts/ubxswitcher.sh new file mode 100755 index 0000000..401e1e0 --- /dev/null +++ b/ublinux/scripts/ubxswitcher.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Переключаем раскладку + xdotool key --delay 20 Mode_switch +# Делаем бэкап последней записи буфера + BACKUPCLIPB=$(xsel -b) + if [[ -n $1 ]]; then + xdotool key --delay 150 Control + xdotool key --delay 150 Control+Left +# xdotool keydown --delay 150 Control key --delay 150 Left keyup --delay 150 Control + xdotool key --delay 50 Shift+End + else + xdotool key --delay 150 End + xdotool key --delay 150 End + xdotool key --delay 50 Shift+Home + fi + xdotool key --delay 50 Control+Insert + SELCLIPB=$(xsel -b) + CONVCLIPB=$(echo -n "${SELCLIPB}" | sed "y/\ +abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ[]{};':\",.\/<>?@#\$^&\`~фисвуапршолдьтщзйкыегмцчняФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯхъХЪжэЖЭбюБЮ№ёЁ/\ +фисвуапршолдьтщзйкыегмцчняФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯхъХЪжэЖЭбю.БЮ,\"№;:?ёЁabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ[]{};':\",.<>#\`~/") +# Конвертируем символы + echo -n "${CONVCLIPB}" | xsel -b -i; sleep 0.2 + xdotool key --delay 50 Shift_R+Insert +# Восстанавливаем бэкап последней записи буфера + echo -n "${BACKUPCLIPB}" | xsel -b -i +# echo -n "${BACKUPCLIPB}" | xsel -p -i + + + + diff --git a/ublinux/systemd/basic.target.wants/ublinux-postinit.service b/ublinux/systemd/basic.target.wants/ublinux-postinit.service new file mode 120000 index 0000000..2096395 --- /dev/null +++ b/ublinux/systemd/basic.target.wants/ublinux-postinit.service @@ -0,0 +1 @@ +../ublinux-postinit.service \ No newline at end of file diff --git a/ublinux/systemd/multi-user.target.wants/ublinux-pre-shutdown.service b/ublinux/systemd/multi-user.target.wants/ublinux-pre-shutdown.service new file mode 120000 index 0000000..3cb7601 --- /dev/null +++ b/ublinux/systemd/multi-user.target.wants/ublinux-pre-shutdown.service @@ -0,0 +1 @@ +../ublinux-pre-shutdown.service \ No newline at end of file diff --git a/ublinux/systemd/multi-user.target.wants/ublinux-rc-local.service b/ublinux/systemd/multi-user.target.wants/ublinux-rc-local.service new file mode 120000 index 0000000..cad79be --- /dev/null +++ b/ublinux/systemd/multi-user.target.wants/ublinux-rc-local.service @@ -0,0 +1 @@ +../ublinux-rc-local.service \ No newline at end of file diff --git a/ublinux/systemd/multi-user.target.wants/ublinux-rc-network.service b/ublinux/systemd/multi-user.target.wants/ublinux-rc-network.service new file mode 120000 index 0000000..865c0bb --- /dev/null +++ b/ublinux/systemd/multi-user.target.wants/ublinux-rc-network.service @@ -0,0 +1 @@ +../ublinux-rc-network.service \ No newline at end of file diff --git a/ublinux/systemd/printers-setup@.service b/ublinux/systemd/printers-setup@.service new file mode 100644 index 0000000..cff4c14 --- /dev/null +++ b/ublinux/systemd/printers-setup@.service @@ -0,0 +1,7 @@ +[Unit] +Description=UBLinux configure Plugged-In Printer +Requires=cups.socket +After=cups.socket + +[Service] +ExecStart=/usr/bin/bash /usr/lib/ublinux/scripts/printers_setup.sh add %I diff --git a/ublinux/systemd/shutdown.target.wants/ublinux-shutdown.service b/ublinux/systemd/shutdown.target.wants/ublinux-shutdown.service new file mode 120000 index 0000000..2c3c0df --- /dev/null +++ b/ublinux/systemd/shutdown.target.wants/ublinux-shutdown.service @@ -0,0 +1 @@ +../ublinux-shutdown.service \ No newline at end of file diff --git a/ublinux/systemd/ublinux-postinit.service b/ublinux/systemd/ublinux-postinit.service new file mode 100644 index 0000000..34949da --- /dev/null +++ b/ublinux/systemd/ublinux-postinit.service @@ -0,0 +1,12 @@ +[Unit] +Description=UBLinux autorun scripts - postinit stage +DefaultDependencies=no +Conflicts=shutdown.target +Before=basic.target shutdown.target +After=local-fs.target + +[Service] +ExecStart=-/usr/lib/ublinux/rc.d/rc.post +Type=oneshot +TimeoutSec=0 +StandardInput=tty diff --git a/ublinux/systemd/ublinux-pre-shutdown.service b/ublinux/systemd/ublinux-pre-shutdown.service new file mode 100644 index 0000000..c0a4642 --- /dev/null +++ b/ublinux/systemd/ublinux-pre-shutdown.service @@ -0,0 +1,16 @@ +[Unit] +Description=UBLinux autorun scripts before shutdown event +Before=shutdown.target umount.target +After=multi-user.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/true +ExecStop=/usr/lib/ublinux/rc.d/rc.halt.pre +TimeoutSec=0 +StandardOutput=tty +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target + diff --git a/ublinux/systemd/ublinux-rc-local.service b/ublinux/systemd/ublinux-rc-local.service new file mode 100644 index 0000000..7c655d4 --- /dev/null +++ b/ublinux/systemd/ublinux-rc-local.service @@ -0,0 +1,16 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +[Unit] +Description=UBLinux autorun scripts - local stage + +[Service] +Type=forking +ExecStart=/usr/lib/ublinux/rc.d/rc.local +TimeoutSec=0 +StandardOutput=tty +RemainAfterExit=yes diff --git a/ublinux/systemd/ublinux-rc-network.service b/ublinux/systemd/ublinux-rc-network.service new file mode 100644 index 0000000..355da3f --- /dev/null +++ b/ublinux/systemd/ublinux-rc-network.service @@ -0,0 +1,17 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +[Unit] +Description=UBLinux autorun scripts - network stage +After=network-online.target + +[Service] +Type=forking +ExecStart=/usr/lib/ublinux/rc.d/rc.network +TimeoutSec=0 +StandardOutput=tty +RemainAfterExit=yes diff --git a/ublinux/systemd/ublinux-shutdown.service b/ublinux/systemd/ublinux-shutdown.service new file mode 100644 index 0000000..6650dde --- /dev/null +++ b/ublinux/systemd/ublinux-shutdown.service @@ -0,0 +1,22 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=UBLinux autorun scripts for shutdown +DefaultDependencies=no +After=umount.target +Before=final.target + +[Service] +Type=oneshot +ExecStart=/usr/lib/ublinux/rc.d/rc.halt +TimeoutSec=0 +StandardOutput=tty +RemainAfterExit=no + +[Install] +WantedBy=shutdown.target diff --git a/ublinux/templates/ublinux-data.ini b/ublinux/templates/ublinux-data.ini new file mode 100644 index 0000000..415ce5b --- /dev/null +++ b/ublinux/templates/ublinux-data.ini @@ -0,0 +1,656 @@ +# Файл ublinux.ini рекомендуется использовать в папке ublinux-data +# Если вы работаете в режиме полной песочницы и у вас отстуствует папка ublinux-data, вы можетеперенести его в папку ublinux +# Now int is recommended to place ublinux.ini file to folder ublinux-data +# If you want to delete this folder (when using in full sandbox mode) you may move it into folder ublinux-data + +# UBLinux settings +# UBLinux настройка + +################################################################################ +# How it works. +# Краткое описание как работает этот файл конфигурации +# [/path/filename]755 # select file for changing. if its not exists it will be created with 755 permisions +# [/path/filename]a+x # выбор файла для изменений, если файла нет, он будет создан с правами по умолчанию плюс chmod a+x +# [/path/filename]a+x [/bin/bash] # Необязательный параметр во второй части в квадратных скобках означает "запустить с" возможные варианты +# # [/bin/bash/] запустит с башем +# # [.] выполнить как часть init +# # [chroot . ] сделать чрут в sysroot и выполнить там +# Parameter=value # it will change string Parameter=* in file to Parameter=value. If there is no parameter the string will be added to end of file. +# Параметр=значение # меняет параметр в файле на нужное значение. Если параметра нет, строка будет добавлена в конец файла. +# +string # add string to end of file in case it's not already in file. +# +строка # добавит строку в файл, если она ещё не прописана в нём. +# |string # add string to end of file in any case. +# |строка # добавит строку в файл без проверки. +# -expression # remove all string with expression (see info sed). symbols .* matches all strings in file. +# -выражение # удаляет строки соответствующие выражению (см info sed). Если указать .* то будут удалены все строки. + +################################################################################ +[/etc/ublinux/config] +## Config verison +## Версия конфигурации +VERSION=2.3 + +## Additional boot parameters +## Дополнительные параметры загрузки +## Возможные параметры: +## nomodeset # Отключить выбор и загрузку ядром драйверов видео +## i915.enable_dc=0 # Отключить управление питанием графического процессора +## intel_idle.max_cstate=1 # Ограничивает состояния сна процессора, это предотвращает переход процессора в состояния глубокого сна +## ahci.mobile_lpm_policy=1 # Максимальная производительность, управление питанием +## intel_idle.max_cstate=1 # Ограничивает состояния сна процессора, это предотвращает переход процессора в состояния глубокого сна +## intel_idle.max_cstate=4 # Устраняет мерцание дисплея ноутбука на процессорах Ultra Voltage +## snd-intel-dspcfg.dsp_driver=1 # Принудительный выбор драйвера звукового устройства от Intel +## snd-intel-dspcfg.dsp_driver=3 +## любые +#CMDLINE="noload=/12,/92 findswap security=apparmor" + +## Default user password is 'ublinux' +## Что-бы получить хэш "openssl passwd -6 -salt ubsalt pasword" +## Хэш пароля для пользователя по умолчанию (стандартно ublinux) +## Если пароль стандартный то будет подсказка + FIRSTSTART=yes > /etc/DESKTOP (Первый запуск для настройки системы) +DEFAULTPASSWD='$6$E7stRhRS8fCKk7UU$Qoqw62AUaUa5uLIc2KC7WV3MUThhrR8kjXtCODmnKCzKe2zHu1/wmsiWBHZEIk/IQnk/aELQYbUK93OUtrwg60' + +## Default root password is 'ublinux' +## Хеш пароля для пользователя root (стандартно ublinux) +DEFAULTROOTPASSWD='$6$E7stRhRS8fCKk7UU$Qoqw62AUaUa5uLIc2KC7WV3MUThhrR8kjXtCODmnKCzKe2zHu1/wmsiWBHZEIk/IQnk/aELQYbUK93OUtrwg60' + +## Default user name is 'superadmin' +## Имя пользователя по умолчанию, будет довален в группу whell, при условии если переменная NEEDEDUSERS пустая (стандартно superadmin) +DEFAULTUSER=superadmin + +## Default hash algoritm for user password +## Алгоритм хеширования паролей, возможные значения: des, md5, yescrypt, gost-yescrypt, scrypt, bf, bcrypt, bcrypt-a, sha512crypt, sha256crypt, sunmd5, md5crypt, bsdicrypt, descrypt, nt +#HASHPASSWD=sha512crypt + +## You can cpecify users there whithout using "user=" boot parameter +## Пользователи системы (аналог параметра users) +## NEEDEDUSERS='name_user:id:password:show_name:, ... ' password=x=$DEFAULTPASSWD +NEEDEDUSERS='superadmin:1000:x:Администратор' + +## ADDUSER[user_name:UID:comment:additional_groups:opt_manual]=password_hash|x +## ADDUSER[superadmin:1000:Администратор:]=x +## ADDUSER[user-1:x:Пользователь-1:vboxusers,libvirt:opt_manual]=passsword_hash + +# Помещать пользователя с ID 1000 в группу Администраторов whell +#ADDADM=yes + +## User for X autostarting +## Пользователь для автовхода (none отключает автовход, без параметра, либо пусто включает автовход superadmin) +AUTOLOGINUSER=none + +## Groups for users +## Группы, в которых будут состоять пользователи (default scanner,power,audio,lp,optical,storage,video,sambashare,vboxusers) +#USERGROUPS=scanner,power,audio,lp,optical,storage,video,sambashare,vboxusers,libvirt + +## Autostart services +## Автоматически поднимать службы (можно указывать службы xinetd) +## Для работы bluetooth SERVICESSTART+=bluetooth +## Для работы в WINDOWS сетях с DNS NETBIOS, включить NSSWITCHWINBIND=yes и добавить SERVICESSTART=nmb,winbind +## Для VMWareWorkstation: vmware-networks, vmware-usbarbitrator +## SERVICESSTART=tor,polipo,cups-lpd +SERVICESSTART=dbus-broker,NetworkManager,sshd,systemd-swap,systemd-timesyncd,cups,cockpit.socket,avahi-daemon,avahi-dnsconfd,veyon,smb,nmb,winbind,bluetooth + +## You can disable some of standart services start +## Отключение служб, включенных по умолчанию +#SERVICESNOSTART=xinetd,pdnsd,iptables,wine + +## You can disable and mask some of standart service +## Отключение и блокировка служб, включенных по умолчанию +#SERVICESMASK=adb + +HOSTNAME=ublinux-install + +## You can specify your /etc/machine-id there. If MACHINEID=RANDOM then will be +## created random number. # In other case, it will be based on internal hardware list. +## Номер машины, который попадает в /etc/machine-id. В случае MACHINEID=RANDOM создастся +## случайный номер, иначе он сформируется в зависимости от аппаратной начинки материнской платы. +## Можно привязать к носителю, указав свой номер (в формате вывода утилиты md5sum) +## к примеру, echo mynumber | md5sum +#MACHINEID=91ec1cd57b484d479893f012b26f89ea +MACHINEID=RANDOM + +## Включить Apparmor, по умолчанию отключен +#APPARMOR=yes + +## Mount local partitions +## Подключение всех разделов при старте +#PARTITIONSAUTOMOUNT=yes + +## Не подключать указанные разделы +#PARTITIONSNOMOUNT=boot,hidden + +## Пользователь - владелец для fat ntfs +#PARTITIONSMOUNTUID=500 + +## Автомонтирование папок, внимание на порядковый номер после имени переменной +## Пароль кодировать в base64: echo 'password' | base64 +## AUTOMOUNT_SHARE[mountpoint]='cifs:share:username:password_base64:domain:opt' +## AUTOMOUNT_SHARE[/mnt/cifs:share]='cifs://192.168.103.55/share:user:password_base64:domain:noperm,vers=1.0' +## AUTOMOUNT_SHARE[/mnt/sdb1]='direct:/dev/sdb1:wheel:775:noacl' +## AUTOMOUNT_SHARE[/mnt/sshfs/user-1@192.168.1.1]='sshfs:superadmin@192.168.1.1:/home/user-1:password_base64:' +#AUTOMOUNT_SHARE[/mnt/share2]='cifs://192.168.103.55/share2:share:password_base64:domain:noperm,vers=1.0' +#AUTOMOUNT_SHARE[/mnt/sda4]='direct:/dev/sda4:wheel:775:noacl' +#AUTOMOUNT_SHARE[/mnt/sshfs/user-1@192.168.1.1]='sshfs:superadmin@192.168.1.1:/home/user-1:password_base64:' +#AUTOMOUNT_SHARE[/mnt/nfs/user-1@192.168.1.1]='nfs:192.168.1.1:/home/user-1' + +## Папка с правами 777 доступная всем локальным пользователям и при разрешении всем из сети +## по умолчанию PUBLICDIR=/home/public +#PUBLICDIR= + +## Mount shared media from ublinux-server automatically +## Подключаться к серверу при старте +#AUTOMOUNTSERVER=yes + +## Share local partitions via NFS-Server +## Разрешать общий доcтуп к разделам через NFS +#PARTITIONSSHARE=yes + +## Исключение для общих разделов +#PARTITIONSNOSHARE=archive,private + +## Режим работы клавиатуры Num Lock (yes|no). По умолчанию включено, если нет тачпада. +#NUMLOCK=no + +## Подписывать режим работы на обоях +## GRAFFITI=yes (default) +#GRAFFITI=no + +## Настройка принтера +## PRINTERADD=manual (default) +#PRINTERADD=auto + +##Сохранять кеши при перезагрузки/выключении, ускоряет загрузку системы +#SAVE_ALL_CACHE=rootcopy + +## Обновлять кеш библиотек при старте. Полезно при использовании модулей от старых сборок. +#RUNLDCONFIG=yes + +## Обновление базы данных модулей, если используются сторонние модули ядра или видео проприетарное +DEPMOD=yes + +## Обновлять домашний каталог при загрузке если он уже существует +#UPDATEHOME=yes + +## Можно отключить использование tmpfs для /tmp или /var/tmp при работе с профилем +#TMPFS=no +#VARTMPFS=no + +## Перечень программ для автозагрузки под пользователем +#AUTOEXEC="kde:yakuake;gnome:guake;lxde:guake;xbindkeys" + +## Включение pulseaudio (yes, no) +#PULSEAUDIO=yes + +## Установить звуковое устройство по умолчанию для ALSA, к примеру для вывода звука через HDMI +## устройства смотрите в выводе aplay -l +#ALSACARD=1 +#ALSADEVICE=7 + +## Автообновление системы +## auto - автоматически +## ask - спросить у пользователя (по умолчанию) +## never - не обновлять автоматически +#UBLINUXUPDATE=auto + +## Профиль конфигурации PAM авторизации, authselect. Профили /usr/share/authselect/vendor +## Доступные доп. параметры: +## with-altfiles with-ecryptfs with-faillock with-files-access-provider with-files-domain with-pamaccess with-silent-lastlog with-sudo with-systemd-homed with-time without-nullok +## with-fingerprint with-pam-u2f with-pam-u2f-2fa without-nullokwithout-pam-u2f-nouserok +## with-smartcard with-smartcard-lock-on-removal with-smartcard-required +## with-mdns4 with-mdns6 with-mkhomedir with-mkhomedir-simple with-nispwquality +## Информация о профиле: authselect show ublinux-sssd +## Отключить выбор профиля PAM =disable|-|no|off +## AUTHPAM=disable +## По умолчанию, minimal конфигурация с локальной авторизацией +## AUTHPAM[minimal]=with-faillock,with-time,with-systemd-homed +## AUTHPAM[sssd]=with-faillock,with-time,with-systemd-homed,with-mkhomedir-simple + +## Алгоритм сжатия модулей по умолчанию +#MKSQFS_OPTS="-b 512K -comp xz -Xbcj x86" + +## Алгоритм сжатия, используемый для сохранения измененний в моудль +#MKSQFS_FASTALG="-b 512K -comp lz4 -Xhc" + +################################################################################ +## Настройка сети +[/etc/ublinux/network] +## Domain configuration +## Подключение к AD серверу +#DOMAIN=ublinux.ru + +## Сервер контроллера домена/kerberos +## Отключить автопоиск сервера контроллера домена/kerberos и задать статический +## DOMAIN_CONTROLLER=pdc.ublinux.ru +## DOMAIN[server]=pdc.ublinux.ru + +## Клиент для подключения к домену [ *realmd_sssd | realmd_winbind | samba | none ] +## DOMAIN_CLIENT=realmd_sssd +## DOMAIN[client]=realmd_sssd + +## Пользователь имеющие права ввода в домен. +## Применяется если необходимо автоматизировать ввод в домен с большого числа ПК, или при работе в режиме полной песочнице где невозможно сохранить +## Пароль кодировать в base64: echo 'password' | base64 +## DOMAIN_ADMIN[Администратор]=password_base64' +## DOMAIN_ADMIN[Администратор]=0J3QvtCy0YvQuV/QlNC10L3RjCEK +## DOMAIN[admanger]=Администратор:0J3QvtCy0YvQuV/QlNC10L3RjCEK + +## Группа на контроллере домена, пользователи которой будут иметь права для sudo +## DOMAIN_GROUP_SUDOERS=sudoers@ublinux.ru +## DOMAIN[group:sudoers]=sudoers@ublinux.ru + +## Группа на контроллере домена, пользователи которой будут иметь права для доступа по ssh +## DOMAIN_GROUP_SSH=sudoers@ublinux.ru +## DOMAIN[group:ssh]=sudoers@ublinux.ru + +## Ограничить пользователями которым разрешён вход в домен +## REALM_PERMIT[user]=user-1@ublinux.ru,user-2@ublinux.ru,ublinux.ru\\user-3 +## REALM_PERMIT[group]=ublinux_group@ublinux.ru +## REALM_PERMIT[user]=user-1@ublinux.ru + +## При методе подключения DOMAIN_CLIENT=realmd_sssd. Задать параметры в /etc/sssd/sssd.conf для домена +## REALM_SSSD[параметр:имя_секции]=значение +## Если "имя_секции" не указан, то по умлочанию используется секция текущего домена = domain/${DOMAIN} +## REALM_SSSD[services:sssd]=nss,pam,pac,ssh +## REALM_SSSD[default_shell:nss]=/bib/bash +## REALM_SSSD[ad_hostname:domain/mydomain.ru]=hostname.mydomain.ru +## Короткие имена пользователей домена "user" | полные "user@domain.ru" [False|*True] +## REALM_SSSD[use_fully_qualified_names]=False +## Строить карту всех пользователей домена на локальном ПК [False|*True] +## REALM_SSSD[ldap_id_mapping]=False +## Перечисление всех пользователей и групп, нагружает сервер домена при большом числе пользователей [*False|True] +## REALM_SSSD[enumerate]=True +## Задать статическое имя PC в домене pc_name.domain.ru +## REALM_SSSD[ad_hostname]=hostname.mydomain.ru +## Обновлять Kerberos .keytab одновременно у sssd и samba [*False|True] +## REALM_SSSD[ad_update_samba_machine_account_password]=True +## Формат файла Kerberos .keytab пользователя /tmp/krb5cc_123456879 +## REALM_SSSD[krb5_ccname_template]=FILE:%d/krb5cc_%U + +## Рабочая группа samba +#SAMBADOMAIN=SMBGROUP + +## Network configuration +## Настройка сетевого интерфейса +## NETWORK[all|any|name_connection|name_device|name_uuid|type_connection]="optional_1 optional_2 optional_n" +## all|any - All device and connection +## name_device: enp3s0, ens192, wlan0 +## or name_connection: Проводное соединение 1, WIFI_WORK +## or name_uui: 6c90739a-5b5f-3b4a-9b42-11aa89c419bc +## or type_connection: 802-3-ethernet, 802-11-wireless +## optional: +## ipv4.ignore-auto-dns yes +## ipv4.method manual +## ipv4.addr 192.168.1.2/24,10.10.1.5/8 +## ipv4.gateway 192.168.1.1 +## ipv4.dns 192.168.1.1,8.8.8.8 +## wifi.cloned-mac-address random +## ethernet.cloned-mac-address 00:22:68:1c:59:b1 +## ethernet.cloned-mac-address stable +## ethernet.cloned-mac-address random +## NETWORK[Проводное соединение 1]="ipv4.method manual ipv4.addr 192.168.1.2/24,10.10.1.5/8 ipv4.gateway 192.168.1.1 ipv4.dns 192.168.1.1,8.8.8.8" +## NETWORK[Проводное соединение 1]="ethernet.cloned-mac-address 00:22:68:1c:59:b1" +## NETWORK[HotelWifiName]="wifi.cloned-mac-address 70:48:f7:1a:2b:3c" +## NETWORK[all]="+ipv4.dns 192.168.1.1,8.8.8.8 ipv4.ignore-auto-dns yes" + + ## ublinux-server ip addres + ## Адрес сервера по умолчанию + #UBLINUXSERVER=192.168.1.31 + + ## Local network base address + ## Адрес сети по умолчанию + #NETWORKIP=192.168.1. + +## Switch on ipv6 at start on all interfaces +## Включение ipv6 по умолчанию на всех интерфейсах +IPV6=no + +## Серверы времени +#NTPSERVERS=ntp1.vniiftri.ru,ru.pool.ntp.org +NTPSERVERS=dhcp + +## Дбавить порядок поиска DNS: avahi и winbind (default no) +NSSWITCHAVAHI=yes +NSSWITCHWINBIND=yes + +## Установка системных прокси +## https://user:password@proxy:port/ +#HTTP_PROXY=https://127.0.0.1:8118 +#HTTPS_PROXY=https://127.0.0.1:8118 +#FTP_PROXY=ftp://127.0.0.1:8118 +#NO_PROXY="localhost,127.0.0.1,192.168.1.0/16" + +## Для совместного доступа к интернет можно включить режим шлюза +## Также необходим при связывании нескольких сетей (wlan0 eth0 eth1 ...) +#ROUTER=yes + +## Iptables firewall exceptions +## ИСключения для межсетевого экрана iptables +#IPTABLESOPENPORTSTCP=21,22,30001,6881 +#IPTABLESOPENPORTSUDP=30002,6881 + +## Для работы в режиме сервера, шлюза и точки доступа необходимо открыть доступ из локальной сети +#IPTABLESTRUSTEDIP=192.168.1.0/16 + +## Переправлять весь поток от пользователей через TOR +## Пользователей можно задавать в виде имени, номера и диапазона +## Должна быть включена служба tor! +#TORUSERS=500-999 + + ## Автоматически менять MAC адрес интерфейса при подключении + #MACCHANGE=wlan0 + ## По умолчанию используется алгоритм -e не меняющей тип и производителя + #MACCHANGEROPTIONS='-a' + ## Можно назначить конкретный адрес для интерфейса + #MACCHANGEROPTIONS='--mac=XX:XX:XX:XX:XX:XX' + +################################################################################ +## Настройка режима киоска +[/etc/ublinux/kiosk] +## Управление разрешениями действий polkit, можно разрешать для групы пользователей +## POLKIT[id_object]=result:group_1,group_n" +## Посмотреть все доступные объекты polkit: pkaction | grep udisks +## result: yes|no|auth_self|auth_self_keep|auth_admin|auth_admin_keep|null +## org.freedesktop.udisks2. - Mounting a filesystems all subgroup | Монтировать файловую систему все подгруппы +## org.freedesktop.udisks2.filesystem-mount - Mounting a filesystems | Монтировать файловую систему +## org.freedesktop.udisks2.filesystem-mount-system - Mount a filesystem on a system device | Монтировать файловую систему на системном устройстве +## org.freedesktop.udisks2.filesystem-mount-other-seat - Mount a device attached to another seat | Монтировать файловую систему с устройства, подключенного в другое место +## org.freedesktop.udisks2.filesystem-unmount-others - Unmount a device mounted by another user | Демонтировать устройство, смонтированное другим пользователем +## org.manjaro.pamac. - GUI Pamac install package | ГУЙ pamac установка и обновление пакетов +## org.opensuse.cupspkhelper.mechanism.all-edit - Printer settings | Настройки принтера +## org.freedesktop.NetworkManager. - NetworkManager settings | Настройки NetworkManager +## POLKIT[org.freedesktop.udisks2.]=yes:storage +## POLKIT[org.manjaro.pamac.]=yes:wheel + +## Режим киоска XFCE4 +## =all - разрешить всем | =none - запретить | =%whell,%users - разрешить группам | =superadmin,user-1 - разрешить пользователям | =%wheel,user-1 - разрешить пользователю и группе +#XFCE4_KIOSK[CustomizeSplash]=ALL +#XFCE4_KIOSK[CustomizeChooser]=NONE +#XFCE4_KIOSK[CustomizeLogout]=NONE +#XFCE4_KIOSK[CustomizeCompatibility]=%wheel +#XFCE4_KIOSK[Shutdown]=%wheel +#XFCE4_KIOSK[CustomizeSecurity]=NONE + +## Назначить настройки XFCE4 по умолчанию +#XFCE4_KIOSK_DEFAULT="user-1,user-2" + +################################################################################ +[/etc/ublinux/desktop] +# Графическая среда по умолчанию может быть изменена +# LXDE+slim - быстрая среда для слабых компьютеров +# GNOME+GDM - альтерантивная среда для средних и мощных машин +# DESKTOP=none - отключает графический сервер и загружает в консоле +#DESKTOP=none +#DISPLAYMANAGER=slim +#DESKTOP=LXDE +#DISPLAYMANAGER=GDM +#DESKTOP=GNOME +#DISPLAYMANAGER=lightdm +#DESKTOP=xfce +#DISPLAYMANAGER_DEFAULTUSER=user-1 + +## Простой режим мульти рабочего места MultiSeat, когда в ПК установлено два независимых графических контроллера +## Посмотреть все устройства loginctl seat-status seat0 +## lsusb lspci +#MULTISEAT_SIMPLE[НомерМеста]="АдресУстройстваДляМеста1 АдресУстройстваДляМеста..." +#MULTISEAT_SIMPLE[seat1]="/sys/devices/pci0000:00/0000:00:02.0/drm/card0 /sys/devices/pci0000:00/0000:00:02.0/graphics/fb0 /sys/devices/pci0000:00/0000:00:14.0/usb1/1-8 /sys/devices/pci0000:00/0000:00:14.0/usb1/1-7" +#MULTISEAT_SIMPLE[seat2]="/sys/devices/pci0000:00/0000:00:02.0/0000:02:00.0/drm/card2 /sys/devices/pci0000:00/0000:00:14.0/usb2/1-10 /sys/devices/pci0000:00/0000:00:14.0/usb2/1-9" + +## Сервис удалённого управления рабочим столом X11 и TTY +## Пароль для VNC сервиса x11vnc-ublinux:*.service. Настроен на работу только по паролю для всех рабочих мест. Создаёт шифрованный пароль в файле /root/.vnc/.passwd +## Поддерживает Multiseat по номеру порта display:0=port:5900 display:1=port:5901 display:2=port:5902 +## Пароль кодировать в base64: echo 'ublinux' | base64 +## X11VNC[password]=dWJsaW51eAo= +## Дополнительные опции к автоматическому соединению +## X11VNC[options]="-noipv6" +## VNC для управления TTY +## X11VNC[tty1]="-noipv6" +## Пользовательская настройка запуска, new1..new2..new%n +## X11VNC[new1]="-no6 -rfbauth /root/.vnc/.passwd -rawfb vt2" +## Отключить автоматическое создание X11VNC для всех дисплеев +## X11VNC[display]=disable || X11VNC[nodisplay]=1 || X11VNC[disable]=1 + +################################################################################ +[/etc/ublinux/video] +## Загрузить подходящий видеодрайвер, вначале пытаемся запустить проприетарный, после свободный. +## Модули с нужной версией должен быть подключен. По умочанию отключено. +#VGADRV_AUTO=yes + +## Использовать проприетарные видео дравйвера nvidia/amdgpu, отключив свободные radeon/nouveau +## при подключенных модулях станут активны проприетарные драйвера (default no) +#FREEVGADRV=no + +## Принудительно добавить и установить разрешение монитора в /etc/X11/xorg.conf.d/10-monitor.conf +## Перечень имён портов вывода получить по каманде: xrandr или xrandr | grep -E "^[A-Z0-9]* connected" | cut -d' ' -f1 +## XORG_MONITOR[VGA1]=1920x1080,1600x1200x60,848x480x60,nodpms +## Примеры имени видео порта: VGA1 HDMI1 DP1 DVI1 LVDS1 TV1 VIRTUAL1 +## =1920x1080 =1920x1080x75 +## cvt , gtf , reduced|r , dpms , nodpms , enable , disable , ignore , primary , +## lo|LeftOf:{name} , ro|RightOf:{name} , ab|Above:{name} , be|Below:{name} , rotate:normal|left|right|invert +#XORG_MONITOR[VGA1]=1920x1080,ro:hdmi1 + +## Принудительно добавить и установить разрешение монитора после запуска X через xrandr +## Перечень имён портов вывода получить по каманде: xrandr или xrandr | grep -E "^[A-Z0-9]* connected" | cut -d' ' -f1 +## XRANDR_MONITOR[VGA1]=1920x1080 +## Примеры имени видео порта: VGA1 HDMI1 DP1 VIRTUAL1 +## =1920x1080 =1920x1080x75 +## cvt , gtf , reduced|r , auto , preferred , off , primary , mode:1920x1080 , mode:1920x1080:60 +## lo|LeftOf:{name} , ro|RightOf:{name} , ab|Above:{name} , be|Below:{name} , rotate:normal|left|right|invert +#XRANDR_MONITOR[VGA1]=1920x1080,ro:hdmi1 + +## драйверы для видеокарт в случае, если проприентарные не доступны или не работают +#FAILSAFENVIDIA=fbdev +#FAILSAFEATI=fbdev + +## Перечень программ, которые следует запускать через optirun для ноутбуков с Nvidia optimus +#OPTIRUN= + +## Перечень программ, которые следует запускать через primusun для ноутбуков с Nvidia optimus +#PRIMUSRUN=steam + +## При наличии 2х видеокарт (ноутбуки с картами AMD/ATI) по умолчанию используется. +## встроенная (intel), отключите параметр INTEGRATEDVGA чтобы использовать AMD/ATI +#INTEGRATEDVGA=no + +################################################################################ +[/etc/ublinux/theme] +# Доступные темы: ublinux(по умолчанию) ublinux-green ublinux-dark +#THEME=ublinux + +# Можно указать свои обои +#BACKGROUND=/mnt/livedata/ublinux-data/backgrounds/mywallpaper.jpg +# Можно указать каталог с обоями, тогда будет выбрана случайная +#BACKGROUND=/mnt/livedata/ublinux-data/backgrounds/wallpapers/default + +# Метод масштабирования +#0-растянуть пропорционально на чёрном фоне (по умолчанию) +#1-растянуть с нарушением пропорций +#2-растянуть с обрезкой +#BACKGROUNDMODE=0 + +# Тема для хранителя экрана +#SSAVERTHEME=/mnt/livedata/ublinux-data/backgrounds/screensaver/default + +################################################################################ +[/etc/ublinux/steam] +# Настройки для Steam. Для вынесения данных из профиля используйте 2 переменные +# Настройки клиента ~/.steam. Места занимает немного, переносить имеет смысл только при работе в чистом режиме +# Не назначайте переменную STEAMCONF если стим ещё не установлен! +#STEAMCONF= +# Место для клиента и библиотеки игр. Т.к. это занимает много места, то лучше перенести из домашней папки. +#STEAMAPP=/mnt/livedata/ublinux-data/steam + +################################################################################ +[/etc/ublinux/clock] +#UTC=true +# Установка часового пояса +# Time zone for UTC+3 MSK-1 +#ZONE=Europe/Kaliningrad +# Time zone for UTC+4 MSK +#ZONE=Europe/Moscow +# Time zone for UTC+6 MSK+2 +#ZONE=Asia/Yekaterinburg +# Time zone for UTC+7 MSK+3 +#ZONE=Asia/Omsk +# Time zone for UTC+8 MSK+4 +#ZONE=Asia/Krasnoyarsk +# Time zone for UTC+9 MSK+5 +#ZONE=Asia/Irkutsk +# Time zone for UTC+10 MSK+6 +#ZONE=Asia/Yakutsk +# Time zone for UTC+11 MSK+7 +#ZONE=Asia/Vladivostok +# Time zone for UTC+12 MSK+8 +#ZONE=Asia/Magadan + +################################################################################ +[/etc/ublinux/locale] +#LOCALE="en_US.UTF-8,ru_RU.UTF-8" +#LANG="ru_RU.UTF-8" +#CONSOLE_FONT=lat0-16 + +################################################################################ +[/etc/ublinux/keyboard] +#XkbModel=pc105 +#XkbLayout="us,ru" +#KEYBOARD=ru +#KEYTABLE=ru +#Раскладка клавиатуры +#GRP_TOGGLE=lalt_lshift_toggle +#XkbOptions=grp:lalt_lshift_toggle,grp_led:scroll,compose:rwin + +################################################################################ +[/etc/ublinux/ubm] +#UBMDIR=/var/lib/ubmodules +#EXT=ubm +#compression="${MKSQFS_OPTS}" +#compression="-b 512K -comp xz -Xbcj x86" +#compression_fast="${MKSQFS_FASTALG}" +#compression_fast="-b 512K -comp lz4 -Xhc" + +################################################################################ +#Строгая привязка служб NFS сервера к работе через определенные порты (полезно при работе в сети через межсетевой экран) +[/etc/ublinux/nfs-server] +#RPCMOUNTD_OPTIONS="--port 4002" + +################################################################################ +[/etc/ublinux/nfs-common] +#STATD_OPTIONS="--port 4000" + +################################################################################ +#Подключение к точке доступа My WIFI с паролем Password +[/etc/ublinux/network-scripts/ifcfg-Default_WIFI] +#NAME=Default_WIFI +#MODE=Managed +#TYPE=Wireless +#BOOTPROTO=dhcp +#DEFROUTE=yes +#IPV4_FAILURE_FATAL=yes +#IPV6INIT=no +#ONBOOT=yes +#PEERDNS=yes +#PEERROUTES=yes +#MAC_ADDRESS_RANDOMIZATION=default +# Название точки доступа +#ESSID="My WIFI" +# Если точка бесплатная (аэропорт или кафе) - закоментарьте ключ, секция с паролем тогда не нужна +#KEY_MGMT=WPA-PSK + +################################################################################ +[/etc/ublinux/network-scripts/keys-Default_WIFI] +#WPA_PSK='Password' + +################################################################################ +[/etc/ublinux/network-scripts/ifcfg-eth0] +#DEVICE=eno1 +# Автоподнятие сетевого интерфейса +#ONBOOT=yes +# Альтернативный DHCP клиент +#DHCP_CLIENT=udhcpc +# Пример настройки постоянного адреса +# =none|static — No boot-time protocol should be used. +# =bootp — The BOOTP protocol should be used. +# =dhcp — The DHCP protocol should be used. +#BOOTPROTO=static +#IPADDR=192.168.1.32 +#NETMASK=255.255.255.0 +#GATEWAY=192.168.1.1 +#MII_NOT_SUPPORTED=no +#DNS1=192.168.1.1 + +################################################################################ +[/etc/ublinux/network-scripts/ifcfg-wlan0] +#ONBOOT=yes +# Set it empty for autodetection +# При указании пустого значения будет производится поиск доступных сетей +#WIRELESS_ESSID= +# Для создания точки доступа используйте такие параметры +# (необходимо также включить службу hostapd dhcpd, +# открыть в межсетевом экране 67 порт UDP, а также, возможно, включить ROUTER) +#ONBOOT=yes +#MII_NOT_SUPPORTED=yes +#USERCTL=no +#BOOTPROTO=static +#IPADDR=192.168.2.31 +#NETMASK=255.255.255.0 +# При подключении через ad-hoc нужно задать постоянные адреса +#WIRELESS_MODE=ad-hoc +#WIRELESS_ESSID=ublinux +#WIRELESS_CHANNEL=1 +#BOOTPROTO=static +#IPADDR=192.168.2.32 +#NETMASK=255.255.255.0 +#GATEWAY=192.168.2.1 +#MII_NOT_SUPPORTED=yes +#DNS1=192.168.2.1 + +################################################################################ +[/etc/ublinux/proxy] +## Системный прокси сервер для загрузки и обновления ПО +#http_proxy=server:8118 +#ftp_proxy=server:8080 +#proxy_user=proxyuser:proxypass + +################################################################################ +[/etc/polipo/config] +## В настройках прокси сервера polipo можно перенаправить весь поток на другой сервер +## это может быть и обычный сервер и служба tor +#socksParentProxy="localhost:9050" +#socksProxyType=socks5 + +################################################################################ +[/etc/hostapd/hostapd.conf] +# Настройки wifi карты в режиме точки доступа +#driver=nl80211 +#ssid=ublinux +#country_code=RU +#hw_mode=g +#channel=11 +# Пароль к wpa2 +#wpa_passphrase=ublinux +# переключение в режим открытой wep сети +#wpa=0 + +################################################################################ +#---- network files ---- +[/etc/pdnsd.conf] +# принимать запросы от других компьютеров в сети +#server_ip=any; +# адресс основного DNS сервера, откуда брать запросы +#ip=77.88.8.8; + +################################################################################ +[/etc/profile.d/ublinux.sh] +# Перенос временных файлов КДЕ4 в отдельную папку. Убирает притормаживание главного меню в КДЕ4 +#export KDEVARTMP=/mnt/livedata/ublinux-data/tmp + +# Если на видеокарте nvidia наблюдается эффект разрыва окон, то есть 2 варианта борьбы с этим. +# Выберите один из вариантов, не включайте сразу 2 переменные сразу. +# 1 вариант. Может снизить производительность в играх. +#export __GL_YIELD=USLEEP +# 2 вариант. Не накаждой карте может сработать. +#export KWIN_TRIPLE_BUFFER=1 + +################################################################################ +[/etc/laptop-mode/laptop-mode.conf] +# Отключение парковки жесткого диска на ноутбуках +#CONTROL_HD_POWERMGMT=1 diff --git a/ublinux/templates/ublinux-data.sgn b/ublinux/templates/ublinux-data.sgn new file mode 100644 index 0000000..0c5f325 --- /dev/null +++ b/ublinux/templates/ublinux-data.sgn @@ -0,0 +1,9 @@ +Не удаляйте этот файл, иначе UBLinux не сможет найти данные локальных настроек. +Вы можете передать параметр 'sgndatafile=...' чтобы указать другое имя, +в отличие от оригинального. Это может быть полезно, если у вас +используется несколько разных вариантов UBLinux. + +Don't delete this file, else UBLinux won't find local data files. +You may use 'sgndatafile=...' boot parameter to search for a different name +than the default. This can be useful if you need to store several +linux-live distros on one machine. \ No newline at end of file diff --git a/ublinux/templates/ublinux.ini b/ublinux/templates/ublinux.ini new file mode 100644 index 0000000..7add923 --- /dev/null +++ b/ublinux/templates/ublinux.ini @@ -0,0 +1,6 @@ +# Файл ublinux.ini рекомендуется использовать в папке ublinux-data +# Если вы работаете в режиме песочницы и у вас отсутствует папка ublinux-data, вы можете +# перенести его в папку ublinux +# Now int is recommended to place ublinux.ini file to folder ublinux-data +# If you want to delete this folder (when using in Clean mode) you may +# move it into folder ublinux-data \ No newline at end of file diff --git a/ublinux/templates/ublinux.sgn b/ublinux/templates/ublinux.sgn new file mode 100644 index 0000000..47f9200 --- /dev/null +++ b/ublinux/templates/ublinux.sgn @@ -0,0 +1,9 @@ +Не удаляйте этот файл, иначе UBLinux не сможет загрузиться +Вы можете передать параметр 'sgnfile=...' чтобы указать другое имя, +в отличие от оригинального. Это может быть полезно, если у вас +используется несколько разных вариантов UBLinux. + +Don't delete this file, else UBLinux won't work. +You may use 'sgnfile=...' boot parameter to search for a different name +than the default. This can be useful if you need to store several +linux-live distros on one machine. diff --git a/ublinux/udev/70-nvidia-ubconfig.rules b/ublinux/udev/70-nvidia-ubconfig.rules new file mode 100644 index 0000000..f87f7d7 --- /dev/null +++ b/ublinux/udev/70-nvidia-ubconfig.rules @@ -0,0 +1 @@ +ACTION=="add", DEVPATH=="/bus/pci/drivers/nvidia", RUN+="/usr/bin/nvidia-modprobe -c0 -u" \ No newline at end of file diff --git a/ublinux/udev/70-setup-prn-ubconfig.rules b/ublinux/udev/70-setup-prn-ubconfig.rules new file mode 100644 index 0000000..e89e5bf --- /dev/null +++ b/ublinux/udev/70-setup-prn-ubconfig.rules @@ -0,0 +1,22 @@ +# UDEV rules for USB devices - ENV variables can be monitored +# via 'sudo udevadm monitor --udev --subsystem-match=usb --property' +# Low-level USB device add trigger +#ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", ENV{ID_USB_INTERFACES}!="*:070104:*", TAG+="systemd", ENV{SYSTEMD_WANTS}="configure-printer-ublinux@usb-$env{BUSNUM}-$env{DEVNUM}.service" +#ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", TAG+="systemd", ENV{SYSTEMD_WANTS}="configure-printer-ublinux@%p.service" +#ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", ENV{INTERFACE}=="7/1/*", ENV{INTERFACE}!="7/1/4", RUN+="/mnt/livemedia/ublinux-data/rootcopy/usr/lib/ublinux/scripts/printer-udev-test.sh add %p" +#ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", ENV{INTERFACE}=="7/1/*", ENV{INTERFACE}!="7/1/4", RUN+="/usr/lib/ublinux/scripts/printers_setup.sh add %p" +#ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{INTERFACE}=="7/1/*", ENV{INTERFACE}!="7/1/4", TAG+="systemd", ENV{SYSTEMD_WANTS}="configure-printer-ublinux@usb-$env{BUSNUM}-$env{DEVNUM}.service" + +ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", ENV{INTERFACE}=="7/1/*", ENV{INTERFACE}!="7/1/4", TAG+="systemd", ENV{SYSTEMD_WANTS}+="printers-setup@.service" +#ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", ENV{INTERFACE}=="7/1/*", ENV{INTERFACE}!="7/1/4", TAG+="systemd", ENV{SYSTEMD_WANTS}+="printers-setup@usb-$env{BUSNUM}:$env{DEVNUM}.service" +#ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", ENV{ID_USB_INTERFACES}!=":070104:*",, TAG+="systemd", ENV{SYSTEMD_WANTS}+="printers-setup@usb-$env{BUSNUM}-$env{DEVNUM}.service" + +# Low-level USB device remove trigger +# Interface types: +# 7/1/1 - device with unidirectional USB, managed by usb backend +# 7/1/2 - device with bidirectional USB, managed by usb backend +# 7/1/3 - device with special USB protocol, managed by hp backend +# 7/1/4 - device with IPP over USB protocol, managed by ipp-usb daemon +ACTION=="remove", SUBSYSTEM=="usb", ENV{INTERFACE}=="7/1/*", ENV{INTERFACE}!="7/1/4", RUN+="/usr/lib/ublinux/scripts/printers_setup.sh remove sys%p" +#ACTION=="remove", SUBSYSTEM=="usb", ENV{INTERFACE}=="7/1/*", ENV{INTERFACE}!="7/1/4", TAG+="systemd" + diff --git a/ublinux/udev/99-hide-partition-ubconfig.rules b/ublinux/udev/99-hide-partition-ubconfig.rules new file mode 100644 index 0000000..06ef611 --- /dev/null +++ b/ublinux/udev/99-hide-partition-ubconfig.rules @@ -0,0 +1,3 @@ +# Hide loop partitions +ENV{ID_FS_TYPE}=="squashfs", ENV{UDISKS_IGNORE}="1" + diff --git a/ublinux/udev/99-printers-local-ubconfig.rules b/ublinux/udev/99-printers-local-ubconfig.rules new file mode 100644 index 0000000..e491fb5 --- /dev/null +++ b/ublinux/udev/99-printers-local-ubconfig.rules @@ -0,0 +1,35 @@ +# UDEV rules for USB devices - ENV variables can be monitored +# via 'sudo udevadm monitor --udev --subsystem-match=usb --property' +# Low-level USB device add trigger +#ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", ENV{ID_USB_INTERFACES}!="*:070104:*", TAG+="systemd", ENV{SYSTEMD_WANTS}="configure-printer@usb-$env{BUSNUM}-$env{DEVNUM}.service" +# Low-level USB device remove trigger +# Interface types: +# 7/1/1 - device with unidirectional USB, managed by usb backend +# 7/1/2 - device with bidirectional USB, managed by usb backend +# 7/1/3 - device with special USB protocol, managed by hp backend +# 7/1/4 - device with IPP over USB protocol, managed by ipp-usb daemon +#ACTION=="remove", SUBSYSTEM=="usb", ENV{INTERFACE}=="7/1/*", ENV{INTERFACE}!="7/1/4", RUN+="udev-configure-printer remove %p" + +#ENV{hp_test}=="yes", PROGRAM="/bin/sh -c 'logger -p user.info loading HP Device $env{BUSNUM} $env{DEVNUM}'", RUN+="/bin/sh -c '/usr/bin/nohup /usr/bin/hp-config_usb_printer $env{BUSNUM}:$env{DEVNUM}'" +#SUBSYSTEM=="block", ATTRS{idVendor}=="03f0", ACTION=="add", RUN+="/usr/lib/ublinux/cups-printers.sh" + +# Lulzbot TAZ Pro in Bootloader mode (for flashing firmware) +#SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", ENV{ID_MAKER_TOOL}="1" +# The following rule can be removed once the systemd upstream support will get +# widely adopted (IMHO it should be safe to remove in 2017+) +# https://github.com/systemd/systemd/pull/2844 +#ENV{ID_MAKER_TOOL}=="?*", TAG+="uaccess" + +# Load hp firmware for this printer. +#ACTION!="add", GOTO="hpmud_rules_end" +# hp_laserjet_p1006 for Suse 10.3 +#SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3e17", PROGRAM="/bin/sh -c 'logger -p user.info loading hp_laserjet_p1006 firmware $env{BUSNUM} $env{DEVNUM}'", RUN+="/bin/sh -c '/usr/bin/hp-firmware -y3 -s$env{BUSNUM}:$env{DEVNUM} &'" +# hp_laserjet_p1006 +#SUBSYSTEM=="usb_device", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3e17", PROGRAM="/bin/sh -c 'X=%k; X=$${X#usbdev}; B=$${X%%%%.*}; D=$${X#*.}; logger -p user.info loading hp_laserjet_p1006 firmware $$B $$D; printf %%03i:%%03i $$B $$D'", RUN+="/bin/sh -c '/usr/bin/hp-firmware -y3 -s%c &'" +#LABEL="hpmud_rules_end" + + +#KERNEL=="lp*", ACTION=="add|remove", RUN+="/bin/bash -c /usr/lib/ublinux/scripts/udev-cups-printers.sh" +#ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c12a", RUN+="/bin/bash -c /usr/lib/ublinux/scripts/udev-cups-printers.sh" +#ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c12a", RUN+="/bin/bash -c /usr/lib/ublinux/scripts/udev-cups-printers.sh" +ACTION=="add|remove", SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", RUN+="/bin/bash -c /usr/lib/ublinux/scripts/udev-cups-printers.sh" diff --git a/ublinux/xorg.conf.d/10-headless-ubconfig.conf b/ublinux/xorg.conf.d/10-headless-ubconfig.conf new file mode 100644 index 0000000..8f01feb --- /dev/null +++ b/ublinux/xorg.conf.d/10-headless-ubconfig.conf @@ -0,0 +1,20 @@ +Section "Monitor" + Identifier "dummy_monitor" + HorizSync 28.0-80.0 + VertRefresh 48.0-75.0 + Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 +EndSection + +Section "Device" + Identifier "dummy_card" + VideoRam 256000 + Driver "dummy" +EndSection + +Section "Screen" + Identifier "dummy_screen" + Device "dummy_card" + Monitor "dummy_monitor" + SubSection "Display" + EndSubSection +EndSection \ No newline at end of file diff --git a/ublinux/xorg.conf.d/20-nvidia-ubconfig.conf b/ublinux/xorg.conf.d/20-nvidia-ubconfig.conf new file mode 100644 index 0000000..51466be --- /dev/null +++ b/ublinux/xorg.conf.d/20-nvidia-ubconfig.conf @@ -0,0 +1,5 @@ +Section "Device" + Identifier "Nvidia Card" + Driver "nvidia" + VendorName "NVIDIA Corporation" +EndSection \ No newline at end of file