Skip to content

Instantly share code, notes, and snippets.

@hukl
Created April 10, 2014 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hukl/10364804 to your computer and use it in GitHub Desktop.
Save hukl/10364804 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# BEFORE: DAEMON
# PROVIDE: ezjail.example.config
#
# ezjail flavour example
. /etc/rc.subr
name=ezjail.flavour.bijail
start_cmd=flavour_setup
flavour_setup() {
# Remove traces of ourself
# N.B.: Do NOT rm $0, it points to /etc/rc
##########################
rm -f "/etc/rc.d/ezjail.flavour.bijail"
# Groups
#########
#
# You will probably start with some groups your users should be in
# pw groupadd -q -n coders # -g 1004
# pw groupadd -q -n sales # -g 1005
# Users
########
#
# You might want to add some users. The password is to be provided in the
# encrypted form as found in /etc/master.passwd.
# The example password here is "admin"
# Refer to crypt(3) and pw(8) for more information
echo -n '<hashed_key>' |\
pw useradd -n deploy -u 1001 -s /usr/local/bin/zsh -m -d /home/deploy -G wheel -c 'Deploy User' -H 0
# echo -n '$1$p75bbfK.$Kz3dwkoVlgZrfLZdAXQt91' |\
# pw useradd -n saag -u 1002 -s /bin/sh -m -d /home/saag -G coders -c 'Mutton Saag' -H 0
# echo -n '$1$p75bbfK.$Kz3dwkoVlgZrfLZdAXQt91' |\
# pw useradd -n mac -u 1002 -s /bin/sh -m -d /home/mac -G sales -c 'Big Mac' -H 0
# Files
########
#
# You can now give files to users just created
# chown -R admin:coders /usr/local/cvsroot
# chown -R admin:sales /usr/local/nfs/sales
# Packages
###########
# First delete old pkg.conf
rm -rf /usr/local/etc/pkg.conf
# Install all packages previously put to /pkg
# Remove package files afterwards
env ASSUME_ALWAYS_YES=YES pkg bootstrap
env ASSUME_ALWAYS_YES=YES pkg install security/sudo shells/zsh devel/git \
editors/vim-lite sysutils/tmux
# Postinstall
##############
#
# Your own stuff here, for example set login shells that were only
# installed just before.
# Please note, that for all network related stuff like ports,
# package remote fetching, etc. you need a sane /etc/resolv.conf
# chpass -s /usr/local/bin/bash admin
# pkg_add -r pico
# cd /usr/ports/sysutils/screen && make install
}
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment