Skip to content

Commit

Permalink
Merge pull request #66 from drauger-os-development/testing
Browse files Browse the repository at this point in the history
A multitude of bug fixes
  • Loading branch information
Batcastle authored Feb 1, 2022
2 parents e5bf621 + 91e2588 commit ac0588a
Show file tree
Hide file tree
Showing 57 changed files with 1,393 additions and 883 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*.pyc
__pycache__
changelog.gz
changelog
*.o
*.so
4 changes: 2 additions & 2 deletions DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Package: system-installer
Version: 2.1.0
Version: 2.2.6
Maintainer: Thomas Castleman <[email protected]>
Homepage: https://github.com/drauger-os-development/system-installer
Section: admin
Architecture: all
Architecture: amd64
Priority: important
Depends: arch-install-scripts, python3 (>=3.6.7-1~18.04), bash, gir1.2-gtk-3.0 (>=3.24.12-1ubuntu1), coreutils (>=8.28-1ubuntu1), apt (>=1.6.11), squashfs-tools (>=1:4.3-6ubuntu0.18.04.1), zenity (>=3.28.1-1), grub2-common (>=2.02-2ubuntu8.13), initramfs-tools (>=0.130ubuntu3.8), systemd (>=237-3ubuntu10.24), locales (>=2.27-3ubuntu1), procps (>=2:3.3.12-3ubuntu1.1), grep (>=3.1-2), keyboard-configuration, util-linux (>=2.34-0.1ubuntu2), python3-parted (>=3.11.2), python3-psutil (>=5.5.0), python3-apt (>=2.0.0), python3-pycurl, python3-gnupg (>=0.4.5), python3-xmltodict (>=0.11.0)
Description: System Installer for Drauger OS
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ This drawback is in place for a number of reasons:
* `systemd-boot` does not support BIOS
* `GRUB` is a pain on UEFI

### +40 MB *.deb
### Max 40+ MB *.deb
The *.deb is currently +40 MB because it packs a kernel to install inside the *.deb file.

This can be circumvented by passing the `--pool` flag to `build.sh`, and results in a *.deb with no kernel archive. To use this DEB, please be sure to have a folder in your ISO storing all necessary packages (kernel and systemd-boot-manager) and have that folder defined in `etc/system-installer/settings.json`.
90 changes: 56 additions & 34 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PAK=$(cat DEBIAN/control | grep 'Package: ' | sed 's/Package: //g')
ARCH=$(cat DEBIAN/control | grep 'Architecture: '| sed 's/Architecture: //g')
FOLDER="$PAK\_$VERSION\_$ARCH"
FOLDER=$(echo "$FOLDER" | sed 's/\\//g')
OPTIONS="$1"
mkdir ../"$FOLDER"
##############################################################
# #
Expand All @@ -14,40 +15,48 @@ mkdir ../"$FOLDER"
##############################################################

