Merge branch 'move-to-docker'
oginstaller/pipeline/head This commit looks good Details

ogrepo-keys
Nicolas Arenas 2024-11-05 01:12:43 +01:00
parent dcb2962fbb
commit 8162f5b3c3
49 changed files with 1601 additions and 0 deletions

9
.gitignore vendored 100644
View File

@ -0,0 +1,9 @@
chroot
image
*.log
*.tmp
ubuntu_chroot
create_end_squashfs.sh
ogCore_config.json
ogGui_config.json
test.sh

3
Dockerfile 100644
View File

@ -0,0 +1,3 @@
FROM ubuntu:24.04
RUN apt -y update && apt -y install debootstrap xorriso squashfs-tools grub-pc-bin grub-efi-amd64-bin mtools dosfstools

20
Jenkinsfile vendored 100644
View File

@ -0,0 +1,20 @@
pipeline {
agent {
label 'ogAdministrator'
}
stages {
stage('Build') {
steps {
sh "echo root > root_passwd"
sh 'docker run --privileged -v /dev:/dev -v /run:/run -v $(pwd):/installer -w /installer --rm opengnsys/oginstallerbuilder ./builder.sh'
}
}
stage ('Upload Image to NFS')
{
steps {
sh "cp ubuntu-from-scratch.iso /mnt/srv/artefactos/oginstaller/oginstaller-${BRANCH_NAME}_${BUILD_NUMBER}.iso"
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
art/logo_ogw.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

145
builder.sh 100755
View File

@ -0,0 +1,145 @@
#!/usr/bin/bash
set -x
set -e
DIR=/ubuntu_scratch
CHROOT_DIR=$DIR/chroot
UBUNTU_CHROOT_DIR=$DIR/ubuntu_chroot
DIST=noble
VARIANT=minbase
CLEAN=${CLEAN:-1}
CLEAN_CHROOT=${CLEAN_CHROOT:-1}
OUTPUT_DIR=/installer
IMAGE_DIR=$DIR/image
DEBOOT_STRAP_URL=http://mirror.raiolanetworks.com/ubuntu/
mkdir -p $IMAGE_DIR
mkdir -p $CHROOT_DIR
# # Copio el script chroot_setup.sh al directorio chroot
cp chroot_setup.sh $CHROOT_DIR
cp buildlib.sh $CHROOT_DIR
cp root_passwd $CHROOT_DIR
chmod +x $CHROOT_DIR/chroot_setup.sh
# # Deploy boot strap
if [ $CLEAN_CHROOT -eq 1 ];
then
debootstrap --arch=amd64 --variant=$VARIANT $DIST $CHROOT_DIR $DEBOOT_STRAP_URL
fi
mkdir -p $CHROOT_DIR/usr/share/calamares/branding/
mkdir -p $CHROOT_DIR/etc/calamares/modules/
cp calamares/settings.conf $CHROOT_DIR/etc/calamares/
cp calamares/modules/*.conf $CHROOT_DIR/etc/calamares/modules/
cp -r calamares/src/branding/opengnsys $CHROOT_DIR/usr/share/calamares/branding/
chmod 755 $CHROOT_DIR/usr/share/calamares/branding/opengnsys
chmod 644 $CHROOT_DIR/usr/share/calamares/branding/opengnsys/*
chmod 755 $CHROOT_DIR/usr/share/calamares/branding/opengnsys/lang
chmod 644 $CHROOT_DIR/usr/share/calamares/branding/opengnsys/lang/*
mkdir -p $CHROOT_DIR/usr/share/opengnsys/images
cp art/* $CHROOT_DIR/usr/share/opengnsys/images/
mkdir -p $CHROOT_DIR/usr/local/bin
cp openGnsys-installer.sh $CHROOT_DIR/usr/local/bin/
chmod +x $CHROOT_DIR/usr/local/bin/openGnsys-installer.sh
# # Create mount points
mount --bind /dev/ $CHROOT_DIR/dev
mount --bind /run/ $CHROOT_DIR/run
# Execute chroot_setup.sh
chroot $CHROOT_DIR /chroot_setup.sh
cp conf/pcmanfm.conf $CHROOT_DIR/etc/xdg/pcmanfm/default/pcmanfm.conf
# Clean up the environment
umount $CHROOT_DIR/dev
umount $CHROOT_DIR/run
# Compress the chroot deploy
mkdir -p $IMAGE_DIR
mv $CHROOT_DIR/image $DIR/
# Create squashfs imagesudo
mksquashfs $CHROOT_DIR $IMAGE_DIR/casper/filesystem.squashfs \
-noappend -no-duplicates -no-recovery \
-wildcards \
-comp xz -b 1M -Xdict-size 100% \
-e "var/cache/apt/archives/*" -e "root/*" -e "root/.*" -e "tmp/*" -e "tmp/.*" -e "swapfile"
printf $(du -sx --block-size=1 $CHROOT_DIR | cut -f1) | tee $IMAGE_DIR/casper/filesystem.size
# Deboot strap real Ubuntu image
debootstrap --arch=amd64 --variant=minbase noble $UBUNTU_CHROOT_DIR $DEBOOT_STRAP_URL
rm -f $UBUNTU_CHROOT_DIR/etc/resolv.conf
echo 'nameserver 8.8.8.8' >$UBUNTU_CHROOT_DIR/etc/resolv.conf
cp setup_chroot_ubuntu.sh $UBUNTU_CHROOT_DIR
chroot $UBUNTU_CHROOT_DIR chmod +x /setup_chroot_ubuntu.sh
cp buildlib.sh $UBUNTU_CHROOT_DIR
mkdir -p $UBUNTU_CHROOT_DIR/opengnsys-installer
cp component-installer.sh $UBUNTU_CHROOT_DIR/opengnsys-installer/
chmod +x $UBUNTU_CHROOT_DIR/opengnsys-installer/component-installer.sh
cp provision_ogcore.sh $UBUNTU_CHROOT_DIR/opengnsys-installer/
chmod +x $UBUNTU_CHROOT_DIR/opengnsys-installer/provision_ogcore.sh
cp provision_oggui.sh $UBUNTU_CHROOT_DIR/opengnsys-installer/
chmod +x $UBUNTU_CHROOT_DIR/opengnsys-installer/provision_oggui.sh
cp pat.txt $UBUNTU_CHROOT_DIR/opengnsys-installer/
# Setup the chroot for ubuntu
mount --bind /dev/ $UBUNTU_CHROOT_DIR/dev
mount --bind /run/ $UBUNTU_CHROOT_DIR/run
chroot $UBUNTU_CHROOT_DIR /setup_chroot_ubuntu.sh
# Clean up the environment
umount $UBUNTU_CHROOT_DIR/dev
umount $UBUNTU_CHROOT_DIR/run
# Compress the ububtu chroot
mksquashfs $UBUNTU_CHROOT_DIR $IMAGE_DIR/casper/filesystem.ubuntu.sqfs \
-noappend -no-duplicates -no-recovery \
-wildcards \
-comp xz -b 1M -Xdict-size 100% \
-e "var/cache/apt/archives/*" -e "root/*" -e "root/.*" -e "tmp/*" -e "tmp/.*" -e "swapfile"
# Create ISO imageq
cd $IMAGE_DIR && \
xorriso \
-as mkisofs \
-iso-level 3 \
-full-iso9660-filenames \
-J -joliet-long \
-volid "Ubuntu_scratch" \
-output $OUTPUT_DIR/ubuntu-from-scratch.iso \
-eltorito-boot isolinux/bios.img \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
--eltorito-catalog boot.catalog \
--grub2-boot-info \
--grub2-mbr ../chroot/usr/lib/grub/i386-pc/boot_hybrid.img \
-partition_offset 16 \
--mbr-force-bootable \
-eltorito-alt-boot \
-no-emul-boot \
-e isolinux/efiboot.img \
-append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b isolinux/efiboot.img \
-appended_part_as_gpt \
-iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 \
-m "isolinux/efiboot.img" \
-m "isolinux/bios.img" \
-e '--interval:appended_partition_2:::' \
-exclude isolinux \
-graft-points \
"/EFI/boot/bootx64.efi=isolinux/bootx64.efi" \
"/EFI/boot/mmx64.efi=isolinux/mmx64.efi" \
"/EFI/boot/grubx64.efi=isolinux/grubx64.efi" \
"/EFI/ubuntu/grub.cfg=isolinux/grub.cfg" \
"/isolinux/bios.img=isolinux/bios.img" \
"/isolinux/efiboot.img=isolinux/efiboot.img" \
"."
cd -

120
buildlib.sh 100644
View File

@ -0,0 +1,120 @@
#!/usr/bin/bash
function set_root_passwd(){
echo "root:root" | chpasswd
}
function setup_sources_list () {
echo "Setting up sources.list"
cat <<EOF > $CHROOT_DIR/etc/apt/sources.list
deb $DEBOOT_STRAP_URL noble main restricted universe multiverse
deb-src $DEBOOT_STRAP_URL noble main restricted universe multiverse
deb $DEBOOT_STRAP_URL noble-security main restricted universe multiverse
deb-src $DEBOOT_STRAP_URL noble-security main restricted universe multiverse
deb $DEBOOT_STRAP_URL noble-updates main restricted universe multiverse
deb-src $DEBOOT_STRAP_URL noble-updates main restricted universe multiverse
EOF
apt update -y
apt-get -y upgrade
}
function configure_divert() {
echo "Configuring divert"
dbus-uuidgen > /etc/machine-id
mkdir -p /var/lib/dbus/
ln -fs /etc/machine-id /var/lib/dbus/machine-id
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
}
function mount_proc_sys_dev() {
echo "Mounting proc, sys and dev"
mount -t proc proc /proc
mount -t sysfs sys /sys
mount -t devpts devpts /dev/pts
}
function install_packages() {
echo "Installing packages"
apt install -y $@
}
function install_non_interactive() {
echo "Installing packages non interactive"
apt install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $@
}
function install_no_recommends() {
echo "Installing packages without recommends"
apt install -y --no-install-recommends $@
}
function setup_chroot() {
echo "Setting up chroot"
dbus-uuidgen > /etc/machine-id
apt update -y
ln -fs /etc/machine-id /var/lib/dbus/machine-id
ln -s /bin/true /sbin/initctl
}
function remove_unneeded_packages() {
echo "Removing unneeded packages"
apt remove -y --purge --auto-remove snapd
}
function reconfigure_locales() {
echo "Configuring locales"
sed -i 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/' /etc/locale.gen
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime
echo "Europe/Madrid" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
}
function reconfigure_network_manager() {
echo "Configuring network manager"
mkdir -p /etc/NetworkManager
cat <<EOF > /etc/NetworkManager/NetworkManager.conf
[main]
plugins=keyfile
[keyfile]
unmanaged-devices=none
EOF
mkdir -p /etc/NetworkManager/system-connections/
cat <<EOL > /etc/NetworkManager/system-connections/dhcp-all.nmconnection
[connection]
id=Cable
type=ethernet
autoconnect=true
[ipv4]
method=auto
EOL
systemctl enable NetworkManager
}
function clean (){
truncate -s 0 /etc/machine-id
rm /sbin/initctl
dpkg-divert --rename --remove /sbin/initctl
apt-get clean
rm -rf /tmp/* ~/.bash_history
umount /proc
umount /sys
umount /dev/pts
export HISTSIZE=0
}
function user_add() {
useradd -m -s /bin/bash -G sudo og
echo "og:og" | chpasswd
}

View File

@ -0,0 +1,17 @@
---
efiBootLoader: "grub"
kernelSearchPath: "/boot/"
kernelInstallPath: "/boot/"
kernelPattern: "^vmlinuz.*"
loaderEntries:
- "timeout 5"
- "console-mode keep"
kernelParams: [ "quiet" ]
grubInstall: "grub-install"
grubMkconfig: "grub-mkconfig"
grubCfg: "/boot/grub/grub.cfg"
grubProbe: "grub-probe"
efiBootMgr: "efibootmgr"

View File

@ -0,0 +1,17 @@
---
efiBootLoader: "grub"
kernelSearchPath: "/boot/"
kernelInstallPath: "/boot/"
kernelPattern: "^vmlinuz.*"
loaderEntries:
- "timeout 5"
- "console-mode keep"
kernelParams: [ "quiet" ]
grubInstall: "grub-install"
grubMkconfig: "grub-mkconfig"
grubCfg: "/boot/grub/grub.cfg"
grubProbe: "grub-probe"
efiBootMgr: "efibootmgr"

View File

@ -0,0 +1,19 @@
---
extraMounts:
- device: proc
fs: proc
mountPoint: /proc
- device: sys
fs: sysfs
mountPoint: /sys
- device: /dev
mountPoint: /dev
options: [ bind ]
- device: tmpfs
fs: tmpfs
mountPoint: /run
- device: /run/dev
mountPoint: /run/dev
options: [ bind ]

View File

@ -0,0 +1,19 @@
---
extraMounts:
- device: proc
fs: proc
mountPoint: /proc
- device: sys
fs: sysfs
mountPoint: /sys
- device: /dev
mountPoint: /dev
options: [ bind ]
- device: tmpfs
fs: tmpfs
mountPoint: /run
- device: /run/dev
mountPoint: /run/dev
options: [ bind ]

View File

@ -0,0 +1,13 @@
---
update_db: true
backend: apt
operations:
- install:
- vim
- git
- isc-dhcp-client
- jq
- network-manager
- openssh-server
- systemd-resolved

View File

@ -0,0 +1 @@
../packages.conf

View File

@ -0,0 +1,11 @@
---
dontChroot: false
verbose: true
script:
- "/opengnsys-installer/component-installer.sh"
timeout: 600
verbose: true

View File

@ -0,0 +1,9 @@
---
dontChroot: true
verbose: true
script:
- mkdir -p ${ROOT}/opengnsys-installer
- cp /tmp/opengnsys-installer-configs/* ${ROOT}/opengnsys-installer

View File

@ -0,0 +1,11 @@
---
dontChroot: false
verbose: true
script:
- /opengnsys-installer/component-installer.sh
timeout: 600
verbose: true

View File

@ -0,0 +1,9 @@
---
dontChroot: true
verbose: true
script:
- mkdir -p ${ROOT}/opengnsys-installer
- cp /tmp/opengnsys-installer-configs/* ${ROOT}/opengnsys-installer

View File

@ -0,0 +1,6 @@
---
unpack:
- source: "/cdrom/casper/filesystem.ubuntu.sqfs"
sourcefs: squashfs
destination: "/"

View File

@ -0,0 +1,6 @@
---
unpack:
- source: "/home/narenas/filesystem.ubuntu.sqfs"
sourcefs: squashfs
destination: "/"

View File

@ -0,0 +1,34 @@
defaultGroups:
- name: users
system: true
- dip:
system: true
- plugdev:
system: true
- lxd:
system: true
- ogadmin:
sudoersGroup: ogadmin
setRootPassword: true
doReusePassword: true
passwordRequirements:
minLength: -1 # Password at least this many characters
maxLength: -1 # Password at most this many characters
libpwquality:
- minlen=0
- minclass=0
user:
shell: /bin/bash
forbidden_names: [ root ]
home_permissions: "0700"
hostname:
location: EtcFile
writeHostsFile: true
template: "ogServer"
forbidden_names: [ localhost ]

View File

@ -0,0 +1,34 @@
defaultGroups:
- name: users
system: true
- dip:
system: true
- plugdev:
system: true
- lxd:
system: true
- ogadmin:
sudoersGroup: ogadmin
setRootPassword: true
doReusePassword: true
passwordRequirements:
minLength: -1 # Password at least this many characters
maxLength: -1 # Password at most this many characters
libpwquality:
- minlen=0
- minclass=0
user:
shell: /bin/bash
forbidden_names: [ root ]
home_permissions: "0700"
hostname:
location: EtcFile
writeHostsFile: true
template: "ogServer"
forbidden_names: [ localhost ]

View File

@ -0,0 +1,51 @@
---
modules-search:
- local
- /usr/lib/x86_64-linux-gnu/calamares/modules
instances:
- id: shell_nonchroot
module: shellprocess
config: shell_nonchroot.conf
- id: shell_chroot
module: shellprocess
config: shell_chroot.conf
sequence:
- show:
- welcome
- locale
- keyboard
- partition
- users
- summary
- exec:
- partition
- mount
- unpackfs
- fstab
- packages
- machineid
- locale
- keyboard
- users
- hwclock
- shellprocess@shell_nonchroot
- shellprocess@shell_chroot
- networkcfg
- initramfs
- bootloader
- umount
- show:
- finished
branding: opengnsys
prompt-install: false
dont-chroot: false
oem-setup: false
disable-cancel: false
hide-back-and-next-during-exec: false
disable-cancel-during-exec: false
quit-at-end: false

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -0,0 +1,239 @@
# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
#
# Product branding information. This influences some global
# user-visible aspects of Calamares, such as the product
# name, window behavior, and the slideshow during installation.
#
# Additional styling can be done using the stylesheet.qss
# file, also in the branding directory.
---
componentName: opengnsys
### WELCOME / OVERALL WORDING
#
# These settings affect some overall phrasing and looks,
# which are most visible in the welcome page.
# This selects between different welcome texts. When false, uses
# the traditional "Welcome to the %1 installer.", and when true,
# uses "Welcome to the Calamares installer for %1." This allows
# to distinguish this installer from other installers for the
# same distribution.
welcomeStyleCalamares: false
# Should the welcome image (productWelcome, below) be scaled
# up beyond its natural size? If false, the image does not grow
# with the window but remains the same size throughout (this
# may have surprising effects on HiDPI monitors).
welcomeExpandingLogo: true
### WINDOW CONFIGURATION
#
# The settings here affect the placement of the Calamares
# window through hints to the window manager and initial
# sizing of the Calamares window.
# Size and expansion policy for Calamares.
# - "normal" or unset, expand as needed, use *windowSize*
# - "fullscreen", start as large as possible, ignore *windowSize*
# - "noexpand", don't expand automatically, use *windowSize*
windowExpanding: normal
# Size of Calamares window, expressed as w,h. Both w and h
# may be either pixels (suffix px) or font-units (suffix em).
# e.g. "800px,600px"
# "60em,480px"
# This setting is ignored if "fullscreen" is selected for
# *windowExpanding*, above. If not set, use constants defined
# in CalamaresUtilsGui, 800x520.
windowSize: 800px,520px
# Placement of Calamares window. Either "center" or "free".
# Whether "center" actually works does depend on the window
# manager in use (and only makes sense if you're not using
# *windowExpanding* set to "fullscreen").
windowPlacement: center
### PANELS CONFIGURATION
#
# Calamares has a main content area, and two panels (navigation
# and progress / sidebar). The panels can be controlled individually,
# or switched off. If both panels are switched off, the layout of
# the main content area loses its margins, on the assumption that
# you're doing something special.
# Kind of sidebar (panel on the left, showing progress).
# - "widget" or unset, use traditional sidebar (logo, items)
# - "none", hide it entirely
# - "qml", use calamares-sidebar.qml from branding folder
# In addition, you **may** specify a side, separated by a comma,
# from the kind. Valid sides are:
# - "left" (if not specified, uses this)
# - "right"
# - "top"
# - "bottom"
# For instance, "widget,right" is valid; so is "qml", which defaults
# to putting the sidebar on the left. Also valid is "qml,top".
# While "widget,top" is valid, the widgets code is **not** flexible
# and results will be terrible.
sidebar: widget
# Kind of navigation (button panel on the bottom).
# - "widget" or unset, use traditional navigation
# - "none", hide it entirely
# - "qml", use calamares-navigation.qml from branding folder
# In addition, you **may** specify a side, separated by a comma,
# from the kind. The same sides are valid as for *sidebar*,
# except the default is *bottom*.
navigation: widget
### STRINGS, IMAGES AND COLORS
#
# This section contains the "branding proper" of names
# and images, rather than global-look settings.
# These are strings shown to the user in the user interface.
# There is no provision for translating them -- since they
# are names, the string is included as-is.
#
# The four Url strings are the Urls used by the buttons in
# the welcome screen, and are not shown to the user. Clicking
# on the "Support" button, for instance, opens the link supportUrl.
# If a Url is empty, the corresponding button is not shown.
#
# bootloaderEntryName is how this installation / distro is named
# in the boot loader (e.g. in the GRUB menu).
#
# These strings support substitution from /etc/os-release
# if KDE Frameworks 5.58 are available at build-time. When
# enabled, ${varname} is replaced by the equivalent value
# from os-release. All the supported var-names are in all-caps,
# and are listed on the FreeDesktop.org site,
# https://www.freedesktop.org/software/systemd/man/os-release.html
# Note that ANSI_COLOR and CPE_NAME don't make sense here, and
# are not supported (the rest are). Remember to quote the string
# if it contains substitutions, or you'll get YAML exceptions.
#
# The *Url* entries are used on the welcome page, and they
# are visible as buttons there if the corresponding *show* keys
# are set to "true" (they can also be overridden).
strings:
productName: "${NAME}"
shortProductName: Generic
version: 2023.3 LTS
shortVersion: 2023.3
versionedName: Fancy GNU/Linux 2023.3 LTS "Venomous Vole"
shortVersionedName: FancyGL 2023.3
bootloaderEntryName: FancyGL
productUrl: https://calamares.io/
supportUrl: https://github.com/calamares/calamares/wiki
knownIssuesUrl: https://github.com/calamares/calamares/issues
releaseNotesUrl: https://calamares.io/news/
donateUrl: https://kde.org/community/donations/index.php
# These images are loaded from the branding module directory.
#
# productBanner is an optional image, which if present, will be shown
# on the welcome page of the application, above the welcome text.
# It is intended to have a width much greater than height.
# It is displayed at 64px height (also on HiDPI).
# Recommended size is 64px tall, and up to 460px wide.
# productIcon is used as the window icon, and will (usually) be used
# by the window manager to represent the application. This image
# should be square, and may be displayed by the window manager
# as small as 16x16 (but possibly larger).
# productLogo is used as the logo at the top of the left-hand column
# which shows the steps to be taken. The image should be square,
# and is displayed at 80x80 pixels (also on HiDPI).
# productWallpaper is an optional image, which if present, will replace
# the normal solid background on every page of the application.
# It can be any size and proportion,
# and will be tiled to fit the entire window.
# For a non-tiled wallpaper, the size should be the same as
# the overall window, see *windowSize* above (800x520).
# productWelcome is shown on the welcome page of the application in
# the middle of the window, below the welcome text. It can be
# any size and proportion, and will be scaled to fit inside
# the window. Use `welcomeExpandingLogo` to make it non-scaled.
# Recommended size is 320x150.
#
# These filenames can also use substitutions from os-release (see above).
images:
# productBanner: "banner.png"
productIcon: "squid.png"
productLogo: "squid.png"
# productWallpaper: "wallpaper.png"
productWelcome: "languages.png"
# Colors for text and background components.
#
# - SidebarBackground is the background of the sidebar
# - SidebarText is the (foreground) text color
# - SidebarBackgroundCurrent sets the background of the current step.
# Optional, and defaults to the application palette.
# - SidebarTextCurrent is the text color of the current step.
#
# These colors can **also** be set through the stylesheet, if the
# branding component also ships a stylesheet.qss. Then they are
# the corresponding CSS attributes of #sidebarApp.
style:
SidebarBackground: "#292F34"
SidebarText: "#FFFFFF"
SidebarTextCurrent: "#292F34"
SidebarBackgroundCurrent: "#D35400"
### SLIDESHOW
#
# The slideshow is displayed during execution steps (e.g. when the
# installer is actually writing to disk and doing other slow things).
# The slideshow can be a QML file (recommended) which can display
# arbitrary things -- text, images, animations, or even play a game --
# during the execution step. The QML **is** abruptly stopped when the
# execution step is done, though, so maybe a game isn't a great idea.
#
# The slideshow can also be a sequence of images (not recommended unless
# you don't want QML at all in your Calamares). The images are displayed
# at a rate of 1 every 2 seconds during the execution step.
#
# To configure a QML file, list a single filename:
# slideshow: "show.qml"
# To configure images, like the filenames (here, as an inline list):
# slideshow: [ "/etc/calamares/slideshow/0.png", "/etc/logo.png" ]
slideshow: "show.qml"
# There are two available APIs for a QML slideshow:
# - 1 (the default) loads the entire slideshow when the installation-
# slideshow page is shown and starts the QML then. The QML
# is never stopped (after installation is done, times etc.
# continue to fire).
# - 2 loads the slideshow on startup and calls onActivate() and
# onLeave() in the root object. After the installation is done,
# the show is stopped (first by calling onLeave(), then destroying
# the QML components).
#
# An image slideshow does not need to have the API defined.
slideshowAPI: 2
# These options are to customize online uploading of logs to pastebins:
# - type : Defines the kind of pastebin service to be used. Currently
# it accepts two values:
# - none : disables the pastebin functionality
# - fiche : use fiche pastebin server
# - url : Defines the address of pastebin service to be used.
# Takes string as input. Important bits are the host and port,
# the scheme is not used.
# - sizeLimit : Defines maximum size limit (in KiB) of log file to be pasted.
# The option must be set, to have the log option work.
# Takes integer as input. If < 0, no limit will be forced,
# else only last (approximately) 'n' KiB of log file will be pasted.
# Please note that upload size may be slightly over the limit (due
# to last minute logging), so provide a suitable value.
uploadServer :
type : "fiche"
url : "http://termbin.com:9999"
sizeLimit : -1

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
SPDX-License-Identifier: GPL-3.0-or-later

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -0,0 +1,73 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
import QtQuick 2.0;
import calamares.slideshow 1.0;
Presentation
{
id: presentation
function nextSlide() {
console.log("QML Component (default slideshow) Next slide");
presentation.goToNextSlide();
}
Timer {
id: advanceTimer
interval: 1000
running: presentation.activatedInCalamares
repeat: true
onTriggered: nextSlide()
}
Slide {
Image {
id: background
source: "Opengnsys-wallpaper.jpg"
width: 200; height: 200
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background.horizontalCenter
anchors.top: background.bottom
text: "This is a customizable QML slideshow for Opengnsys project.<br/>"
wrapMode: Text.WordWrap
width: presentation.width
horizontalAlignment: Text.Center
}
}
Slide {
centeredText: qsTr("Opengnsys is and incredible project.")
}
Slide {
centeredText: qsTr("Look at the marvelous of Opengnsys Project.")
}
// When this slideshow is loaded as a V1 slideshow, only
// activatedInCalamares is set, which starts the timer (see above).
//
// In V2, also the onActivate() and onLeave() methods are called.
// These example functions log a message (and re-start the slides
// from the first).
function onActivate() {
console.log("QML Component (default slideshow) activated");
presentation.currentSlide = 0;
}
function onLeave() {
console.log("QML Component (default slideshow) deactivated");
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2014 Teo Mrnjavac <teo@kde.org>
SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -0,0 +1,96 @@
/*
* SPDX-FileCopyrightText: no
* SPDX-License-Identifier: CC0-1.0
*/
/*
A branding component can ship a stylesheet (like this one)
which is applied to parts of the Calamares user-interface.
In principle, all parts can be styled through CSS.
Missing parts should be filed as issues.
The IDs are based on the object names in the C++ code.
You can use the Debug Dialog to find out object names:
- Open the debug dialog
- Choose tab *Tools*
- Click *Widget Tree* button
The list of object names is printed in the log.
Documentation for styling Qt Widgets through a stylesheet
can be found at
https://doc.qt.io/qt-5/stylesheet-examples.html
https://doc.qt.io/qt-5/stylesheet-reference.html
In Calamares, styling widget classes is supported (e.g.
using `QComboBox` as a selector).
This example stylesheet has all the actual styling commented out.
The examples are not exhaustive.
*/
/*** Generic Widgets.
*
* You can style **all** widgets of a given class by selecting
* the class name. Some widgets have specialized sub-selectors.
*/
/*
QPushButton { background-color: green; }
*/
/*** Main application window.
*
* The main application window has the sidebar, which in turn
* contains a logo and a list of items -- note that the list
* can **not** be styled, since it has its own custom C++
* delegate code.
*/
/*
#mainApp { }
#sidebarApp { }
#logoApp { }
*/
/*** Welcome module.
*
* There are plenty of parts, but the buttons are the most interesting
* ones (donate, release notes, ...). The little icon image can be
* styled through *qproperty-icon*, which is a little obscure.
* URLs can reference the QRC paths of the Calamares application
* or loaded via plugins or within the filesystem. There is no
* comprehensive list of available icons, though.
*/
/*
QPushButton#aboutButton { qproperty-icon: url(:/data/images/release.svg); }
#donateButton,
#supportButton,
#releaseNotesButton,
#knownIssuesButton { qproperty-icon: url(:/data/images/help.svg); }
*/
/*** Partitioning module.
*
* Many moving parts, which you will need to experiment with.
*/
/*
#bootInfoIcon { }
#bootInfoLable { }
#deviceInfoIcon { }
#defineInfoLabel { }
#scrollAreaWidgetContents { }
#partitionBarView { }
*/
/*** Licensing module.
*
* The licensing module paints individual widgets for each of
* the licenses. The item can be collapsed or expanded.
*/
/*
#licenseItem { }
#licenseItemFullText { }
*/

View File

@ -0,0 +1 @@
../modules/

236
chroot_setup.sh 100644
View File

@ -0,0 +1,236 @@
#!/bin/bash
set -x
set -e
export HOME=/root
export LC_ALL=C
export DEBIAN_FRONTEND=noninteractive
export DEBOOT_STRAP_URL=http://mirror.raiolanetworks.com/ubuntu/
source buildlib.sh
function configure_sddm_and_openbox() {
# Allow root login
sed -ie 's/^\(.*root quiet_success\)$/#\1/' /etc/pam.d/sddm
# Start pcman for the Desktop
#mkdir -p /root/.config/autostart/
# cat <<EOF > /root/.config/autostart/pcmanfm.desktop
mkdir -p /etc/xdg/openbox/
cat <<EOF > /etc/xdg/openbox/autostart
pcmanfm --desktop &
EOF
# Create desktop launcher for calamares
# mkdir -p /root/Desktop
# cat <<EOF > /root/Desktop/opengnsys-installer.desktop
mkdir -p /etc/skel/Desktop
cat <<EOF > /etc/skel/Desktop/opengnsys-installer.desktop
[Desktop Entry]
Version=1.0
Name=Install OpenGnsys
Comment=Este es un acceso directo para ejecutar un script como root
Exec=/usr/local/bin/openGnsys-installer.sh
Icon=/usr/share/opengnsys/images/logo_ogw.png
Terminal=false
Type=Application
Categories=Utility;
EOF
# chmod +x /root/Desktop/opengnsys-installer.desktop
chmod +x /etc/skel/Desktop/opengnsys-installer.desktop
# Configure ssdm autologin
mkdir -p /etc/sddm.conf.d/
cat <<EOF > /etc/sddm.conf.d/autologin.conf
[Autologin]
User=og
Session=openbox
EOF
}
function set_pkg_configuration() {
echo "keyboard-configuration keyboard-configuration/layout select Spanish" | debconf-set-selections
echo "keyboard-configuration keyboard-configuration/variant select Spanish" | debconf-set-selections
echo "keyboard-configuration keyboard-configuration/xkb-keymap select es" | debconf-set-selections
}
function reconfigure_packages() {
reconfigure_locales
reconfigure_network_manager
}
function create_image() {
mkdir -p /image/{casper,isolinux,install}
cp /boot/vmlinuz-**-**-generic /image/casper/vmlinuz
cp /boot/initrd.img-**-**-generic /image/casper/initrd
wget --progress=dot https://memtest.org/download/v7.00/mt86plus_7.00.binaries.zip -O /image/install/memtest86.zip
unzip -p /image/install/memtest86.zip memtest64.bin > /image/install/memtest86+.bin
unzip -p /image/install/memtest86.zip memtest64.efi > /image/install/memtest86+.efi
rm -f /image/install/memtest86.zip
}
function configure_grub_menu() {
touch /image/ubuntu
cat <<EOF > /image/isolinux/grub.cfg
search --set=root --file /ubuntu
insmod all_video
set default="0"
set timeout=30
menuentry "Install Ubuntu FS" {
linux /casper/vmlinuz boot=casper quiet splash ---
initrd /casper/initrd
}
menuentry "Check disc for defects" {
linux /casper/vmlinuz boot=casper integrity-check quiet splash ---
initrd /casper/initrd
}
grub_platform
if [ "\$grub_platform" = "efi" ]; then
menuentry 'UEFI Firmware Settings' {
fwsetup
}
menuentry "Test memory Memtest86+ (UEFI)" {
linux /install/memtest86+.efi
}
else
menuentry "Test memory Memtest86+ (BIOS)" {
linux16 /install/memtest86+.bin
}
fi
EOF
# Generate manifest
dpkg-query -W --showformat='${Package} ${Version}\n' | sudo tee /image/casper/filesystem.manifest
cp -v /image/casper/filesystem.manifest /image/casper/filesystem.manifest-desktop
sed -i '/ubiquity/d' /image/casper/filesystem.manifest-desktop
sed -i '/casper/d' /image/casper/filesystem.manifest-desktop
sed -i '/discover/d' /image/casper/filesystem.manifest-desktop
sed -i '/laptop-detect/d' /image/casper/filesystem.manifest-desktop
sed -i '/os-prober/d' /image/casper/filesystem.manifest-desktop
# Create diskdefines
cat <<EOF > /image/README.diskdefines
#define DISKNAME Ubuntu from scratch
#define TYPE binary
#define TYPEbinary 1
#define ARCH amd64
#define ARCHamd64 1
#define DISKNUM 1
#define DISKNUM1 1
#define TOTALNUM 0
#define TOTALNUM0 1
EOF
}
function create_image2(){
cp /usr/lib/shim/shimx64.efi.signed.previous /image/isolinux/bootx64.efi
cp /usr/lib/shim/mmx64.efi /image/isolinux/mmx64.efi
cp /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed /image/isolinux/grubx64.efi
cd /image/isolinux && \
dd if=/dev/zero of=efiboot.img bs=1M count=10 && \
mkfs.vfat -F 16 efiboot.img && \
LC_CTYPE=C mmd -i efiboot.img efi efi/ubuntu efi/boot && \
LC_CTYPE=C mcopy -i efiboot.img ./bootx64.efi ::efi/boot/bootx64.efi && \
LC_CTYPE=C mcopy -i efiboot.img ./mmx64.efi ::efi/boot/mmx64.efi && \
LC_CTYPE=C mcopy -i efiboot.img ./grubx64.efi ::efi/boot/grubx64.efi && \
LC_CTYPE=C mcopy -i efiboot.img ./grub.cfg ::efi/ubuntu/grub.cfg && \
# Create a grub bios images
cd /image && \
grub-mkstandalone \
--format=i386-pc \
--output=isolinux/core.img \
--install-modules="linux16 linux normal iso9660 biosdisk memdisk search tar ls" \
--modules="linux16 linux normal iso9660 biosdisk search" \
--locales="" \
--fonts="" \
"boot/grub/grub.cfg=isolinux/grub.cfg"
cat /usr/lib/grub/i386-pc/cdboot.img isolinux/core.img > isolinux/bios.img
# find . -type f -print0 | xargs -0 md5sum | grep -v -e 'isolinux' > md5sum.txt
}
function install_mesa_repo() {
add-apt-repository ppa:kisak/kisak-mesa
apt -y update
}
function user_add() {
useradd -m -k /etc/skel -s /bin/bash -G sudo og
echo "og:og" | chpasswd
}
function set_root_passwd() {
ROOT_PASSWORD=$(cat /root_passwd)
echo "root:$ROOT_PASSWORD" | chpasswd
}
function add_og_to_sudoers() {
echo "Adding og to sudoers"
mkdir -p /etc/sudoers.d/
echo "og ALL=(ALL) NOPASSWD: /usr/bin/calamares" > /etc/sudoers.d/og
chmod 440 /etc/sudoers.d/og
}
function add_auditd_rules() {
echo "Adding auditd rules"
cat << EOF > /etc/audit/rules.d/audit.rules
-w /etc/sddm.conf -p wa -k sddm_watch
EOF
}
function delete_sddm_conf() {
cat <<EOF > /etc/systemd/system/delete-sddm-conf.service
[Unit]
Description=Eliminar /etc/sddm.conf antes de iniciar SDDM
Before=sddm.service
[Service]
Type=oneshot
ExecStart=/bin/rm -f /etc/sddm.conf
[Install]
WantedBy=multi-user.target
EOF
systemctl enable delete-sddm-conf
}
## Main
echo "ubuntu-fs-live" > /etc/hostname
mount_proc_sys_dev
setup_sources_list
install_packages libterm-readline-gnu-perl systemd-sysv software-properties-common
setup_chroot
set_pkg_configuration
install_mesa_repo
install_non_interactive
install_packages sudo ubuntu-standard sudo casper dbus-bin mesa-utils mesa-vulkan-drivers discover isc-dhcp-client laptop-detect unzip os-prober network-manager net-tools wireless-tools wpagui locales grub-common grub-gfxpayload-lists grub-pc grub-pc-bin grub2-common grub-efi-amd64-signed shim-signed mtools binutils virtualbox-guest-utils virtualbox-guest-x11 python3-xdg
install_non_interactive sddm openbox plymouth calamares terminator pcmanfm yad qml-module*
install_no_recommends linux-image-generic auditd
set_root_passwd
configure_divert
remove_unneeded_packages
reconfigure_packages
configure_sddm_and_openbox
user_add
add_og_to_sudoers
add_auditd_rules
delete_sddm_conf
create_image
configure_grub_menu
create_image2
clean

View File

@ -0,0 +1,150 @@
#!/usr/bin/bash
# Paso 1: Seleccionar los componentes
# Los componentes a instalar se encuentran en el directorio /tmp/opengnsys-installer-configs
# Set configuration
function install_docker() {
apt-get -y update
apt-get -y install ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get -y update
apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl enable docker
}
function install_ogcore_docker() {
cat <<EOF > /etc/systemd/system/ogcore.service
[Unit]
Description=Servicio para ejecutar Docker Compose de ogCore
After=docker.service
Requires=docker.service
[Service]
WorkingDirectory=/opt/opengnsys/ogCore/repo/
ExecStart=/usr/bin/docker compose -f /opt/opengnsys/ogCore/etc/docker-compose-deploy.yml up
ExecStartPost=/opengnsys-installer/provision_ogcore.sh
ExecStop=/usr/bin/docker compose -f /opt/opengnsys/ogCore/etc/docker-compose-deploy.yml stop
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now ogcore
}
function install_oggui_docker() {
# Sacar la IP del ogCore de la configuración
oggui_version=$(jq -r '.container_version' /opt/opengnsys/ogGui/installer/config.json)
# Exportar los valores como variables de entorno
ENV_DIR=/opt/opengnsys/ogGui/etc/
ENV_FILE=$ENV_DIR/.env
cat <<EOF > /etc/systemd/system/oggui-app.service
[Unit]
Description=Servicio para contenedor Docker de OgGui
After=docker.service
Requires=docker.service
[Service]
Restart=always
ExecStartPre=/opengnsys-installer/provision_oggui.sh
ExecStart=/usr/bin/docker run --rm --name ogGui-app -p 4200:4200 -v $ENV_FILE:/app/.env opengnsys/oggui:$oggui_version
ExecStop=/usr/bin/docker stop ogGui-app
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now oggui-app
}
COMPONENTS="ogCore ogGui ogDhcp ogBoot ogRepository"
CONFIGS_DIR=/opengnsys-installer/
PAT_FILE=/opengnsys-installer/pat.txt
PAT=$(cat $PAT_FILE | tr -d '\n\r\t')
OPENGNSYS_BASE_URL="https://$PAT@ognproject.evlt.uma.es/gitea/opengnsys"
OGBOOT_REPO="$OPENGNSYS_BASE_URL/ogboot.git"
OGCORE_REPO="$OPENGNSYS_BASE_URL/ogcore.git"
OGDHCP_REPO="$OPENGNSYS_BASE_URL/ogdhcp.git"
OGGUI_REPO="$OPENGNSYS_BASE_URL/oggui.git"
OGREPOSITORY_REPO="$OPENGNSYS_BASE_URL/ogrepo.git"
export GIT_SSL_NO_VERIFY=1
echo ======================================== > /etc/issue
echo "OpenGnSys Installer" >> /etc/issue
echo "Componentes instalados:" >> /etc/issue
for component in $COMPONENTS
do
config_file="config_${component}.json"
if [ -f $CONFIGS_DIR/$config_file ]; then
echo "Componente $component seleccionado, instalando configuración..."
component_dir=/opt/opengnsys/$component
mkdir -p $component_dir/installer
mkdir -p $component_dir/repo
cp $CONFIGS_DIR/$config_file /opt/opengnsys/$component/installer/config.json
case $component in
ogCore)
echo "Instalando ogCore..."
OGCORE_BRANCH=main
container_version=$(jq -r '.container_version' /opt/opengnsys/ogCore/installer/config.json)
git clone --branch "$OGCORE_BRANCH" "$OGCORE_REPO" "$component_dir/repo"
# Copy the docker-compose-deploy.yml file to /opt/opengnsys/ogCore/etc/
mkdir -p $component_dir/etc/
cp $component_dir/repo/docker-compose-deploy.yml $component_dir/etc/
sed -i "s/static/$container_version/g" $component_dir/repo/docker-compose-deploy.yml
echo - ogCore >> /etc/issue
install_docker
install_ogcore_docker
;;
ogGui)
echo "Instalando ogGui..."
OGGUI_BRANCH=main
git clone --branch "$OGGUI_BRANCH" "$OGGUI_REPO" "$component_dir/repo"
echo - ogGui >> /etc/issue
install_docker
install_oggui_docker
;;
ogDhcp)
echo "Instalando ogDhcp..."
git clone "$OGDHCP_REPO" "$component_dir/repo"
echo - ogDhcp >> /etc/issue
;;
ogBoot)
echo "Instalando ogBoot..."
git clone "$OGBOOT_REPO" "$component_dir/repo"
echo - ogBoot >> /etc/issue
;;
ogRepository)
echo "Instalando ogRepository..."
git clone "$OGREPOSITORY_REPO" "$component_dir/repo"
echo - ogRepository >> /etc/issue
;;
*)
echo "Componente $component no reconocido"
;;
esac
continue
fi
done
echo ======================================== >> /etc/issue
rm -f $PAT_FILE

