Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
puppet
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8047b9cc
authored
May 29, 2019
by
source_reader
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
cleanup for home directories
parent
616e98bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletions
modules/common/files/first_boot.service
rpi_cleanup.sh
modules/common/files/first_boot.service
View file @
8047b9cc
...
...
@@ -5,6 +5,7 @@ After = syslog.target postgresql.service
[Service]
Type = oneshot
Environment="HOME=/root"
ExecStart = /usr/local/bin/first_boot
StandardOutput = journal
StandardError = journal
...
...
rpi_cleanup.sh
View file @
8047b9cc
...
...
@@ -29,6 +29,47 @@ deb http://archive.raspberrypi.org/debian/ stretch main ui
EOF
apt update
echo
"6] Configuring root fs resize for first boot"
PARTUUID
=
"
$(
blkid
-o
export
/dev/mmcblk0p2 |
grep
PARTUUID
)
"
cat
>
/boot/cmdline.txt
<<
EOF
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=
PARTUUID=025ce4e3-02
rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh splash plymouth.ignore-serial-consoles
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=
$PARTUUID
rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh splash plymouth.ignore-serial-consoles
EOF
cat
>
/etc/init.d/resize2fs_once
<<
'
EOF
'
#!/bin/sh
#!/bin/sh
### BEGIN INIT INFO
# Provides: resize2fs_once
# Required-Start:
# Required-Stop:
# Default-Start: 3
# Default-Stop:
# Short-Description: Resize the root filesystem to fill partition
# Description:
### END INIT INFO
. /lib/lsb/init-functions
case "
$1
" in
start)
log_daemon_msg "Starting resize2fs_once"
ROOT_DEV=
$(
findmnt /
-o
source
-n
)
&&
resize2fs
$ROOT_DEV
&&
update-rc.d resize2fs_once remove &&
rm /etc/init.d/resize2fs_once &&
log_end_msg
$?
;;
*)
echo "Usage:
$0
start" >&2
exit 3
;;
esac
EOF
chmod +x /etc/init.d/resize2fs_once
systemctl
enable
resize2fs_once
echo
"7] Cleanup home directory"
cd
/home/pi
ls
-A
|
grep
^
'\.'
|
grep
-Ev
".bashrc|.bash_logout|.local|.profile"
| xargs rm
-rf
cd
/root
ls
-A
|
grep
^
'\.'
|
grep
-Ev
".bashrc|.profile|.vnc"
| xargs rm
-rf
echo
"ALL DONE! Remember to remove the puppet directory!!"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment