Saturday, April 8, 2017

Git Repo in Google Drive

I manage a handful of config files for various parts of my home infrastructure. Some, like my DNS zone-files require changes every now and then and I like to have my changes tracked somewhere. Naturally I turned to git to track the changes. I didn't want to pay for a private repo and I don't want some of these configs hosted publicly but I did want them in the cloud for retention. I thought it would be neat to have the git repo for my tracked files hosted in google drive and accessed via a google drive mount on my machine.

It was surprisingly easy, I installed google-drive-ocaml-fuse, in my case from the AUR. I mounted my google-drive to a folder and created some empty git repos within and added my files to each for tracking. Kind of pointless, maybe lame, I know; but a simple way to track changes to files and have them automatically backed up in cloud storage. It was also a bit slow but worked!

Friday, March 10, 2017

My custom RPMS

From time to time the need for a custom built RPM arises. I figured I may as well start tracking them somewhere. To start, I have built the latest stable version of Synergy(1.8.8) for Fedora 25. You can find the spec files for that and eventually others @ misc-rpms

Friday, October 14, 2016

pypi-mirror

This week I implemented a custom solution for creating a pypi mirror for only packages necessary for whatever projects we deploy to production. Openstack has a great solution for this in github, however it was a bit dated and had some deprecated options used in the code which caused some issues. I've since forked their repo and made changes so that it all works as it should. You can see my changes here and pull the code for your own use. I am currently in the process of having it approved and merged into OpenStack's master pypi-mirror repo.

Sunday, April 17, 2016

3 Steps to fixing "ldconfig empty, not checked" due to corrupted pkgs.

Worked this out today, figured I'd toss it on the blog for fun and hopefully to help others.

 1) Get the initial list of empty libs from pacman
cat /var/log/pacman.log | grep --text empty | awk '{print $6}' | sort -u >> /tmp/liblist
2) Determine which packages they belong to so you know which need to be re-installed
for X in $(cat /tmp/liblist); do pkgfile -s $X;done | sort -u >> /tmp/pkglist
3) Force reinstall the packages
sudo pacman -Syyy && for X in $(cat /tmp/pkglist); do sudo pacman -S --noconfirm --force $X; done
Be sure to understand these commands and what they are doing, don't just blindly run commands you find on the web. In my case these all worked out perfectly for me, they should in most cases. If something bad should come of you running these commands, I am not liable. :-P

Wednesday, March 11, 2015

Koji Autobuild from git

This week I took some time to write a solution to automatically trigger koji builds upon committing to a privately hosted git repo. The code is in a pub repo on github, bear in mind that this is the first working code release with many improvements to come. It's also my first attempt at netcode so any tips or constructive criticisms are welcome.

Repo @
https://github.com/aeboccia/koji-buildfromgit

An rpm package of koji-bfg will be coming soon, for now the repo has instructions for setting up the listener and git hook.

Note:
Currently I have only written service support for Systemd, I am sure there are SysV boxes with Koji instances running, I plan to create initscripts for the service eventually.

Tuesday, February 3, 2015

Koji Copy Signed

Recently I implemented a Koji RPM Build Server at my place of work. When it came time to signing packages before mashing repo's I was faced with a small dilemma. Sigul signing server is a great solution for signing hundreds of packages and moving them to the correct destination on disk for mash to pick them up from and mash together a repo. However for my use we would not need something so robust as we only would require a hundred or so packages in total, thus I set out in search of a simpiler solution. Fortunately I found one. A koji plugin by the name of sign.py written by Paul B Schroeder <paulbsch "at" vbridges "dot" com>. It is a neat little plugin which signs packages at build time. The issue I ran into was that the packages would be signed at build then left in /mnt/koji/packages/pkgname/#/#/arch/package.rpm Mash when using strict_keys for packages looks under /mnt/koji/packages/pkgname/#/#/data/signed/keyid/arch/package.rpm for the signed packages to mash into a repo. I plan on eventually implementing this change directly into the plugin but since I was in a hurry I whipped up a quick script to run in between mash crons which copies the signed rpms to the correct location for mash to pickup.

I will admit this is a bit redundant since the packages are already signed at build time and can be mashed into a repo just fine provided I don't set strict_keys with mash. I prefer this method as it ensures packages mashed into repos's have the key I specify. In terms of disk space I rationalize this concern with the idea that if i were to implement sigul the rpms would be copied to the same signed dir as my solution here so really either way I'd be eating up space in two places for the same RPM.

The script can be found on github @ copy_signed.py

Saturday, November 15, 2014

Killing some time with python

I was bored again tonight, so I wrote a quick, very simple, Average Calculator in python.
----------------------------------------------------------------------------------------------------------------------------------------
#!/usr/bin/python

#Modules to import
import sys

#Little Welcome message
print ("Welcome to avgcalc!\n")

#Get input from the user
user_input = input("Enter a list of numbers separated by a <space>: ")

#Separate those entered numbers by space
numbersent = map(int, user_input.split())

#Generate a list of the numbers
final_list = list(numbersent)

#Count how many numbers entered
num_of_nums = 0
for i in final_list:
    num_of_nums += 1

#Add up all the numbers
total_of_nums = 0
for y in final_list:
    total_of_nums = y + total_of_nums

#Divide the total sum of the numbers by the number of numbers entered to find the average
avg = total_of_nums / num_of_nums

#Print the final result
print ("The average of", final_list, "is", avg)
----------------------------------------------------------------------------------------------------------------------------------------