27
conf/pcmanfm.conf 100644
View File

@ -0,0 +1,27 @@
[config]
bm_open_method=0
[volume]
mount_on_startup=1
mount_removable=1
autorun=1
[desktop]
wallpaper_mode=fit
wallpaper=/usr/share/opengnsys/images/Opengnsys-wallpaper.jpg
desktop_bg=#000000
desktop_fg=#ffffff
desktop_shadow=#000000
show_wm_menu=0
[ui]
win_width=640
win_height=480
splitter_pos=150
side_pane_mode=1
view_mode=0
show_hidden=0
sort_type=0
sort_by=2
max_tab_chars=32

View File

@ -0,0 +1,103 @@
#!/bin/bash
CONFIGS_DIR=/tmp/opengnsys-installer-configs
rm -rf $CONFIGS_DIR
mkdir -p $CONFIGS_DIR
# Paso 1: Seleccionar los componentes
components=$(yad --list --title="Seleccionar componentes" \
--text="Selecciona los componentes que deseas configurar:" \
--checklist --multiple \
--column="Seleccionar" --column="Componente" \
FALSE "ogCore" \
FALSE "ogGui" \
FALSE "ogDhcp" \
FALSE "ogBoot" \
--width=400 --height=300 --center)
# Verificar si el usuario seleccionó algún componente
if [[ -z "$components" ]]; then
yad --info --text="No seleccionaste ningún componente. Saliendo..." --center
exit 1
fi
for component in $components; do
selected_component=$(echo "$component" | cut -d '|' -f 2)
# Pedir la configuración específica para cada componente seleccionado
# Dividir la configuración en IP y ruta del fichero
config_file="config_${selected_component}.json"
case $selected_component in
"ogCore")
config=$(yad --form --title="Configuración para $selected_component" \
--field="Usuario administrador":TEXT \
--field="Contraseña":H \
--field="Tag del contenedor":TEXT \
"ogadmin" "" "latest" \
--width=400 --height=200 --center)
user=$(echo "$config" | cut -d '|' -f 1)
password=$(echo "$config" | cut -d '|' -f 2)
container_tag=$(echo "$config" | cut -d '|' -f 3)
echo "{\"username\": \"$user\", \"password\": \"$password\", \"container_version\": \"$container_tag\" }" > $CONFIGS_DIR/"$config_file"
;;
"ogGui")
config=$(yad --form --title="Configuración para $selected_component" \
--field="IP del servidor de ogCore" \
--field="Tag del contenedor":TEXT \
--width=400 --height=200 --center)
ogcore_ip=$(echo "$config" | cut -d '|' -f 1)
container_version=$(echo "$config" | cut -d '|' -f 2)
echo "{\"ogcore_ip\": \"$ogcore_ip\" , \"container_version\": \"$container_version\" }" > $CONFIGS_DIR/"$config_file"
;;
"ogDhcp")
config=$(yad --form --title="Configuración para $selected_component" \
--field="Configuración IP servidor de Boot" \
--field="Interfaces Boot" \
--width=400 --height=200 --center)
ogbootIP=$(echo "$config" | cut -d '|' -f 1)
interfaces=$(echo "$config" | cut -d '|' -f 2)
json_array_interfaces=$(echo "$interfaces" | jq -R 'split(",")')
echo "{\"ogbootIP\": \"$ogbootIP\", \"interfaces\": \"$json_array_interfaces\"}" > $CONFIGS_DIR/"$config_file"
;;
"ogBoot")
config=$(yad --form --title="Configuración para $selected_component" \
--field="ogCore Ip Server" \
--field="ogCore Server" \
--field="ogCore Dir" \
--field="ogBoot GitRepo" \
--field="ogBoot Samba User" \
--field="ogBoot Samba Pass" \
--width=400 --height=200 --center)
ogcore_ip=$(echo "$config" | cut -d '|' -f 1)
ogcore_server=$(echo "$config" | cut -d '|' -f 2)
ogcore_dir=$(echo "$config" | cut -d '|' -f 3)
ogboot_gitrepo=$(echo "$config" | cut -d '|' -f 4)
ogboot_samba_user=$(echo "$config" | cut -d '|' -f 5)
ogboot_samba_pass=$(echo "$config" | cut -d '|' -f 6)
echo "{\"ogcore_ip\": \"$ogcore_ip\", \"ogcore_server\": \"$ogcore_server\", \"ogcore_dir\": \"$ogcore_dir\", \"ogboot_gitrepo\": \"$ogboot_gitrepo\", \"ogboot_samba_user\": \"$ogboot_samba_user\", \"ogboot_samba_pass\": \"$ogboot_samba_pass\"}" > $CONFIGS_DIR/"$config_file"
;;
esac
# Verificar si los campos no están vacíos
# if [[ -z "$server_ip" || -z "$config_path" ]]; then
# yad --error --text="Debes proporcionar la IP del servidor y la ruta del fichero para $selected_component." --center
# exit 1
# fi
# Guardar la configuración en un archivo (cada componente tiene su archivo JSON)
config_file="./${selected_component}_config.json"
echo "{\"server_ip\": \"$server_ip\", \"config_path\": \"$config_path\"}" > "$config_file"
# Mostrar un mensaje de éxito
yad --info --text="Configuración guardada en $config_file para $selected_component." --center
done
# # Una vez se ha configurado todo, se puede proceder a la instalación de los componentes
# # Ejecutar la instalación con calamares y enviar el log a un archivo
# #calamares > installer.log 2>&1 & disown
sudo calamares > installer.log 2>&1

