Add a role for portshaker.

This commit is contained in:
Tom Alexander 2022-12-10 15:29:19 -05:00
parent 5675f317dd
commit 7de6bc9231
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
15 changed files with 155 additions and 1 deletions

View File

@ -53,3 +53,7 @@ sway_conf_files:
wireguard_directory: odo
enabled_wireguard:
- wgh
poudriere_builds:
- jail: current
ports: default
set: framework

View File

@ -36,6 +36,7 @@
- google_cloud_sdk
- ansible
- wireguard
- portshaker
- hosts: nat_dhcp:homeserver_nat_dhcp
vars:

View File

@ -1,7 +1,7 @@
- name: Set the /etc/hosts
ansible.builtin.lineinfile:
path: /etc/hosts
regexp: '^{{ item.key | regex_escape() }}'
regexp: '^{{ item.key | regex_escape() }}\s+'
line: "{{ item.key }} {{ item.value | join(' ') }}"
loop: "{{ etc_hosts | dict2items }}"

View File

@ -0,0 +1,10 @@
#!/bin/sh
. /usr/local/share/portshaker/portshaker.subr
if [ "$1" != '--' ]; then
err 1 "Extra arguments"
fi
shift
method="git"
git_clone_uri="https://github.com/freebsd/freebsd-ports.git"
git_branch="main"
run_portshaker_command $*

View File

@ -0,0 +1,10 @@
#!/bin/sh
. /usr/local/share/portshaker/portshaker.subr
if [ "$1" != '--' ]; then
err 1 "Extra arguments"
fi
shift
method="git"
git_clone_uri="https://code.fizz.buzz/talexander/ta_ports.git"
git_branch="master"
run_portshaker_command $*

View File

@ -0,0 +1,8 @@
#---[ Base directory for mirrored Ports Trees ]---
mirror_base_dir="/var/cache/portshaker"
#---[ Directories where to merge ports ]---
ports_trees="main"
main_ports_tree="/usr/local/portshaker/trees/main"
main_merge_from="freebsd myrepo"

View File

@ -0,0 +1,15 @@
- import_tasks: tasks/freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/linux.yaml
when: 'os_flavor == "linux"'
- include_tasks:
file: tasks/peruser.yaml
apply:
become: yes
become_user: "{{ initialize_user }}"
when: users is defined
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}"
loop_control:
loop_var: initialize_user

View File

@ -0,0 +1,50 @@
# Update ports tree:
# portshaker -U
# portshaker -M
#
# Force build:
# poudriere bulk -J 4 -C -j current -p default -z testing sysutils/kubectx
#
# Test build with interactive shell
# poudriere testport -i -J 4 -j current -p default -z testing sysutils/kubectx
# optional add -w to save the work directory
- name: Install packages
package:
name:
- portshaker
state: present
- name: Create directories
file:
name: "{{ item }}"
state: directory
mode: 0755
owner: root
group: wheel
loop:
- /usr/local/portshaker/trees
- name: Install Configuration
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0644
owner: root
group: wheel
loop:
- src: portshaker.conf
dest: /usr/local/etc/portshaker.conf
- name: Install Scripts
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0755
owner: root
group: wheel
loop:
- src: freebsd
dest: /usr/local/etc/portshaker.d/freebsd
- src: myrepo
dest: /usr/local/etc/portshaker.d/myrepo

View File

@ -0,0 +1,21 @@
# - name: Build aur packages
# register: buildaur
# become_user: "{{ build_user.name }}"
# command: "aurutils-sync --no-view {{ item }}"
# args:
# creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*"
# loop:
# - foo
# - name: Update cache
# when: buildaur.changed
# pacman:
# name: []
# state: present
# update_cache: true
# - name: Install packages
# package:
# name:
# - foo
# state: present

View File

@ -0,0 +1,2 @@
- import_tasks: tasks/common.yaml
when: poudriere_builds is defined and poudriere_builds

View File

@ -0,0 +1,29 @@
- include_role:
name: per_user
# - name: Create directories
# file:
# name: "{{ account_homedir.stdout }}/{{ item }}"
# state: directory
# mode: 0700
# owner: "{{ account_name.stdout }}"
# group: "{{ group_name.stdout }}"
# loop:
# - ".config/foo"
# - name: Copy files
# copy:
# src: "files/{{ item.src }}"
# dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
# mode: 0600
# owner: "{{ account_name.stdout }}"
# group: "{{ group_name.stdout }}"
# loop:
# - src: foo.conf
# dest: .config/foo/foo.conf
- import_tasks: tasks/peruser_freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/peruser_linux.yaml
when: 'os_flavor == "linux"'

View File

@ -11,6 +11,8 @@ if [[ ! -v XDG_RUNTIME_DIR ]]; then
fi
export XDG_CURRENT_DESKTOP=sway
# Enable wayland support for firefox
export MOZ_ENABLE_WAYLAND=1

View File

@ -5,4 +5,6 @@ set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export XDG_CURRENT_DESKTOP=sway
exec sway -d &> $HOME/.config/swaylog