# Instead of compiling, we are building a tar.xz archive of the latest kernel package
cd usr/share/system-installer/modules
echo -e "\t###\tDOWNLOADING\t###\t"
rsync -vr rsync://apt.draugeros.org/aptsync/pool/main/l/linux-upstream kernel
rsync -vr rsync://apt.draugeros.org/aptsync/pool/main/l/linux-meta kernel
echo -e "\t###\tDELETING CRUFT\t###\t"
list=$(ls kernel)
for each in $list; do
remove=$(ls kernel/$each | grep -v 'amd64.deb$')
for each2 in $remove; do
rm -rfv kernel/$each/$each2
# Don't make the archive if --pool passed
if [ "$OPTIONS" != "--pool" ]; then
cd usr/share/system-installer
echo -e "\t###\tDOWNLOADING\t###\t"
rsync -vr rsync://apt.draugeros.org/aptsync/pool/main/l/linux-upstream kernel
rsync -vr rsync://apt.draugeros.org/aptsync/pool/main/l/linux-meta kernel
echo -e "\t###\tDELETING CRUFT\t###\t"
list=$(ls kernel)
for each in $list; do
remove=$(ls kernel/$each | grep -v 'amd64.deb$')
for each2 in $remove; do
rm -rfv kernel/$each/$each2
done
done
done
meta=$(echo kernel/linux-meta/$(ls kernel/linux-meta | sort -Vr | head -1))
dep=$(dpkg-deb --field $meta Depends | sed 's/, /\\|/g')
cd kernel/linux-upstream
rm -rfv $(ls | sed "/\($dep\)/d")
dep=$(echo "$dep" | sed 's/\\|/ /g' | awk '{print $1}' | sed 's/\(image-\|headers-\)/xanmod_/g')
rm -rfv $(ls | grep "edge")
rm -rfv $(ls | grep "cacule")
cd ../linux-meta
rm -rfv $(ls | grep -v "$dep")
rm -rfv $(ls | grep "edge")
rm -rfv $(ls | grep "cacule")
cd ..
dep=$(echo "$dep" | sed 's/xanmod_//g')
mv linux-upstream "$dep"
cd ..
# delete empty folders
find . -type d -empty -print -delete
echo -e "\t###\tCOMPRESSING\t###\t"
tar --verbose --create --xz -f kernel.tar.xz kernel
echo -e "\t###\tCLEANING\t###\t"
rm -rfv kernel
cd ../../../..
meta=$(echo kernel/linux-meta/$(ls kernel/linux-meta | sort -Vr | head -1))
dep=$(dpkg-deb --field $meta Depends | sed 's/, /\\|/g')
cd kernel/linux-upstream
rm -rfv $(ls | sed "/\($dep\)/d")
dep=$(echo "$dep" | sed 's/\\|/ /g' | awk '{print $1}' | sed 's/\(image-\|headers-\)/xanmod_/g')
rm -rfv $(ls | grep "edge")
rm -rfv $(ls | grep "cacule")
cd ../linux-meta
rm -rfv $(ls | grep -v "$dep")
rm -rfv $(ls | grep "edge")
rm -rfv $(ls | grep "cacule")
cd ..
dep=$(echo "$dep" | sed 's/xanmod_//g')
mv linux-upstream "$dep"
cd ..
# delete empty folders
find . -type d -empty -print -delete
echo -e "\t###\tCOMPRESSING\t###\t"
tar --verbose --create --xz -f kernel.tar.xz kernel
echo -e "\t###\tCLEANING\t###\t"
rm -rfv kernel
cd ../../..
fi

# Pshyc - we're compiling shit now
cd usr/bin
g++ -fPIE -m64 -o system-installer system-installer.cxx $(python3.9-config --ldflags --cflags --embed)
cd ../..
##############################################################
# #
# #
Expand Down Expand Up @@ -90,9 +99,22 @@ if [ -d srv ]; then
cp -R srv ../"$FOLDER"/srv
fi
cp -R DEBIAN ../"$FOLDER"/DEBIAN
mkdir -p usr/share/doc/$PAK
git log > usr/share/doc/$PAK/changelog
cd usr/share/doc/$PAK
tar --verbose --create --xz -f changelog.gz changelog 1>/dev/null
rm changelog
cd ../../../..
base="$PWD"
cd ..
#DELETE STUFF HERE
rm system-installer/usr/share/system-installer/modules/kernel.tar.xz
if [ "$OPTIONS" != "--pool" ]; then
rm "$base"/usr/share/system-installer/kernel.tar.xz
fi
# delete binary files from repo
rm "$base"/usr/bin/system-installer
# delete C++ source from package
rm "$FOLDER"/usr/bin/system-installer.cxx
#build the shit
dpkg-deb --build "$FOLDER"
rm -rf "$FOLDER"
72 changes: 69 additions & 3 deletions development.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,85 @@
# Development Setup and Tools
# Development environment setup

The following packages are required in order to do development for `system-istaller`. Most of these packages are available in most distributions of Linux and many come pre-installed in some distros.
The following packages are required in order to do development for `system-installer`. Most of these packages are available in most distributions of Linux and many come pre-installed in some distros.

* `python3`
* `gir1.2-gtk-3.0`
* `p7zip-full`
* `python3-parted`
* `python3-gnupg`

The following are not required but may help out
* `arch-install-scripts`
* `coreutils`
* `squashfs-tools`
* `pylint`