1
pat.txt 100644
View File

@ -0,0 +1 @@
62d16790e5fd693e3b1cd21a0fb4fe11ab9851bb

View File

@ -0,0 +1,50 @@
#!/bin/bash
#
set -x
cd /opt/opengnsys/ogCore/repo/
# Preparar el fichero .yaml
CONF_DIR=/opt/opengnsys/ogCore/etc/
mkdir -p $CONF_DIR
# Copiar el fichero de configuración a CONF_DIR
cp docker-compose-deploy.yml $CONF_DIR/
if [ -f /opt/opengnsys/ogCore/installer/.deployed ]; then
echo "ogCore ya instalado"
exit 0
fi
while ! docker compose -f $CONF_DIR/docker-compose-deploy.yml ps --format json |jq -r '"\(.Name) \(.State)"' |grep -q 'ogcore-php running'; do
sleep 2
done
adminuser=$(jq -r '.username' /opt/opengnsys/ogCore/installer/config.json)
adminpass=$(jq -r '.password' /opt/opengnsys/ogCore/installer/config.json)
docker compose -f $CONF_DIR/docker-compose-deploy.yml exec php composer install
docker compose -f $CONF_DIR/docker-compose-deploy.yml exec php php bin/console lexik:jwt:generate-keypair --overwrite
docker compose -f $CONF_DIR/docker-compose-deploy.yml exec php php bin/console doctrine:migrations:migrate --no-interaction
## TODO we need to feed $adminuser and $adminpass to doctrine:fixtures:load somehow
docker compose -f $CONF_DIR/docker-compose-deploy.yml exec php php bin/console doctrine:fixtures:load --no-interaction
# Provision user admin
bearer=$(curl -k -X 'POST' 'https://localhost:8443/auth/login' -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"username\": \"ogadmin\", \"password\": \"12345678\" }" | jq .token | sed 's/"//g' )
if [ $adminuser == "ogadmin" ]; then
echo "Cambiando password a ogadmin no puede ser el usuario administrador"
ogadmin_uuid=$(curl -q -k -L https://localhost:8443/users/?username=ogadmin -H 'accept: application/json' -H "Authorization: Bearer $bearer" | jq .[0].uuid | sed 's/"//g')
curl -k -L -X PUT "https://localhost:8443/users/$ogadmin_uuid/reset-password" -H 'accept: application/ld+json' -H 'Content-Type: application/ld+json' -d "{\"currentPassword\": \"12345678\", \"newPassword\": \"$adminpass\", \"repeatNewPassword\": \"$adminpass\"}" -H "Authorization: Bearer $bearer"
exit 0
fi
curl -k -L --location 'https://localhost:8443/users' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $bearer" \
--data "{ \"username\": \"$adminuser\", \"password\": \"$adminpass\", \"roles\": [\"ROLE_SUPER_ADMIN\"] }"
touch /opt/opengnsys/ogCore/installer/.deployed
exit 0

42
provision_oggui.sh 100644
View File

@ -0,0 +1,42 @@
#!/bin/bash
#
set -x
# preparar el fichero .env
ENV_DIR=/opt/opengnsys/ogGui/etc/
ENV_FILE=$ENV_DIR/.env
mkdir -p $ENV_DIR
# Comprobar si ya se ha instalado ogCore
#if [ -f /opt/opengnsys/ogGui/installer/.deployed ]; then
# echo "ogCore ya instalado"
# exit 0
#fi
# Sacar la IP del ogCore de la configuración
ogcore_ip=$(jq -r '.ogcore_ip' /opt/opengnsys/ogGui/installer/config.json)
export OGCORE_IP="$ogcore_ip"
# Si no se ha configurado la IP del ogCore, se intenta obtener de la interfaz de red
if [ -z "$ogcore_ip" ]; then
# Obtiene el nombre del interfaz asociado a la ruta por defecto
interface=$(ip route | grep default | awk '{print $5}')
# Si se encuentra el interfaz, obtiene su dirección IP
if [ -n "$interface" ]; then
ip_address=$(ip -o -4 addr show "$interface" | awk '{print $4}' | cut -d'/' -f1)
ogcore_ip=$ip_address
# Si no se ha configurado la IP del ogCore, se escribe en el fichero .env
echo "NG_APP_BASE_API_URL=https://$ogcore_ip:8443" > $ENV_FILE
exit 0
else
echo "No se pudo determinar el interfaz asociado a la ruta por defecto."
exit 1
fi
fi
# Si se ha configurado la IP del ogCore, se escribe en el fichero .env
echo "NG_APP_BASE_API_URL=$OGCORE_IP" > $ENV_FILE
touch /opt/opengnsys/ogGui/installer/.deployed

1
root_passwd 100644
View File

@ -0,0 +1 @@
root

View File

@ -0,0 +1,22 @@
#!/usr/bin/bash
#!/bin/bash
set -x
set -e
export HOME=/root
export LC_ALL=C
export DEBIAN_FRONTEND=noninteractive
export DEBOOT_STRAP_URL=http://mirror.raiolanetworks.com/ubuntu/
source buildlib.sh
## MAIN
set_root_passwd
mount_proc_sys_dev
setup_sources_list
install_no_recommends ubuntu-minimal dbus-bin grub-common grub-gfxpayload-lists grub-pc grub-pc-bin grub2-common grub-efi-amd64-signed shim-signed initramfs-tools
configure_divert
install_no_recommends linux-image-generic
clean