ISO adaptations and packaging

This commit is contained in:
Ward from fusion-voyager-3 2024-02-18 15:11:52 +03:00
parent 7ab41c718b
commit 1cf20a922c
22 changed files with 988 additions and 17 deletions

47
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: PikaOS Package Release
on:
workflow_dispatch
jobs:
build:
runs-on: self-hosted
container:
image: ghcr.io/pikaos-linux/pika-package-container:latest
volumes:
- /proc:/proc
options: --privileged -it
steps:
- uses: actions/checkout@v3
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
name: id_rsa
known_hosts: ${{ secrets.KNOWN_HOSTS }}
if_key_exists: replace
- name: Build Package
run: chmod +x ./main.sh && ./main.sh
- name: Release Package
run: chmod +x ./release.sh && ./release.sh
- name: Purge cache
uses: strrife/cloudflare-chunked-purge-action@master
env:
# Zone is required by both authentication methods
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
PURGE_URLS: ${{ vars.PURGE_URLS }}

17
Cargo.lock generated
View File

@ -584,6 +584,12 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "log"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "malloc_buf"
version = "0.0.6"
@ -696,6 +702,7 @@ dependencies = [
"os_pipe",
"regex",
"user",
"users",
]
[[package]]
@ -1004,6 +1011,16 @@ dependencies = [
"winapi 0.1.23",
]
[[package]]
name = "users"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
dependencies = [
"libc",
"log",
]
[[package]]
name = "version-compare"
version = "0.1.1"

View File

@ -14,3 +14,4 @@ gettext-rs = { version = "0.7", features = ["gettext-system"] }
duct = "0.13.7"
os_pipe = "1.1.5"
user = "0.1.1"
users = "0.11.0"

View File

