My requirement is to make a Custom Ubuntu 16.04.5 version in which the customization that i want is addition of two different users some new files in each of these two users and some new packages or drivers which i will either install with apt or pip or will build from source itself (like OpenCV).
This custom OS is expected to be used to installed on different hardwares which might vary in terms of motherboard, RAM and HDD/SSD.
Can you suggest me some software best suited for this task?
I heard of Cubic also but will it works for creating users and building packages from source?
Or Setting up one machine with all settings and packages and taking a backup of the same as live CD using some tools like systemback etc will work across different hardware?
Edit: This is not duplicate to any other question as it has addition of user in custom Ubuntu and no answers have ever mentioned it.
This is exactly what Cubic does...
In Cubic, add generic files, that should appear in all new user's home directories, inside the /etc/skel
directory. Whenever a new user is created, files from this location are copied into the new user's home directory.
For example, if you want all users to have an empty Temp
folder inside thir home directory, create a Temp
folder inside /etc/skel
. If you want all users to have the same configuration for Gimp, add it here as well. If you want all users to have the option to create *.docx
, *.pptx
, *.xlsx
, or *.txt
files by right-clicking in Nautilus, simply add the templates here.
Here is an example layout for /etc/skel
...
/etc/skel
├── .bash_logout
├── .bashrc
├── .config
├── examples.desktop
├── .gimp-2.8
│ └── sessionrc
├── .kde
│ └── share
│ └── config
│ └── kdeglobals
├── .profile
├── Temp
├── Templates
│ ├── New Document.docx
│ ├── New Presentation.pptx
│ ├── New Spreadsheet.xlsx
│ └── New Text File.txt
└── .tlp
├── Balanced
└── Power Save
You could potentially copy user configurations from the home directory of a running system into this directory. But I would not recommend that approach, since you have to be very careful not to copy user specific files.
A better way to setup default user preferences is to create a file called 90_ubuntu-settings.gschema.override
and place it in /usr/share/glib-2.0/schemas/
directory in Cubic.
Here is an example file:
[org.gnome.desktop.background]
picture-uri = 'file:///usr/share/backgrounds/warty-final-ubuntu.png'
show-desktop-icons = false
[org.gnome.desktop.screensaver]
picture-uri = 'file:///usr/share/backgrounds/warty-final-ubuntu.png'
[org.gnome.desktop.wm.preferences]
button-layout = 'close,minimize,maximize:appmenu'
titlebar-font = 'Roboto Regular 10'
[org.gnome.desktop.interface]
document-font-name = 'Roboto Regular 10'
font-name = 'Roboto Regular 10'
[org.gnome.shell]
favorite-apps = ['ubiquity.desktop', 'firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.gedit.desktop', 'org.gnome.Terminal.desktop', 'meld.desktop', 'libreoffice-writer.desktop', 'libreoffice-calc.desktop', 'org.gnome.Calculator.desktop', 'org.gnome.Screenshot.desktop', 'gnome-system-monitor.desktop']
(You can see what the correct keys and values are using dconf-editor
. Also, look at this answer on how to backup your Gnome Tweaks configuration to a file).
Then, compile this schema file using:
glib-compile-schemas /usr/share/glib-2.0/schemas/
All users will have the preferences you specified in 90_ubuntu-settings.gschema.override
.
To add new users, in Cubic, use the following command for each new user you want to create:
adduser
The new users will inherit the changes you made in /etc/skel
, and they will have the default settings you specified in 90_ubuntu-settings.gschema.override
.
In addition to installing applications using apt
, you can also install downloaded packages using dpkg -i
.
Here is an example installing a package using pip
:
apt install python3-pip
pip3 install yapf
These packages will be available in the ISO generated by Cubic.
You can also compile packages from source. Just download or copy the source files into Cubic. Make sure you have all required build tools installed, and build your packages.
Here is an example to compile and customize Geany from source, inside Cubic:
apt install debhelper fakeroot build-essential cmake git automake autoconf libtool intltool libgtk-3-dev docutils-common
mkdir ~/Customize
cd ~/Customize
git clone https://github.com/geany/geany.git
cd geany
sed -i 's|FT_00_CM=python |FT_00_CM=python3.6 |g' ./data/filedefs/filetypes.python
sed -i 's|EX_00_CM=python |EX_00_CM=python3.6 |g' ./data/filedefs/filetypes.python
./autogen.sh --enable-gtk3 --disable-html-docs --prefix=/usr
./configure --enable-gtk3 --disable-html-docs --prefix=/usr
make
make install
git clone https://github.com/codebrainz/geany-themes.git
cp ./geany-themes/colorschemes/*.conf /usr/share/geany/colorschemes/
chmod -x /usr/share/geany/colorschemes/*.conf
The compiled and installed applications will be available in the ISO generated by Cubic.
If you are installing drivers, be sure to install dkms
. Here is an example installing bluetooth an microcode drivers. I've also been successful setting up Nvidia drivers in Cubic.
# Dynamic Kernel Module Support Framework
apt intall dkms
# Broadcom 802.11 Linux STA wireless driver source
apt intall bcmwl-kernel-source
# intel-microcode - Processor microcode firmware for Intel CPUs
# iucode-tool - Intel processor microcode tool
apt intall intel-microcode iucode-tool
Also, in my experience, it is a good idea to not change or update the kernel Cubic if you are going to install drivers. This is because the chroot environment uses the same kernel as your host machine, so, sometimes, the drivers are installed for that kernel.
No comments:
Post a Comment