Merge branch 'build'
This commit is contained in:
commit
cc3dc6799f
@ -11,4 +11,8 @@ network_rc: "homeserver_network.conf"
|
||||
rc_conf: "homeserver_rc.conf"
|
||||
loader_conf: "homeserver_loader.conf"
|
||||
cputype: "intel"
|
||||
cpu_opt: broadwell
|
||||
hwpstate: false
|
||||
build_user:
|
||||
name: talexander
|
||||
group: talexander
|
||||
|
@ -11,5 +11,9 @@ network_rc: "odofreebsd_network.conf"
|
||||
rc_conf: "odofreebsd_rc.conf"
|
||||
loader_conf: "odofreebsd_loader.conf"
|
||||
cputype: "intel"
|
||||
cpu_opt: tigerlake
|
||||
hwpstate: true
|
||||
cores: 8
|
||||
build_user:
|
||||
name: talexander
|
||||
group: talexander
|
||||
|
@ -12,3 +12,4 @@
|
||||
- firewall
|
||||
- cpu
|
||||
- ntp
|
||||
- build
|
||||
|
1
ansible/roles/build/defaults/main.yaml
Normal file
1
ansible/roles/build/defaults/main.yaml
Normal file
@ -0,0 +1 @@
|
||||
freebsd_version: "releng/13.1"
|
6
ansible/roles/build/files/CUSTOM
Normal file
6
ansible/roles/build/files/CUSTOM
Normal file
@ -0,0 +1,6 @@
|
||||
include GENERIC-NODEBUG
|
||||
|
||||
# Disable Intel SD/MMC controller for reading eMMC
|
||||
nodevice sdhci
|
||||
|
||||
ident CUSTOM
|
20
ansible/roles/build/files/freebsd_update_step1
Normal file
20
ansible/roles/build/files/freebsd_update_step1
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Build and installs whatever is in /usr/src. Run step 1, reboot, then step 2.
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cores=$(sysctl -n hw.ncpu)
|
||||
|
||||
if sudo etcupdate status | grep -qE '^ C '; then
|
||||
>&2 echo 'Conflicts remain in etcupdate. Run `etcupdate resolve` to fix them first.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd /usr/src
|
||||
|
||||
make -j "$cores" clean
|
||||
make -j "$cores" buildworld buildkernel
|
||||
sudo make installkernel
|
||||
|
||||
echo "FreeBSD update step 1 done. Please reboot."
|
19
ansible/roles/build/files/freebsd_update_step2
Normal file
19
ansible/roles/build/files/freebsd_update_step2
Normal file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Build and installs whatever is in /usr/src. Run step 1, reboot, then step 2.
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
sudo etcupdate -p
|
||||
|
||||
cd /usr/src
|
||||
sudo make installworld
|
||||
sudo etcupdate -B
|
||||
|
||||
if sudo etcupdate status | grep -qE '^ C '; then
|
||||
>&2 echo 'Conflicts in etcupdate. Run `etcupdate resolve` to fix them first.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "FreeBSD update step 2 done. Please reboot."
|
3
ansible/roles/build/files/make.conf
Normal file
3
ansible/roles/build/files/make.conf
Normal file
@ -0,0 +1,3 @@
|
||||
KERNCONF=CUSTOM
|
||||
|
||||
BUILD_STATIC=YES
|
2
ansible/roles/build/meta/main.yaml
Normal file
2
ansible/roles/build/meta/main.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- users
|
14
ansible/roles/build/tasks/common.yaml
Normal file
14
ansible/roles/build/tasks/common.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
- import_tasks: tasks/freebsd.yaml
|
||||
when: 'os_flavor == "freebsd" and build_user is defined'
|
||||
|
||||
- import_tasks: tasks/linux.yaml
|
||||
when: 'os_flavor == "linux"'
|
||||
|
||||
- include_tasks:
|
||||
file: tasks/peruser.yaml
|
||||
apply:
|
||||
become: yes
|
||||
become_user: "{{ initialize_user }}"
|
||||
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}"
|
||||
loop_control:
|
||||
loop_var: initialize_user
|
73
ansible/roles/build/tasks/freebsd.yaml
Normal file
73
ansible/roles/build/tasks/freebsd.yaml
Normal file
@ -0,0 +1,73 @@
|
||||
- name: Install packages
|
||||
package:
|
||||
name:
|
||||
- git
|
||||
state: present
|
||||
|
||||
- name: Create directories
|
||||
file:
|
||||
name: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
owner: "{{ build_user.name }}"
|
||||
group: "{{ build_user.group }}"
|
||||
loop:
|
||||
- "/usr/src"
|
||||
- "/usr/obj"
|
||||
|
||||
- name: chown the FreeBSD source
|
||||
file:
|
||||
name: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ build_user.name }}"
|
||||
group: "{{ build_user.group }}"
|
||||
recurse: true
|
||||
loop:
|
||||
- "/usr/src"
|
||||
|
||||
- name: Clone FreeBSD Source
|
||||
git:
|
||||
repo: "https://git.FreeBSD.org/src.git"
|
||||
dest: /usr/src
|
||||
version: "{{ freebsd_version }}"
|
||||
force: true
|
||||
become: true
|
||||
become_user: "{{ build_user.name }}"
|
||||
diff: false
|
||||
|
||||
- name: Install Configuration
|
||||
copy:
|
||||
src: "files/{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: wheel
|
||||
loop:
|
||||
- src: make.conf
|
||||
dest: /etc/make.conf
|
||||
- src: CUSTOM
|
||||
dest: /usr/src/sys/amd64/conf/CUSTOM
|
||||
|
||||
- name: Install Configuration
|
||||
template:
|
||||
src: "templates/{{ item.src }}.j2"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: wheel
|
||||
loop:
|
||||
- src: src.conf
|
||||
dest: /etc/src.conf
|
||||
|
||||
- name: Install scripts
|
||||
copy:
|
||||
src: "files/{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: 0700
|
||||
owner: "{{ build_user.name }}"
|
||||
group: "{{ build_user.group }}"
|
||||
loop:
|
||||
- src: freebsd_update_step1
|
||||
dest: /usr/local/bin/freebsd_update_step1
|
||||
- src: freebsd_update_step2
|
||||
dest: /usr/local/bin/freebsd_update_step2
|
6
ansible/roles/build/tasks/linux.yaml
Normal file
6
ansible/roles/build/tasks/linux.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
# - name: Install packages
|
||||
# pacman:
|
||||
# name:
|
||||
# - foo
|
||||
# state: present
|
||||
# update_cache: true
|
1
ansible/roles/build/tasks/main.yaml
Normal file
1
ansible/roles/build/tasks/main.yaml
Normal file
@ -0,0 +1 @@
|
||||
- import_tasks: tasks/common.yaml
|
29
ansible/roles/build/tasks/peruser.yaml
Normal file
29
ansible/roles/build/tasks/peruser.yaml
Normal 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"'
|
0
ansible/roles/build/tasks/peruser_freebsd.yaml
Normal file
0
ansible/roles/build/tasks/peruser_freebsd.yaml
Normal file
0
ansible/roles/build/tasks/peruser_linux.yaml
Normal file
0
ansible/roles/build/tasks/peruser_linux.yaml
Normal file
22
ansible/roles/build/templates/src.conf.j2
Normal file
22
ansible/roles/build/templates/src.conf.j2
Normal file
@ -0,0 +1,22 @@
|
||||
{% if cpu_opt is defined and cpu_opt %}
|
||||
CPUTYPE?={{ cpu_opt }}
|
||||
{% endif %}
|
||||
OPTIMIZED_CFLAGS=YES
|
||||
BUILD_OPTIMIZED=YES
|
||||
WITH_CPUFLAGS=YES
|
||||
WITH_MALLOC_PRODUCTION=YES
|
||||
WITHOUT_LLVM_ASSERTIONS=YES
|
||||
WITH_REPRODUCIBLE_BUILD=YES
|
||||
|
||||
# Would be fun to experiment with:
|
||||
# WITHOUT_SOURCELESS=YES
|
||||
|
||||
# Questionable Optimizations
|
||||
WITHOUT_FLOPPY=YES
|
||||
WITHOUT_HTML=YES
|
||||
WITHOUT_IPFW=YES
|
||||
WITHOUT_IPFILTER=YES
|
||||
WITHOUT_LLVM_TARGET_ALL=YES
|
||||
# Commented out because maybe I want email alerts for failing disks
|
||||
# WITHOUT_MAIL=YES
|
||||
# WITHOUT_SENDMAIL=YES
|
@ -43,7 +43,7 @@
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: wheel
|
||||
with_items:
|
||||
loop:
|
||||
- src: powerdxxrc.conf
|
||||
dest: /etc/rc.conf.d/powerdxx
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user