@ -8,6 +8,9 @@ install:
cp -vf target/release/pika-first-setup-gtk4 $(DESTDIR)/usr/bin/
chmod 755 $(DESTDIR)/usr/bin/pika-first-setup-gtk4
mkdir -p $(DESTDIR)/usr/share/glib-2.0/schemas/
mkdir -p $(DESTDIR)/usr/lib/pika/pika-first-setup-gtk4/scripts/
cp -rvf data/scripts/*.sh $(DESTDIR)/usr/lib/pika/pika-first-setup-gtk4/scripts/
chmod 755 $(DESTDIR)/usr/lib/pika/pika-first-setup-gtk4/scripts/*.sh
cp data/com.github.pikaos-linux.pikafirstsetup.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
mkdir -p $(DESTDIR)/usr/share/applications
cp -vf data/com.github.pikaos-linux.pikafirstsetup.desktop $(DESTDIR)/usr/share/applications/

View File

@ -1,10 +1,11 @@
[Desktop Entry]
Name=PikaOS First Setup
Name[en_US]=PikaOS First Setup
Exec=pika-first-setup
Icon=com.github.pikaos-linux.pikafirstsetup
Terminal=false
Type=Application
Encoding=UTF-8
Name=PikaOS Initial User Setup
Exec=pika-first-setup-gtk4
Hidden=false
NoDisplay=true
StartupNotify=true
Icon=com.github.pikaos-linux.pikafirstsetup
X-GNOME-Autostart-enabled=true
X-KDE-AutostartScript=true
Categories=GNOME;GTK;Utility;
Keywords=Gnome;GTK

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 106 KiB

3
data/scripts/pika-sudo.sh Executable file
View File

@ -0,0 +1,3 @@
#! /bin/bash
echo "pikaos" | sudo -S "$@"

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
pika-first-setup (1.0.0-100pika1) pikauwu; urgency=low
* First release
-- Ward Nakchbandi <hotrod.master@hotmail.com> Thu, 20 Sep 2022 22:01:00 +0000

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

18
debian/control vendored Normal file
View File

@ -0,0 +1,18 @@
Source: pika-first-setup
Section: utils
Priority: optional
Maintainer: International Arms dealers <chipichipi@chapachapa.com>
Build-Depends: build-essential,
debhelper,
cargo,
libadwaita-1-dev,
libgtk-4-dev,
desktop-file-utils,
make,
libvte-2.91-gtk4-dev
Rules-Requires-Root: no
Package: pika-first-setup-gtk4
Architecture: any
Depends: ${shlibs:Depends}
Description: A frontend in GTK 4 and Libadwaita for initial user setup in pika.

10
debian/postinst vendored Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -e
update-mime-database /usr/share/mime
update-desktop-database
glib-compile-schemas /usr/share/glib-2.0/schemas

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (native)

15
main.sh Normal file
View File

@ -0,0 +1,15 @@
# Clone Upstream
mkdir -p ./pika-first-setup
rsync -av --progress ./* ./pika-first-setup --exclude ./pika-first-setup
cd ./pika-first-setup
# Get build deps
apt-get build-dep ./ -y
# Build package
dpkg-buildpackage --no-sign
# Move the debs to output
cd ../
mkdir -p ./output
mv ./*.deb ./output/

8
release.sh Normal file
View File

@ -0,0 +1,8 @@
# send debs to server
rsync -azP --include './' --include '*.deb' --exclude '*' ./output/ ferreo@direct.pika-os.com:/srv/www/incoming/
# add debs to repo
ssh ferreo@direct.pika-os.com 'aptly repo add -force-replace -remove-files pikauwu-main /srv/www/incoming/'
# publish the repo
ssh ferreo@direct.pika-os.com 'aptly publish update -batch -skip-contents -force-overwrite pikauwu filesystem:pikarepo:'

View File

@ -4,3 +4,4 @@ pub const LOCALEDIR: &str = "/usr/share/locale";
//pub const PKGDATADIR: &str = " /usr/share";
//pub const RESOURCES_FILE: &str = concat!(@PKGDATADIR@, "/resources.gresource");
//pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const DISTRO_ICON: &str = "pika-logo";

View File

@ -23,7 +23,7 @@ use std::io::BufReader;
const CODEC_INSTALL_PROG: &str = "
#! /bin/bash
set -e
sudo apt update -y && sudo apt install pika-codecs-meta -y
/usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh apt update -y && /usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh apt install pika-codecs-meta -y
";
fn codec_install(

View File

@ -46,6 +46,6 @@ pub fn final_carousel(first_setup_carousel: &adw::Carousel) {
first_setup_carousel.append(&first_setup_final_box);
first_setup_start_button.connect_clicked( move |_| {
let _ = cmd!("sudo", "bash", "-c", REBOOT_PROG).read();
let _ = cmd!("/usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh", "bash", "-c", REBOOT_PROG).read();
});
}

View File

@ -23,7 +23,7 @@ use std::io::BufReader;
const GAMEUTILS_INSTALL_PROG: &str = "
#! /bin/bash
set -e
sudo apt update -y && sudo apt install pika-gameutils-meta -y
/usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh apt update -y && /usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh apt install pika-gameutils-meta -y
";
fn gameutils_install(

View File

@ -7,6 +7,7 @@ use glib::*;
use gtk::*;
use gettextrs::gettext;
use crate::config::{DISTRO_ICON};
pub fn initial_carousel(first_setup_carousel: &adw::Carousel) {
let first_setup_initial_box = gtk::Box::builder()
@ -19,7 +20,7 @@ pub fn initial_carousel(first_setup_carousel: &adw::Carousel) {
.build();
let first_setup_initial_box_text = adw::StatusPage::builder()
.icon_name("debian-swirl")
.icon_name(DISTRO_ICON)
.title(gettext("first_setup_initial_box_text_title"))
.description(gettext("first_setup_initial_box_text_description"))
.build();

View File

@ -23,7 +23,7 @@ use std::io::BufReader;
const APT_UPDATE_PROG: &str = "
#! /bin/bash
set -e
sudo apt update -y && sudo apt full-upgrade -y
/usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh apt update -y && /usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh apt full-upgrade -y
";
fn apt_update(

View File

@ -21,12 +21,12 @@ USERNAME="$0"
PASSWORD="$1"
FULLNAME="$2"
adduser --quiet --disabled-password --shell /bin/bash --gecos "${FULLNAME}" "${USERNAME}"
echo "${USERNAME}":"${PASSWORD}" | sudo chpasswd
usermod -a -G sudo "${USERNAME}"
echo "${USERNAME}":"${PASSWORD}" | /usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh chpasswd
usermod -a -G /usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh "${USERNAME}"
mkdir -p /home/"${USERNAME}"
cp -rvf /etc/skel/.* /home/"${USERNAME}"/ || true
chown -R "${USERNAME}":"${USERNAME}" /home/"${USERNAME}"
usermod -a -G adm,cdrom,sudo,render,dip,video,plugdev,input,render,lpadmin "${USERNAME}"
usermod -a -G adm,cdrom,/usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh,render,dip,video,plugdev,input,render,lpadmin "${USERNAME}"
rm -rf /etc/sddm.conf.d/zautologin.conf || true
"###;
@ -281,7 +281,7 @@ pub fn user_carousel(first_setup_carousel: &adw::Carousel) {
}));
user_next_button.connect_clicked(clone!(@weak first_setup_carousel, @weak user_info_username, @weak user_info_password, @weak user_info_full_name => move |_| {
let _ = cmd!("sudo", "bash", "-c", USER_CREATE_PROG, &user_info_username.text(), &user_info_password.text(), &user_info_full_name.text()).read();
let _ = cmd!("/usr/lib/pika/pika-first-setup-gtk4/scripts/pika-sudo.sh", "bash", "-c", USER_CREATE_PROG, &user_info_username.text(), &user_info_password.text(), &user_info_full_name.text()).read();
first_setup_carousel.scroll_to(&first_setup_carousel.nth_page(3), true);
}));
}

View File

@ -9,6 +9,7 @@ use gdk::Display;
use gtk::*;
use gettextrs::{gettext, LocaleCategory};
use users::*;
use config::{GETTEXT_PACKAGE, LOCALEDIR, APP_ID};
// application crates
@ -47,5 +48,11 @@ fn main() {
app.connect_activate(build_ui);
});
application.run();
if get_current_username().unwrap() == "pikaos" {
application.run();
} else {
println!("Error: This program can only be run via pikaos user");
std::process::exit(1)
}
}