You can find a number of tests to make sure your programs work correctly in the `tests` directory. These are currently tailored to how these programs are written, i.e. they work Python scripts. None of the UI is tested yet. Feel free to write more tests and request their addition in a pull request.
To install all of the dependencies at once, use
```bash
sudo apt install -y python3 gir1.2-gtk-3.0 p7zip-full python3-parted python3-gnupg arch-install-scripts coreutils squashfs-tools pylint
```

# How to get started

Do you know some programming and want to help out, but haven't worked on someone else's codebase before? This section is here for you. These are some recommended steps on how to contribute without diving into specifics.

1. Create a Github account (if necessary)
* It is strongly recommended to protect your github account with 2FA to protect us from your account being compromized.
* SMS 2FA is not recommended
2. Download and install a git management tool.
* [Gitkraken](https://www.gitkraken.com) is recommended
* The rest of the guide assumes you are using Gitkraken.
3. Go to preferences==>SSH. Generate a new private/public key.
4. Go to Github SSH settings and add your public key.
5. Open the Drauger OS Development repository you want to work on.
6. Click the fork button
7. Go to your repositories, you should now see your forked repository of the Drauger OS repository
8. Click on code ==> SSH and copy the URL provided
9. Go into Gitkraken and clone your forked repository using the SSH URL
10. When viewing your repository in Gitkraken, find the dev branch (remote) and have Gitkraken checkout. You should be checked out to the current dev branch of your repository
* While you are working, changes might be made to the Drauger OS repository you forked.
* If changes affect the files you are working on, you may need to rebase from your repository's page. Be aware that your work may be lost, so backup your working files.
* If you rebase, don't forget to pull from gitkraken.
11. Make the desired changes and commits.
12. Push your commits to your repository as necessary
13. When you are finished making your changes, run through the pre-pull checklist
14. Go to the pull requests section of the Drauger OS repository and generate a pull request
* Even if you have permissions to do so, don't approve pull requests you yourself generate
# Pre-pull checklist
- [ ] Run pylint
- [ ] Run unit tests
- [ ] Check type hinting
- [ ] Test the code (run the application)
# Pylint instructions
_more coming soon_
All Python code should conform to `PEP8` as closely as possible. If you open a pull request `pep8speaks` will provide feedback on your `PEP8` conformance.
A good rule of thumb is if your Python code gets a score of `7.5` or higher from `pylint`, and works correctly, the chances of having your pull request accepted is fairly high, but no pull request is guaranteed to be accepted.
# Unit test instructions
_more coming soon_
You can find a number of tests to make sure your programs work correctly in the `tests` directory. These are currently tailored to how these programs are written, i.e. they work Python scripts. None of the UI is tested yet. Feel free to write more tests and request their addition in a pull request.
If, after modifying a function, the unit test fails, fix the issue in the function. Don't modify the unit test unless the functions interface has changed

# Type hinting instructions
_coming soon_

# Recommended coding practices
This section provides standards agreed upon by senior developers. By following these guidelines, you reduce the likelihood the pull request will be returned.

* Your code should be self documenting (i.e. variable names, function names, etc.)
* Comment where necessary. Assume someone else is going to read your code
* Docstrings will describe how others will interface with your function
* other users should not need to read the code in your function to know how to use it
* Harden your function inputs
* Functions should have high functional cohesion -- doing one thing, and doing it well
* Functions should have loose coupling -- limited connections to other functions and high portability
* Minimize the scopes of variables
* Avoid duplicate code
* When able, prioritize code readability

1 change: 1 addition & 0 deletions etc/system-installer/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"squashfs_Location": "/run/live/medium/live/filesystem.squashfs",
"local_repo": "/run/live/medium/repo",
"distro": "Drauger OS",
"report": {
"recv_keys": "https://download.draugeros.org/keys/public_keys.asc",
Expand Down
2 changes: 1 addition & 1 deletion etc/xdg/autostart/system-installer.desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Desktop Entry]
Name=System Installer
Version=1.9.7-beta9
Version=2.1.8
Exec=/usr/bin/system-installer --boot-time
Comment=Install Drauger OS to your internal drive
Type=Application
Expand Down
Loading

0 comments on commit ac0588a

Please sign in to comment.